From c5640c9fca3f62bef8afe1dba93dbc1bf90bf221 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 15:14:07 +0200 Subject: [PATCH 1/2] prevent SPAM --- mission/controller/ThermalController.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 7133dd88..4c475e35 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1631,13 +1631,18 @@ bool ThermalController::selectAndReadSensorTemp(HeaterContext& htrCtx) { bool ThermalController::chooseHeater(heater::Switch& switchNr, heater::Switch redSwitchNr) { bool heaterAvailable = true; - if (heaterHandler.getHealth(switchNr) != HasHealthIF::HEALTHY) { - if (heaterHandler.getHealth(redSwitchNr) == HasHealthIF::HEALTHY) { + HasHealthIF::HealthState mainHealth = heaterHandler.getHealth(switchNr); + HasHealthIF::HealthState redHealth = heaterHandler.getHealth(redSwitchNr); + if (mainHealth != HasHealthIF::HEALTHY) { + if (redHealth == HasHealthIF::HEALTHY) { switchNr = redSwitchNr; redSwitchNrInUse = true; } else { heaterAvailable = false; - triggerEvent(tcsCtrl::NO_HEALTHY_HEATER_AVAILABLE, switchNr, redSwitchNr); + // 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); + } } } else { redSwitchNrInUse = false; From b135e2f6a155fd9accd1165d773294133412bf04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 30 May 2023 15:14:47 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfeed76..a9b4f3ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 - Fixed usage of C `abs` instead of C++ `std::abs`, which results in MTQ commands not being 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