refactored throttle handling
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
@ -53,11 +53,14 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (channel.isBusy() and not signals::CFDP_CHANNEL_THROTTLE_SIGNAL) {
|
||||
if (channel.isBusy() and !throttlePeriodOngoing) {
|
||||
// Throttle CFDP packet creator. It is by far the most relevant data creator, so throttling
|
||||
// it is the easiest way to handle back pressure for now in a sensible way. It is cleared
|
||||
// by the data creator.
|
||||
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = true;
|
||||
// it is the easiest way to handle back pressure for now in a sensible way.
|
||||
throttleCfdp();
|
||||
} else if(!channel.isBusy() and throttlePeriodOngoing) {
|
||||
if(minimumPeriodThrottleCd.hasTimedOut()) {
|
||||
releaseCfdp();
|
||||
}
|
||||
}
|
||||
if (!handledTm) {
|
||||
if (tmFunnelCd.hasTimedOut()) {
|
||||
@ -164,7 +167,7 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
|
||||
result = channel.write(data, size, partiallyWrittenSize);
|
||||
if (result == DirectTmSinkIF::PARTIALLY_WRITTEN) {
|
||||
// Already throttle CFDP.
|
||||
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = true;
|
||||
throttleCfdp();
|
||||
result = channel.handleLastWriteSynchronously(data, size, partiallyWrittenSize, 200);
|
||||
if (result != returnvalue::OK) {
|
||||
// TODO: Event? Might lead to dangerous spam though..
|
||||
@ -180,6 +183,17 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void LiveTmTask::throttleCfdp() {
|
||||
throttlePeriodOngoing = true;
|
||||
minimumPeriodThrottleCd.resetTimer();
|
||||
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = true;
|
||||
}
|
||||
|
||||
void LiveTmTask::releaseCfdp() {
|
||||
throttlePeriodOngoing = false;
|
||||
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = false;
|
||||
}
|
||||
|
||||
ModeTreeChildIF& LiveTmTask::getModeTreeChildIF() { return *this; }
|
||||
|
||||
ReturnValue_t LiveTmTask::initialize() {
|
||||
|
Reference in New Issue
Block a user