maybe this works better?
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
be1fb22e39
commit
2279eab5e7
@ -37,7 +37,8 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
|
|||||||
// TODO: Must read CFDP TM queue and regular TM queue and forward them. Handle regular queue
|
// TODO: Must read CFDP TM queue and regular TM queue and forward them. Handle regular queue
|
||||||
// first.
|
// first.
|
||||||
handledTm = false;
|
handledTm = false;
|
||||||
if (!channel.isBusy()) {
|
updateBusyFlag();
|
||||||
|
if (!channelIsBusy) {
|
||||||
result = handleRegularTmQueue();
|
result = handleRegularTmQueue();
|
||||||
if (result == MessageQueueIF::EMPTY) {
|
if (result == MessageQueueIF::EMPTY) {
|
||||||
result = handleCfdpTmQueue();
|
result = handleCfdpTmQueue();
|
||||||
@ -54,14 +55,14 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (channel.isBusy()) {
|
if (channelIsBusy) {
|
||||||
sif::debug << "busy" << std::endl;
|
sif::debug << "busy" << std::endl;
|
||||||
}
|
}
|
||||||
if (channel.isBusy() and !throttlePeriodOngoing) {
|
if (channelIsBusy and !throttlePeriodOngoing) {
|
||||||
// Throttle CFDP packet creator. It is by far the most relevant data creator, so throttling
|
// 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 the easiest way to handle back pressure for now in a sensible way.
|
||||||
throttleCfdp();
|
throttleCfdp();
|
||||||
} else if (!channel.isBusy() and throttlePeriodOngoing) {
|
} else if (!channelIsBusy and throttlePeriodOngoing) {
|
||||||
// Half full/empty flow control: Release the CFDP is the queue is empty enough.
|
// Half full/empty flow control: Release the CFDP is the queue is empty enough.
|
||||||
if (signals::CFDP_MSG_COUNTER <= config::LIVE_CHANNEL_CFDP_QUEUE_SIZE / 2) {
|
if (signals::CFDP_MSG_COUNTER <= config::LIVE_CHANNEL_CFDP_QUEUE_SIZE / 2) {
|
||||||
releaseCfdp();
|
releaseCfdp();
|
||||||
@ -184,6 +185,9 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue, bool isCfd
|
|||||||
sif::warning << "LiveTmTask: Synchronous write of last segment failed with code 0x"
|
sif::warning << "LiveTmTask: Synchronous write of last segment failed with code 0x"
|
||||||
<< std::setw(4) << std::hex << result << std::dec << std::endl;
|
<< std::setw(4) << std::hex << result << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
// This is a bit of a hack: If a partial write was performed and synchronously finished, we
|
||||||
|
// treat this like a busy channel.
|
||||||
|
channelIsBusy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Try delete in any case, ignore failures (which should not happen), it is more important to
|
// Try delete in any case, ignore failures (which should not happen), it is more important to
|
||||||
@ -204,6 +208,11 @@ void LiveTmTask::releaseCfdp() {
|
|||||||
sif::debug << "releasing CFDP" << std::endl;
|
sif::debug << "releasing CFDP" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LiveTmTask::updateBusyFlag() {
|
||||||
|
// We cache this as a member, because the busy bit can toggle very quickly..
|
||||||
|
channelIsBusy = channel.isBusy();
|
||||||
|
}
|
||||||
|
|
||||||
ModeTreeChildIF& LiveTmTask::getModeTreeChildIF() { return *this; }
|
ModeTreeChildIF& LiveTmTask::getModeTreeChildIF() { return *this; }
|
||||||
|
|
||||||
ReturnValue_t LiveTmTask::initialize() {
|
ReturnValue_t LiveTmTask::initialize() {
|
||||||
|
@ -47,6 +47,7 @@ class LiveTmTask : public SystemObject,
|
|||||||
// this period, the CFDP can be released if the channel is not busy.
|
// this period, the CFDP can be released if the channel is not busy.
|
||||||
// Countdown minimumPeriodThrottleCd = Countdown(config::CFDP_THROTTLE_PERIOD_MS);
|
// Countdown minimumPeriodThrottleCd = Countdown(config::CFDP_THROTTLE_PERIOD_MS);
|
||||||
bool throttlePeriodOngoing = false;
|
bool throttlePeriodOngoing = false;
|
||||||
|
bool channelIsBusy = false;
|
||||||
|
|
||||||
void readCommandQueue(void);
|
void readCommandQueue(void);
|
||||||
|
|
||||||
@ -66,6 +67,7 @@ class LiveTmTask : public SystemObject,
|
|||||||
void announceMode(bool recursive) override;
|
void announceMode(bool recursive) override;
|
||||||
void throttleCfdp();
|
void throttleCfdp();
|
||||||
void releaseCfdp();
|
void releaseCfdp();
|
||||||
|
void updateBusyFlag();
|
||||||
|
|
||||||
object_id_t getObjectId() const override;
|
object_id_t getObjectId() const override;
|
||||||
const HasHealthIF* getOptHealthIF() const override;
|
const HasHealthIF* getOptHealthIF() const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user