that should get the job done
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
2023-09-07 16:03:36 +02:00
parent f9f6ac27e8
commit 58961efb3f
13 changed files with 68 additions and 39 deletions

View File

@ -20,6 +20,9 @@ void SusHandler::doStartUp() {
}
if (internalState == InternalState::STARTUP) {
if (commandExecuted) {
if (waitingForRecovery) {
waitingForRecovery = false;
}
setMode(MODE_ON);
internalState = InternalState::NONE;
commandExecuted = false;
@ -88,26 +91,26 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
commandExecuted = true;
}
PoolReadGuard pg(&dataset);
// In a previous stricter FDIR variant, this was considered faulty communication and was already
// handled in the communication interface. However, the SUS devices probably glitch in orbit,
// so the FDIR was relaxed. The fault case check previously used now only leads to the dataset
// being marked invalid, shifting more responsibility of determining and setting SUS devices
// faulty to the operator.
// UPDATE: Step1: First determine how often and whether this happens at all
if (reply->tempRaw == 0xfff) {
// Prevent spam if a device is glitchy for prolonged periods by only triggering with a
// maximum interval.
if (faultyDataEventCd.hasTimedOut()) {
triggerEvent(TEMPERATURE_IS_ALL_ONES);
faultyDataEventCd.resetTimer();
// Simple FDIR variant to make the handler more robust to invalid messages which
// 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) {
triggerEvent(TEMPERATURE_ALL_ONES_START);
} else if (invalidMsgCounter == susMax1227::MAX_INVALID_MSG_COUNT) {
triggerEvent(DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT);
waitingForRecovery = true;
} else {
invalidMsgCounter++;
}
// dataset.setValidity(false, true);
// return returnvalue::OK;
dataset.setValidity(false, true);
dataset.tempC = thermal::INVALID_TEMPERATURE;
std::memset(dataset.channels.value, 0, sizeof(dataset.channels.value));
} else {
dataset.setValidity(true, true);
dataset.tempC = max1227::getTemperature(reply->tempRaw);
std::memcpy(dataset.channels.value, reply->channelsRaw, sizeof(reply->channelsRaw));
}
dataset.setValidity(true, true);
dataset.tempC = max1227::getTemperature(reply->tempRaw);
std::memcpy(dataset.channels.value, reply->channelsRaw, sizeof(reply->channelsRaw));
}
return returnvalue::OK;
}