Merge branch 'main' into tcs-ctrl-bugfix

This commit is contained in:
Robin Müller 2023-07-07 11:44:27 +02:00
commit 3087049726
3 changed files with 9 additions and 7 deletions

View File

@ -22,6 +22,8 @@ will consitute of a breaking change warranting a new major release:
equal or above v4. However, this software version is compatible to both v3 and v4 of the firmware. equal or above v4. However, this software version is compatible to both v3 and v4 of the firmware.
- The firmware version variables are global statics inititalized early during the program - The firmware version variables are global statics inititalized early during the program
runtime now. This makes it possible to check the firmware version earlier. runtime now. This makes it possible to check the firmware version earlier.
- The TCS controller will now always command heaters OFF when being blind for thermal
components (no sensors available), irrespective of current switch state.
## Fixed ## Fixed

View File

@ -1599,8 +1599,7 @@ void ThermalController::ctrlComponentTemperature(HeaterContext& htrCtx) {
// No sensors available, so switch the heater off. We can not perform control tasks if we // No sensors available, so switch the heater off. We can not perform control tasks if we
// are blind.. // are blind..
if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) { if (chooseHeater(htrCtx.switchNr, htrCtx.redSwitchNr)) {
if (heaterCtrlAllowed() and if (heaterCtrlAllowed()) {
(heaterHandler.getSwitchState(htrCtx.switchNr) == HeaterHandler::SwitchState::ON)) {
heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent); heaterSwitchHelper(htrCtx.switchNr, HeaterHandler::SwitchState::OFF, currThermalComponent);
} }
} }
@ -1683,7 +1682,8 @@ void ThermalController::checkLimitsAndCtrlHeater(HeaterContext& htrCtx) {
return; return;
} }
htrCtx.switchState = heaterHandler.getSwitchState(htrCtx.switchNr); htrCtx.switchState =
static_cast<HeaterHandler::SwitchState>(heaterInfo.heaterSwitchState[htrCtx.switchNr]);
// Heater off // Heater off
if (htrCtx.switchState == HeaterHandler::SwitchState::OFF) { if (htrCtx.switchState == HeaterHandler::SwitchState::OFF) {
if (sensorTemp < htrCtx.tempLimit.opLowerLimit and heaterCtrlAllowed()) { if (sensorTemp < htrCtx.tempLimit.opLowerLimit and heaterCtrlAllowed()) {

View File

@ -419,13 +419,13 @@ ReturnValue_t HeaterHandler::getAllSwitchStates(std::array<SwitchState, 8>& stat
} }
bool HeaterHandler::allSwitchesOff() { bool HeaterHandler::allSwitchesOff() {
bool allSwitchesOrd = false;
MutexGuard mg(handlerLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX); MutexGuard mg(handlerLock, LOCK_TYPE, LOCK_TIMEOUT, LOCK_CTX);
/* Or all switches. As soon one switch is on, allSwitchesOrd will be true */
for (power::Switch_t switchNr = 0; switchNr < heater::NUMBER_OF_SWITCHES; switchNr++) { for (power::Switch_t switchNr = 0; switchNr < heater::NUMBER_OF_SWITCHES; switchNr++) {
allSwitchesOrd = allSwitchesOrd || heaterVec.at(switchNr).switchState; if (heaterVec.at(switchNr).switchState == SwitchState::ON) {
return false;
}
} }
return !allSwitchesOrd; return true;
} }
MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); } MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); }