somethings wrong, i can feel it

This commit is contained in:
Robin Müller 2023-10-13 14:00:44 +02:00
parent c95964ce0f
commit be1fb22e39
Signed by: muellerr
GPG Key ID: FCE0B2BD2195142F
2 changed files with 18 additions and 6 deletions

View File

@ -60,7 +60,7 @@ ReturnValue_t CfdpHandler::initialize() {
result = handleCfdpMessages();
if (result != OK) {
}
uint32_t fsmCount = 0;
uint32_t fsmCount = 1;
const DestHandler::FsmResult& destResult = destHandler.stateMachine();
while (destResult.callStatus == CallStatus::CALL_AGAIN) {
if (fsmCount == config::CFDP_MAX_FSM_CALL_COUNT_DEST_HANDLER) {
@ -70,7 +70,7 @@ ReturnValue_t CfdpHandler::initialize() {
destHandler.stateMachine();
fsmCount++;
}
fsmCount = 0;
fsmCount = 1;
throttlePeriodOngoing = throttleSignal;
@ -78,6 +78,9 @@ ReturnValue_t CfdpHandler::initialize() {
// way without requiring huge amounts of memory for large files.
if (!throttlePeriodOngoing) {
const SourceHandler::FsmResult& srcResult = srcHandler.stateMachine();
if (srcResult.packetsSent > 0) {
signals::CFDP_MSG_COUNTER.fetch_add(srcResult.packetsSent, std::memory_order_relaxed);
}
while (srcResult.callStatus == CallStatus::CALL_AGAIN) {
// Limit number of messages.
if (fsmCount == config::CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER) {
@ -85,6 +88,9 @@ ReturnValue_t CfdpHandler::initialize() {
break;
}
srcHandler.stateMachine();
if (srcResult.packetsSent > 0) {
signals::CFDP_MSG_COUNTER.fetch_add(srcResult.packetsSent, std::memory_order_relaxed);
}
if (srcResult.result == cfdp::TM_STORE_FULL) {
sif::warning << "CFDP Source Handler: TM store is full" << std::endl;
} else if (srcResult.result == cfdp::TARGET_MSG_QUEUE_FULL) {
@ -92,6 +98,9 @@ ReturnValue_t CfdpHandler::initialize() {
}
fsmCount++;
}
if (signals::CFDP_MSG_COUNTER > 0) {
sif::debug << "CFDP msg count: " << signals::CFDP_MSG_COUNTER << std::endl;
}
}
if (shortDelay) {
TaskFactory::delayTask(config::CFDP_SHORT_DELAY_MS);

View File

@ -54,6 +54,9 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
}
}
}
if (channel.isBusy()) {
sif::debug << "busy" << std::endl;
}
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.
@ -74,10 +77,10 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
readCommandQueue();
if (DEBUG_TM_QUEUE_SPEED) {
if (consecutiveCfdpCounter > 0) {
sif::debug << "Concecutive CFDP TM handled: " << consecutiveCfdpCounter << std::endl;
sif::debug << "Consecutive CFDP TM handled: " << consecutiveCfdpCounter << std::endl;
}
if (consecutiveRegularCounter > 0) {
sif::debug << "Concecutive regular TM handled: " << consecutiveRegularCounter
sif::debug << "Consecutive regular TM handled: " << consecutiveRegularCounter
<< std::endl;
}
consecutiveRegularCounter = 0;
@ -181,7 +184,6 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue, bool isCfd
sif::warning << "LiveTmTask: Synchronous write of last segment failed with code 0x"
<< std::setw(4) << std::hex << result << std::dec << std::endl;
}
// minimumPeriodThrottleCd.resetTimer();
}
}
// Try delete in any case, ignore failures (which should not happen), it is more important to
@ -192,13 +194,14 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue, bool isCfd
void LiveTmTask::throttleCfdp() {
throttlePeriodOngoing = true;
// minimumPeriodThrottleCd.resetTimer();
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = true;
sif::debug << "throttling CFDP" << std::endl;
}
void LiveTmTask::releaseCfdp() {
throttlePeriodOngoing = false;
signals::CFDP_CHANNEL_THROTTLE_SIGNAL = false;
sif::debug << "releasing CFDP" << std::endl;
}
ModeTreeChildIF& LiveTmTask::getModeTreeChildIF() { return *this; }