monotonic for pwr ctrl
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Marius Eggert 2023-10-11 14:30:57 +02:00
parent fd0c186669
commit 740167ce99

View File

@ -156,7 +156,7 @@ ReturnValue_t PowerController::checkModeCommand(Mode_t mode, Submode_t submode,
void PowerController::calculateStateOfCharge() {
// get time
Clock::getClock_timeval(&now);
Clock::getClockMonotonic(&now);
// update EPS HK values
ReturnValue_t result = updateEpsData();
@ -285,7 +285,12 @@ ReturnValue_t PowerController::calculateOpenCircuitVoltageCharge() {
}
ReturnValue_t PowerController::calculateCoulombCounterCharge() {
double timeDiff = timevalOperations::toDouble(now - oldTime);
double timeDiff = 0.0;
if (timevalOperations::toDouble(oldTime) != 0) {
timeDiff = timevalOperations::toDouble(now - oldTime);
} else {
return returnvalue::FAILED;
}
if (timeDiff > maxAllowedTimeDiff) {
// should not be a permanent state so no spam protection required
triggerEvent(power::TIMEDELTA_OUT_OF_BOUNDS, static_cast<uint32_t>(timeDiff * 10));