some structure clean up
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
parent
c51fbb9074
commit
5a1b2470f0
@ -86,36 +86,37 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t len, DeviceC
|
|||||||
}
|
}
|
||||||
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
const auto *reply = reinterpret_cast<const acs::SusReply *>(packet);
|
const auto *reply = reinterpret_cast<const acs::SusReply *>(packet);
|
||||||
if (reply->dataWasSet) {
|
if (!reply->dataWasSet) {
|
||||||
if (internalState == InternalState::STARTUP) {
|
return returnvalue::OK;
|
||||||
commandExecuted = true;
|
|
||||||
}
|
|
||||||
PoolReadGuard pg(&dataset);
|
|
||||||
// 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);
|
|
||||||
dataset.tempC = thermal::INVALID_TEMPERATURE;
|
|
||||||
std::memset(dataset.channels.value, 0, sizeof(dataset.channels.value));
|
|
||||||
} else {
|
|
||||||
if (invalidMsgCounter > 0) {
|
|
||||||
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgCounter);
|
|
||||||
invalidMsgCounter = 0;
|
|
||||||
}
|
|
||||||
dataset.setValidity(true, true);
|
|
||||||
dataset.tempC = max1227::getTemperature(reply->tempRaw);
|
|
||||||
std::memcpy(dataset.channels.value, reply->channelsRaw, sizeof(reply->channelsRaw));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (internalState == InternalState::STARTUP) {
|
||||||
|
commandExecuted = true;
|
||||||
|
}
|
||||||
|
PoolReadGuard pg(&dataset);
|
||||||
|
// 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);
|
||||||
|
dataset.tempC = thermal::INVALID_TEMPERATURE;
|
||||||
|
std::memset(dataset.channels.value, 0, sizeof(dataset.channels.value));
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
||||||
|
if (invalidMsgCounter > 0) {
|
||||||
|
triggerEvent(TEMPERATURE_ALL_ONES_RECOVERY, invalidMsgCounter);
|
||||||
|
invalidMsgCounter = 0;
|
||||||
|
}
|
||||||
|
dataset.setValidity(true, true);
|
||||||
|
dataset.tempC = max1227::getTemperature(reply->tempRaw);
|
||||||
|
std::memcpy(dataset.channels.value, reply->channelsRaw, sizeof(reply->channelsRaw));
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user