TCS heater upper burn limit #732

Merged
muellerr merged 18 commits from tcs-heater-upper-limit into main 2023-07-11 10:56:44 +02:00
3 changed files with 12 additions and 4 deletions
Showing only changes of commit df3755d6cc - Show all commits

View File

@ -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

View File

@ -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<heater::Switch>(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<heater::Switch>(i), HeaterHandler::SwitchState::OFF);
triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast<uint32_t>(i),
MAX_HEATER_ON_DURATIONS_MS[i]);

View File

@ -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;
};