simplify max RTD low level handler

This commit is contained in:
2022-11-03 15:10:42 +01:00
parent 9044a5476c
commit 8e26ad2871
5 changed files with 22 additions and 25 deletions

View File

@ -30,16 +30,13 @@ void Max31865EiveHandler::doStartUp() {
}
void Max31865EiveHandler::doShutDown() {
updatePeriodicReply(false, EiveMax31855::RtdCommands::EXCHANGE_SET_ID);
if (state == InternalState::NONE or state == InternalState::ACTIVE or
state == InternalState::ON) {
state = InternalState::INACTIVE;
transitionOk = false;
} else {
transitionOk = true;
}
if (state == InternalState::INACTIVE and transitionOk) {
setMode(_MODE_POWER_DOWN);
setMode(MODE_OFF);
}
}
@ -151,6 +148,14 @@ ReturnValue_t Max31865EiveHandler::interpretDeviceReply(DeviceCommandId_t id,
if (getMode() == _MODE_START_UP and exchangeStruct.configured and state == InternalState::ON) {
transitionOk = true;
}
if (getMode() == _MODE_SHUT_DOWN) {
uint32_t dummy = 0;
}
if (getMode() == _MODE_SHUT_DOWN and not exchangeStruct.active) {
transitionOk = true;
return returnvalue::OK;
}
// Calculate resistance
float rtdValue = exchangeStruct.adcCode * EiveMax31855::RTD_RREF_PT1000 / INT16_MAX;
// calculate approximation