Reduce SUS FDIR Events #806

Merged
muellerr merged 7 commits from sus-fdir-reduce-events into main 2023-10-27 14:16:47 +02:00
3 changed files with 22 additions and 4 deletions

View File

@ -52,6 +52,9 @@ will consitute of a breaking change warranting a new major release:
code.
- Added a 3 second delay in the EIVE system between commanding all PL components except the SUPV,
and the SUPV itself OFF when the power level becomes low or critical.
- SUS FDIR should now trigger less events. The finish event is now only triggered once the
SUS has been working properly for a minute again. It will then display the number of periods
during which the SUS was not working as well as the maximum amount of invalid messages.
# [v7.1.0] 2023-10-11

View File

@ -97,7 +97,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
// appear sometimes for the SUS device: Allow invalid message up to a certain threshold
// before triggering FDIR reactions.
if (reply->tempRaw == 0xfff and not waitingForRecovery) {
if (invalidMsgCounter == 0) {
if (invalidMsgCounter == 0 and invalidMsgPeriodCounter == 0) {
triggerEvent(TEMPERATURE_ALL_ONES_START);
} else if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) {
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
@ -110,8 +110,17 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
return returnvalue::OK;
}
if (invalidMsgCounter > 0) {
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgCounter);
invalidMsgPeriodCounter++;
if (invalidMsgCounter > invalidMsgCounterMax) {
invalidMsgCounterMax = invalidMsgCounter;
}
invalidMsgCounter = 0;
invalidMsgCountdown.resetTimer();
}
if (invalidMsgCountdown.hasTimedOut() and invalidMsgPeriodCounter > 0) {
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgPeriodCounter, invalidMsgCounterMax);
invalidMsgPeriodCounter = 0;
invalidMsgCounterMax = 0;
}
dataset.setValidity(true, true);
dataset.tempC = max1227::getTemperature(reply->tempRaw);

View File

@ -20,8 +20,9 @@ class SusHandler : public DeviceHandlerBase {
//! [EXPORT] : [COMMENT] Detected invalid values, starting invalid message counting
static constexpr Event TEMPERATURE_ALL_ONES_START =
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Detected valid values again, resetting invalid message counter.
//! P1: Invalid message counter.
//! [EXPORT] : [COMMENT] Detected valid values for a prolonged time again, resetting all counters.
//! P1: Number of periods with invalid messages.
//! P2: Maximum invalid message counter.
static constexpr Event TEMPERATURE_ALL_ONES_RECOVERY =
event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
@ -54,8 +55,13 @@ class SusHandler : public DeviceHandlerBase {
susMax1227::SusDataset dataset;
acs::SusRequest request{};
uint8_t susIdx;
// After 1 minute, trigger the event for the invalid messages.
Countdown invalidMsgCountdown = Countdown(60000);
bool waitingForRecovery = true;
uint32_t invalidMsgCounter = 0;
uint32_t invalidMsgCounterMax = 0;
uint32_t invalidMsgPeriodCounter = 0;
uint32_t transitionDelay = 1000;
bool goToNormalMode = false;