SoC Calculator #754

Merged
muellerr merged 74 commits from soc-calculator into main 2023-10-11 10:50:48 +02:00
2 changed files with 13 additions and 1 deletions
Showing only changes of commit f8a7179de6 - Show all commits

View File

@ -44,7 +44,12 @@ ReturnValue_t PowerController::getParameter(uint8_t domainId, uint8_t parameterI
parameterWrapper->set(batteryMaximumCapacity);
break;
case 0x2:
float oldCoulombCounterVoltageUpperThreshold = coulombCounterVoltageUpperThreshold;
parameterWrapper->set(coulombCounterVoltageUpperThreshold);
ReturnValue_t result = calculateCoulombCounterChargeUpperThreshold();
if (result != returnvalue::OK) {
coulombCounterVoltageUpperThreshold = oldCoulombCounterVoltageUpperThreshold;
}
break;
case 0x3:
parameterWrapper->set(maxAllowedTimeDiff);
@ -68,6 +73,13 @@ void PowerController::performControlOperation() {
}
case InternalState::INITIAL_DELAY: {
if (initialCountdown.hasTimedOut()) {
internalState = InternalState::INIT;
}
return;
}
case InternalState::INIT: {
ReturnValue_t result = calculateCoulombCounterChargeUpperThreshold();
if (result == returnvalue::OK) {
internalState = InternalState::READY;
}
return;

View File

@ -27,7 +27,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM
bool enableHkSets = false;
ParameterHelper parameterHelper;
enum class InternalState { STARTUP, INITIAL_DELAY, READY };
enum class InternalState { STARTUP, INITIAL_DELAY, INIT, READY };
InternalState internalState = InternalState::STARTUP;
// Initial delay to make sure all pool variables have been initialized their owners