Merge pull request 'TCS: Prevent spam' (#655) from tcs-prevent-spam into v2.1.0-dev
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #655
This commit is contained in:
Marius Eggert 2023-05-30 15:47:29 +02:00
commit d400a71626
2 changed files with 9 additions and 3 deletions

View File

@ -86,6 +86,7 @@ will consitute of a breaking change warranting a new major release:
- Some smaller logic fixes in the TM store base class - Some smaller logic fixes in the TM store base class
- Fixed usage of C `abs` instead of C++ `std::abs`, which results in MTQ commands not being - Fixed usage of C `abs` instead of C++ `std::abs`, which results in MTQ commands not being
scaled correctly between 1Am² and 0.2Am². scaled correctly between 1Am² and 0.2Am².
- Prevent spam of TCS controller heater unavailability event if all heaters are in external control.
# [v2.0.5] 2023-05-11 # [v2.0.5] 2023-05-11

View File

@ -1631,14 +1631,19 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) {
bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch redSwitchNr) { bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch redSwitchNr) {
bool heaterAvailable = true; bool heaterAvailable = true;
if (heaterHandler.getHealth(switchNr) != HasHealthIF::HEALTHY) { HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr);
if (heaterHandler.getHealth(redSwitchNr) == HasHealthIF::HEALTHY) { HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr);
if (mainHealth != HasHealthIF::HEALTHY) {
if (redHealth == HasHealthIF::HEALTHY) {
switchNr = redSwitchNr; switchNr = redSwitchNr;
redSwitchNrInUse = true; redSwitchNrInUse = true;
} else { } else {
heaterAvailable = false; heaterAvailable = false;
// Special case: Ground might command/do something with the heaters, so prevent spam.
if (not(mainHealth == EXTERNAL_CONTROL and redHealth == EXTERNAL_CONTROL)) {
triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr);
} }
}
} else { } else {
redSwitchNrInUse = false; redSwitchNrInUse = false;
} }