diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 50762e2f..cffa751f 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1781,7 +1781,7 @@ void ThermalController::heaterTransitionControl( if (currentHeaterStates[i] == heaterStates[i].target) { // Required for max heater period control if (currentHeaterStates[i] == heater::SwitchState::ON) { - heaterStates[i].heaterOnPeriod.setTimeout(MAX_HEATER_ON_DURATIONS[i]); + heaterStates[i].heaterOnPeriod.setTimeout(MAX_HEATER_ON_DURATIONS_MS[i]); heaterStates[i].heaterOnPeriod.resetTimer(); } else { // The heater might still be one for some thermal components, so cross-check @@ -1809,6 +1809,8 @@ void ThermalController::heaterMaxDurationControl( heaterStates[i].switchTransition = false; heaterStates[i].heaterSwitchControlCycles = 0; heaterHandler.switchHeater(static_cast(i), heater::SwitchState::OFF); + triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast(i), + MAX_HEATER_ON_DURATIONS_MS[i]); // The heater might still be one for some thermal components, so cross-check // those components crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast(i)); diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index b6f888c2..f228a991 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -35,23 +35,23 @@ class ThermalController : public ExtendedControllerBase { static constexpr int16_t SANITY_LIMIT_UPPER_TEMP = 160; // 1 hour - static constexpr uint32_t MAX_HEATER_ON_DURATION_MS = 60 * 60 * 1000; - static constexpr uint32_t MAX_HEATER_ON_DURATIONS[8] = {// PLOC PROC board - MAX_HEATER_ON_DURATION_MS, - // PCDU PDU - MAX_HEATER_ON_DURATION_MS, - // ACS Board - MAX_HEATER_ON_DURATION_MS, - // OBC Board - MAX_HEATER_ON_DURATION_MS, - // Camera - MAX_HEATER_ON_DURATION_MS, - // STR - MAX_HEATER_ON_DURATION_MS, - // DRO - MAX_HEATER_ON_DURATION_MS, - // S-Band - MAX_HEATER_ON_DURATION_MS}; + static constexpr uint32_t DEFAULT_MAX_HEATER_ON_DURATION_MS = 60 * 60 * 1000; + static constexpr uint32_t MAX_HEATER_ON_DURATIONS_MS[8] = {// PLOC PROC board + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // PCDU PDU + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // ACS Board + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // OBC Board + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // Camera + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // STR + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // DRO + DEFAULT_MAX_HEATER_ON_DURATION_MS, + // S-Band + DEFAULT_MAX_HEATER_ON_DURATION_MS}; ThermalController(object_id_t objectId, HeaterHandler& heater, const std::atomic_bool& tcsBoardShortUnavailable, bool pollPcdu1Tmp); diff --git a/mission/controller/tcsDefs.h b/mission/controller/tcsDefs.h index 7993a0e2..1b2b968b 100644 --- a/mission/controller/tcsDefs.h +++ b/mission/controller/tcsDefs.h @@ -100,6 +100,8 @@ static constexpr Event MGT_OVERHEATING = MAKE_EVENT(8, severity::HIGH); static constexpr Event TCS_SWITCHING_HEATER_ON = MAKE_EVENT(9, severity::INFO); //! [EXPORT] : [COMMENT] P1: Module index. P2: Heater index static constexpr Event TCS_SWITCHING_HEATER_OFF = MAKE_EVENT(10, severity::INFO); +//! [EXPORT] : [COMMENT] P1: Heater index. P2: Maximum burn time for heater. +static constexpr Event TCS_HEATER_MAX_BURN_TIME_REACHED = MAKE_EVENT(11, severity::MEDIUM); enum SetId : uint32_t { SENSOR_TEMPERATURES = 0,