lot of debugging and trying out
This commit is contained in:
parent
9f600a24ff
commit
5bcd171108
@ -48,7 +48,7 @@ static constexpr uint32_t LEGACY_SA_DEPL_CHANNEL_ALTERNATION_INTERVAL_SECS = 5;
|
||||
// Maximum allowed burn time allowed by the software.
|
||||
static constexpr uint32_t SA_DEPL_MAX_BURN_TIME = 180;
|
||||
|
||||
static constexpr size_t CFDP_MAX_FILE_SEGMENT_LEN = 300;
|
||||
static constexpr size_t CFDP_MAX_FILE_SEGMENT_LEN = 990;
|
||||
|
||||
static constexpr uint32_t CCSDS_HANDLER_QUEUE_SIZE = 50;
|
||||
static constexpr uint8_t NUMBER_OF_VIRTUAL_CHANNELS = 4;
|
||||
@ -61,9 +61,10 @@ static constexpr uint32_t HK_STORE_QUEUE_SIZE = 300;
|
||||
static constexpr uint32_t CFDP_STORE_QUEUE_SIZE = 300;
|
||||
|
||||
static constexpr uint32_t LIVE_CHANNEL_NORMAL_QUEUE_SIZE = 250;
|
||||
static constexpr uint32_t LIVE_CHANNEL_CFDP_QUEUE_SIZE = 250;
|
||||
static constexpr uint32_t LIVE_CHANNEL_CFDP_QUEUE_SIZE = 400;
|
||||
|
||||
static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER = 50;
|
||||
static constexpr uint32_t CFDP_THROTTLE_PERIOD_MS = 200;
|
||||
static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER = 20;
|
||||
static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_DEST_HANDLER = 300;
|
||||
static constexpr uint32_t CFDP_SHORT_DELAY_MS = 50;
|
||||
static constexpr uint32_t CFDP_REGULAR_DELAY_MS = 200;
|
||||
|
@ -72,9 +72,7 @@ ReturnValue_t CfdpHandler::initialize() {
|
||||
}
|
||||
fsmCount = 0;
|
||||
|
||||
if (throttleSignal) {
|
||||
throttlePeriodOngoing = true;
|
||||
}
|
||||
throttlePeriodOngoing = throttleSignal;
|
||||
|
||||
// CFDP can be throttled by the slowest live TM handler to handle back pressure in a sensible
|
||||
// way without requiring huge amounts of memory for large files.
|
||||
|
@ -52,13 +52,16 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
consecutiveNoBlockWriteCounter = 0;
|
||||
}
|
||||
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.
|
||||
throttleCfdp();
|
||||
} else if(!channel.isBusy() and throttlePeriodOngoing) {
|
||||
if(minimumPeriodThrottleCd.hasTimedOut()) {
|
||||
if(minimumPeriodThrottleCd.hasTimedOut() and consecutiveNoBlockWriteCounter >= 10) {
|
||||
sif::debug << "releasing cfdp" << std::endl;
|
||||
releaseCfdp();
|
||||
}
|
||||
}
|
||||
@ -162,10 +165,14 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if(ptmeLocked) {
|
||||
consecutiveNoBlockWriteCounter= 0;
|
||||
}
|
||||
if (!ptmeLocked) {
|
||||
size_t partiallyWrittenSize = 0;
|
||||
result = channel.write(data, size, partiallyWrittenSize);
|
||||
if (result == DirectTmSinkIF::PARTIALLY_WRITTEN) {
|
||||
consecutiveNoBlockWriteCounter = 0;
|
||||
// Already throttle CFDP.
|
||||
throttleCfdp();
|
||||
result = channel.handleLastWriteSynchronously(data, size, partiallyWrittenSize, 200);
|
||||
@ -175,6 +182,9 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
|
||||
<< "LiveTmTask: Synchronous write of last segment failed with code 0x"
|
||||
<< std::setw(4) << std::hex << result << std::dec << std::endl;
|
||||
}
|
||||
minimumPeriodThrottleCd.resetTimer();
|
||||
} else {
|
||||
consecutiveNoBlockWriteCounter++;
|
||||
}
|
||||
}
|
||||
// Try delete in any case, ignore failures (which should not happen), it is more important to
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <mission/com/VirtualChannelWithQueue.h>
|
||||
#include <mission/tmtc/CfdpTmFunnel.h>
|
||||
#include <mission/tmtc/PusTmFunnel.h>
|
||||
#include <cstdint>
|
||||
#include "eive/definitions.h"
|
||||
|
||||
class LiveTmTask : public SystemObject,
|
||||
public HasModesIF,
|
||||
@ -35,13 +37,14 @@ class LiveTmTask : public SystemObject,
|
||||
ModeHelper modeHelper;
|
||||
Mode_t mode = HasModesIF::MODE_OFF;
|
||||
Countdown tmFunnelCd = Countdown(100);
|
||||
uint32_t consecutiveNoBlockWriteCounter = 0;
|
||||
PusTmFunnel& pusFunnel;
|
||||
CfdpTmFunnel& cfdpFunnel;
|
||||
VirtualChannel& channel;
|
||||
const std::atomic_bool& ptmeLocked;
|
||||
// This countdown ensures that the CFDP is always throttled with a minimum period. Only after
|
||||
// this period, the CFDP can be released if the channel is not busy.
|
||||
Countdown minimumPeriodThrottleCd = Countdown(40);
|
||||
Countdown minimumPeriodThrottleCd = Countdown(config::CFDP_THROTTLE_PERIOD_MS);
|
||||
bool throttlePeriodOngoing = false;
|
||||
|
||||
void readCommandQueue(void);
|
||||
|
Loading…
Reference in New Issue
Block a user