v7.5.0 #828
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user