v7.5.0 #828

Merged
muellerr merged 96 commits from dev-7.5.0 into main 2023-12-06 17:44:23 +01:00
Showing only changes of commit 740167ce99 - Show all commits

View File

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