diff --git a/CHANGELOG.md b/CHANGELOG.md index 5788400d..4a257fc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ will consitute of a breaking change warranting a new major release: - Two events for heaters being commanded ON and OFF by the TCS controller - Upper limit for burn time of TCS heaters. Currently set to 1 hour for each heater. + This mechanism will only track the burn time for heaters which were commanded by the + TCS controller. # [v6.0.0] 2023-07-02 diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index ce66ccc1..b0f0f9d1 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1762,7 +1762,9 @@ void ThermalController::heaterTransitionControl(const HeaterSwitchStates& curren if (currentHeaterStates[i] == HeaterHandler::SwitchState::ON) { heaterStates[i].heaterOnPeriod.setTimeout(MAX_HEATER_ON_DURATIONS_MS[i]); heaterStates[i].heaterOnPeriod.resetTimer(); + heaterStates[i].trackHeaterMaxPeriod = true; } else { + heaterStates[i].trackHeaterMaxPeriod = false; // The heater might still be one for some thermal components, so cross-check // those components crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast(i)); @@ -1782,10 +1784,13 @@ void ThermalController::heaterTransitionControl(const HeaterSwitchStates& curren void ThermalController::heaterMaxDurationControl(const HeaterSwitchStates& currentHeaterStates) { for (unsigned i = 0; i < heater::Switch::NUMBER_OF_SWITCHES; i++) { + // Right now, we only track the maximum duration for heater which were commanded by the TCS + // controller. if (currentHeaterStates[i] == HeaterHandler::SwitchState::ON and - heaterStates[i].heaterOnPeriod.hasTimedOut()) { + heaterStates[i].trackHeaterMaxPeriod and heaterStates[i].heaterOnPeriod.hasTimedOut()) { heaterStates[i].switchTransition = false; heaterStates[i].heaterSwitchControlCycles = 0; + heaterStates[i].trackHeaterMaxPeriod = false; heaterHandler.switchHeater(static_cast(i), HeaterHandler::SwitchState::OFF); triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast(i), MAX_HEATER_ON_DURATIONS_MS[i]); diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 6376f501..74e06cf5 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -61,9 +61,10 @@ struct ThermalState { }; struct HeaterState { - bool switchTransition; - HeaterHandler::SwitchState target; - uint8_t heaterSwitchControlCycles; + bool switchTransition = false; + HeaterHandler::SwitchState target = HeaterHandler::SwitchState::OFF; + uint8_t heaterSwitchControlCycles = 0; + bool trackHeaterMaxPeriod = false; Countdown heaterOnPeriod; };