this should be better
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-07-10 13:28:36 +02:00
parent 106d73238b
commit 33de08eafc
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
4 changed files with 26 additions and 11 deletions

View File

@ -15,7 +15,7 @@ TemperatureSensorInserter::TemperatureSensorInserter(
tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {} tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {}
ReturnValue_t TemperatureSensorInserter::initialize() { ReturnValue_t TemperatureSensorInserter::initialize() {
testCase = TestCase::NONE; testCase = TestCase::COLD_PLOC_STAYS_COLD;
return returnvalue::OK; return returnvalue::OK;
} }
@ -126,6 +126,13 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
sif::debug << "Setting CAM temperature back to normal" << std::endl; sif::debug << "Setting CAM temperature back to normal" << std::endl;
max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(0, true); max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(0, true);
} }
break;
}
case (TestCase::COLD_PLOC_STAYS_COLD): {
if (cycles == 15) {
sif::debug << "Setting cold PLOC temperature" << std::endl;
max31865DummyMap[objects::RTD_0_IC3_PLOC_HEATSPREADER]->setTemperature(-40, true);
}
} }
} }
cycles++; cycles++;

View File

@ -33,6 +33,7 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject
COLD_STR_CONSECUTIVE = 5, COLD_STR_CONSECUTIVE = 5,
COLD_CAMERA = 6, COLD_CAMERA = 6,
COLD_PLOC_CONSECUTIVE = 7, COLD_PLOC_CONSECUTIVE = 7,
COLD_PLOC_STAYS_COLD = 8
}; };
int iteration = 0; int iteration = 0;
uint32_t cycles = 0; uint32_t cycles = 0;

View File

@ -1791,9 +1791,10 @@ void ThermalController::heaterMaxDurationControl(const HeaterSwitchStates& curre
heaterStates[i].switchTransition = false; heaterStates[i].switchTransition = false;
heaterStates[i].heaterSwitchControlCycles = 0; heaterStates[i].heaterSwitchControlCycles = 0;
heaterStates[i].trackHeaterMaxPeriod = false; 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), triggerEvent(tcsCtrl::TCS_HEATER_MAX_BURN_TIME_REACHED, static_cast<uint32_t>(i),
MAX_HEATER_ON_DURATIONS_MS[i]); MAX_HEATER_ON_DURATIONS_MS[i]);
heaterSwitchHelper(static_cast<heater::Switch>(i), HeaterHandler::SwitchState::OFF,
std::nullopt);
// The heater might still be one for some thermal components, so cross-check // The heater might still be one for some thermal components, so cross-check
// those components // those components
crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i)); crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(static_cast<heater::Switch>(i));
@ -1847,23 +1848,28 @@ void ThermalController::resetThermalStates() {
void ThermalController::heaterSwitchHelper(heater::Switch switchNr, void ThermalController::heaterSwitchHelper(heater::Switch switchNr,
HeaterHandler::SwitchState targetState, HeaterHandler::SwitchState targetState,
unsigned componentIdx) { std::optional<unsigned> componentIdx) {
timeval currentTime; timeval currentTime;
Clock::getClockMonotonic(&currentTime); Clock::getClockMonotonic(&currentTime);
if (targetState == HeaterHandler::SwitchState::ON) { if (targetState == HeaterHandler::SwitchState::ON) {
heaterHandler.switchHeater(switchNr, targetState); heaterHandler.switchHeater(switchNr, targetState);
heaterStates[switchNr].target = HeaterHandler::SwitchState::ON; heaterStates[switchNr].target = HeaterHandler::SwitchState::ON;
heaterStates[switchNr].switchTransition = true; heaterStates[switchNr].switchTransition = true;
thermalStates[componentIdx].sensorIndex = currentSensorIndex; if (componentIdx.has_value()) {
thermalStates[componentIdx].heaterSwitch = switchNr; unsigned componentIdxVal = componentIdx.value();
thermalStates[componentIdx].heating = true; thermalStates[componentIdxVal].sensorIndex = currentSensorIndex;
thermalStates[componentIdx].heaterStartTime = currentTime.tv_sec; thermalStates[componentIdxVal].heaterSwitch = switchNr;
thermalStates[componentIdxVal].heating = true;
thermalStates[componentIdxVal].heaterStartTime = currentTime.tv_sec;
}
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(currThermalComponent), triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_ON, static_cast<uint32_t>(currThermalComponent),
static_cast<uint32_t>(switchNr)); static_cast<uint32_t>(switchNr));
} else { } else {
heaterHandler.switchHeater(switchNr, targetState); heaterHandler.switchHeater(switchNr, targetState);
thermalStates[componentIdx].heating = false; if (componentIdx.has_value()) {
thermalStates[componentIdx].heaterEndTime = currentTime.tv_sec; thermalStates[componentIdx.value()].heating = false;
thermalStates[componentIdx.value()].heaterEndTime = currentTime.tv_sec;
}
triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(currThermalComponent), triggerEvent(tcsCtrl::TCS_SWITCHING_HEATER_OFF, static_cast<uint32_t>(currThermalComponent),
static_cast<uint32_t>(switchNr)); static_cast<uint32_t>(switchNr));
} }

View File

@ -24,6 +24,7 @@
#include <atomic> #include <atomic>
#include <list> #include <list>
#include <optional>
/** /**
* NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit * NOP Limit: Hard limit for device, usually from datasheet. Device damage is possible lif NOP limit
@ -110,7 +111,7 @@ class ThermalController : public ExtendedControllerBase {
// 1 hour // 1 hour
static constexpr uint32_t DEFAULT_MAX_HEATER_ON_DURATION_MS = 60 * 60 * 1000; 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 static constexpr uint32_t MAX_HEATER_ON_DURATIONS_MS[8] = {// PLOC PROC board
DEFAULT_MAX_HEATER_ON_DURATION_MS, 60 * 1000,
// PCDU PDU // PCDU PDU
DEFAULT_MAX_HEATER_ON_DURATION_MS, DEFAULT_MAX_HEATER_ON_DURATION_MS,
// ACS Board // ACS Board
@ -347,7 +348,7 @@ class ThermalController : public ExtendedControllerBase {
void heaterSwitchHelperAllOff(); void heaterSwitchHelperAllOff();
void heaterSwitchHelper(heater::Switch switchNr, HeaterHandler::SwitchState state, void heaterSwitchHelper(heater::Switch switchNr, HeaterHandler::SwitchState state,
unsigned componentIdx); std::optional<unsigned> componentIdx);
void ctrlAcsBoard(); void ctrlAcsBoard();
void ctrlMgt(); void ctrlMgt();