reduce sus fdir events
This commit is contained in:
parent
0f6d33e9f8
commit
c139457661
@ -97,9 +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
|
// appear sometimes for the SUS device: Allow invalid message up to a certain threshold
|
||||||
// before triggering FDIR reactions.
|
// before triggering FDIR reactions.
|
||||||
if (reply->tempRaw == 0xfff and not waitingForRecovery) {
|
if (reply->tempRaw == 0xfff and not waitingForRecovery) {
|
||||||
if (invalidMsgCounter == 0) {
|
if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) {
|
||||||
triggerEvent(TEMPERATURE_ALL_ONES_START);
|
|
||||||
} else if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) {
|
|
||||||
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
|
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
|
||||||
waitingForRecovery = true;
|
waitingForRecovery = true;
|
||||||
}
|
}
|
||||||
@ -110,8 +108,16 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
if (invalidMsgCounter > 0) {
|
if (invalidMsgCounter > 0) {
|
||||||
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgCounter);
|
invalidMsgPeriodCounter++;
|
||||||
|
if (invalidMsgCounter > invalidMsgCounterMax) {
|
||||||
|
invalidMsgCounterMax = invalidMsgCounter;
|
||||||
|
}
|
||||||
invalidMsgCounter = 0;
|
invalidMsgCounter = 0;
|
||||||
|
invalidMsgCountdown.resetTimer();
|
||||||
|
}
|
||||||
|
if (invalidMsgCountdown.hasTimedOut() and invalidMsgPeriodCounter > 0) {
|
||||||
|
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgPeriodCounter, invalidMsgCounterMax);
|
||||||
|
invalidMsgPeriodCounter = 0;
|
||||||
}
|
}
|
||||||
dataset.setValidity(true, true);
|
dataset.setValidity(true, true);
|
||||||
dataset.tempC = max1227::getTemperature(reply->tempRaw);
|
dataset.tempC = max1227::getTemperature(reply->tempRaw);
|
||||||
|
@ -17,11 +17,9 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
static const uint8_t INTERFACE_ID = CLASS_ID::SUS_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::SUS_HANDLER;
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SUS_HANDLER;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SUS_HANDLER;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Detected invalid values, starting invalid message counting
|
//! [EXPORT] : [COMMENT] Detected valid values for a prolonged time again, resetting all counters.
|
||||||
static constexpr Event TEMPERATURE_ALL_ONES_START =
|
//! P1: Number of periods with invalid messages.
|
||||||
event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
//! P2: Maximum invalid message counter.
|
||||||
//! [EXPORT] : [COMMENT] Detected valid values again, resetting invalid message counter.
|
|
||||||
//! P1: Invalid message counter.
|
|
||||||
static constexpr Event TEMPERATURE_ALL_ONES_RECOVERY =
|
static constexpr Event TEMPERATURE_ALL_ONES_RECOVERY =
|
||||||
event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
|
event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
|
||||||
|
|
||||||
@ -54,8 +52,13 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
susMax1227::SusDataset dataset;
|
susMax1227::SusDataset dataset;
|
||||||
acs::SusRequest request{};
|
acs::SusRequest request{};
|
||||||
uint8_t susIdx;
|
uint8_t susIdx;
|
||||||
|
|
||||||
|
// After 1 minute, trigger the event for the invalid messages.
|
||||||
|
Countdown invalidMsgCountdown = Countdown(60000);
|
||||||
bool waitingForRecovery = true;
|
bool waitingForRecovery = true;
|
||||||
uint32_t invalidMsgCounter = 0;
|
uint32_t invalidMsgCounter = 0;
|
||||||
|
uint32_t invalidMsgCounterMax = 0;
|
||||||
|
uint32_t invalidMsgPeriodCounter = 0;
|
||||||
|
|
||||||
uint32_t transitionDelay = 1000;
|
uint32_t transitionDelay = 1000;
|
||||||
bool goToNormalMode = false;
|
bool goToNormalMode = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user