Merge branch 'tcs-heater-upper-limit' into tcs-observability
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
This commit is contained in:
@ -1814,14 +1814,13 @@ void ThermalController::heaterMaxDurationControl(
|
||||
heaterStates[i].switchTransition = false;
|
||||
heaterStates[i].heaterSwitchControlCycles = 0;
|
||||
heaterStates[i].trackHeaterMaxBurnTime = false;
|
||||
heaterHandler.switchHeater(static_cast<heater::Switch>(i), heater::SwitchState::OFF);
|
||||
triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast<uint32_t>(i),
|
||||
MAX_HEATER_ON_DURATIONS_MS[i]);
|
||||
heaterSwitchHelper(static_cast<heater::Switch>(i), heater::SwitchState::OFF,
|
||||
std::nullopt);
|
||||
// The heater might still be one for some thermal components, so cross-check
|
||||
// those components
|
||||
crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i));
|
||||
} else if (currentHeaterStates[i] == heater::SwitchState::OFF) {
|
||||
heaterStates[i].heaterOnMaxBurnTime.resetTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1868,24 +1867,30 @@ void ThermalController::resetThermalStates() {
|
||||
}
|
||||
}
|
||||
|
||||
void ThermalController::heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState targetState,
|
||||
unsigned componentIdx) {
|
||||
void ThermalController::heaterSwitchHelper(heater::Switch switchNr,
|
||||
heater::SwitchState targetState,
|
||||
std::optional<unsigned> componentIdx) {
|
||||
timeval currentTime;
|
||||
Clock::getClockMonotonic(¤tTime);
|
||||
if (targetState == heater::SwitchState::ON) {
|
||||
heaterHandler.switchHeater(switchNr, targetState);
|
||||
heaterStates[switchNr].target = heater::SwitchState::ON;
|
||||
heaterStates[switchNr].switchTransition = true;
|
||||
thermalStates[componentIdx].sensorIndex = ctrlCtx.currentSensorIndex;
|
||||
thermalStates[componentIdx].heaterSwitch = switchNr;
|
||||
thermalStates[componentIdx].heating = true;
|
||||
thermalStates[componentIdx].heaterStartTime = currentTime.tv_sec;
|
||||
if (componentIdx.has_value()) {
|
||||
unsigned componentIdxVal = componentIdx.value();
|
||||
thermalStates[componentIdxVal].sensorIndex = ctrlCtx.currentSensorIndex;
|
||||
thermalStates[componentIdxVal].heaterSwitch = switchNr;
|
||||
thermalStates[componentIdxVal].heating = true;
|
||||
thermalStates[componentIdxVal].heaterStartTime = currentTime.tv_sec;
|
||||
}
|
||||
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(ctrlCtx.thermalComponent),
|
||||
static_cast<uint32_t>(switchNr));
|
||||
} else {
|
||||
heaterHandler.switchHeater(switchNr, targetState);
|
||||
thermalStates[componentIdx].heating = false;
|
||||
thermalStates[componentIdx].heaterEndTime = currentTime.tv_sec;
|
||||
if (componentIdx.has_value()) {
|
||||
thermalStates[componentIdx.value()].heating = false;
|
||||
thermalStates[componentIdx.value()].heaterEndTime = currentTime.tv_sec;
|
||||
}
|
||||
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(ctrlCtx.thermalComponent),
|
||||
static_cast<uint32_t>(switchNr));
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <list>
|
||||
#include <optional>
|
||||
|
||||
class ThermalController : public ExtendedControllerBase {
|
||||
public:
|
||||
@ -288,7 +289,7 @@ class ThermalController : public ExtendedControllerBase {
|
||||
|
||||
void heaterSwitchHelperAllOff();
|
||||
void heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState state,
|
||||
unsigned componentIdx);
|
||||
std::optional<unsigned> componentIdx);
|
||||
|
||||
void ctrlAcsBoard();
|
||||
void ctrlMgt();
|
||||
|
Reference in New Issue
Block a user