Merge pull request 'use correct clock API in TCS CTRL' (#738) from small-tcs-fix into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #738
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Robin Müller 2023-07-12 10:29:47 +02:00
commit 887bfc87c3

View File

@ -1852,7 +1852,7 @@ void ThermalController::resetThermalStates() {
void ThermalController::heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState targetState, void ThermalController::heaterSwitchHelper(heater::Switch switchNr, heater::SwitchState targetState,
std::optional<unsigned> componentIdx) { std::optional<unsigned> componentIdx) {
timeval currentTime; timeval currentTime;
Clock::getClockMonotonic(&currentTime); Clock::getClock(&currentTime);
if (targetState == heater::SwitchState::ON) { if (targetState == heater::SwitchState::ON) {
heaterHandler.switchHeater(switchNr, targetState); heaterHandler.switchHeater(switchNr, targetState);
heaterStates[switchNr].target = heater::SwitchState::ON; heaterStates[switchNr].target = heater::SwitchState::ON;
@ -1879,7 +1879,7 @@ void ThermalController::heaterSwitchHelper(heater::Switch switchNr, heater::Swit
void ThermalController::heaterSwitchHelperAllOff() { void ThermalController::heaterSwitchHelperAllOff() {
timeval currentTime; timeval currentTime;
Clock::getClockMonotonic(&currentTime); Clock::getClock(&currentTime);
size_t idx = 0; size_t idx = 0;
for (; idx < heater::Switch::NUMBER_OF_SWITCHES; idx++) { for (; idx < heater::Switch::NUMBER_OF_SWITCHES; idx++) {
heaterHandler.switchHeater(static_cast<heater::Switch>(idx), heater::SwitchState::OFF); heaterHandler.switchHeater(static_cast<heater::Switch>(idx), heater::SwitchState::OFF);
@ -1901,7 +1901,7 @@ void ThermalController::crossCheckHeaterStateOfComponentsWhenHeaterGoesOff(
for (unsigned j = 0; j < thermalStates.size(); j++) { for (unsigned j = 0; j < thermalStates.size(); j++) {
if (thermalStates[j].heating and thermalStates[j].heaterSwitch == switchIdx) { if (thermalStates[j].heating and thermalStates[j].heaterSwitch == switchIdx) {
timeval currentTime; timeval currentTime;
Clock::getClockMonotonic(&currentTime); Clock::getClock(&currentTime);
thermalStates[j].heating = false; thermalStates[j].heating = false;
thermalStates[j].heaterEndTime = currentTime.tv_sec; thermalStates[j].heaterEndTime = currentTime.tv_sec;
} }