this should work

This commit is contained in:
Marius Eggert 2023-10-10 11:53:54 +02:00
parent b635e02f2d
commit 98a1ce5380

View File

@ -44,12 +44,17 @@ ReturnValue_t PowerController::getParameter(uint8_t domainId, uint8_t parameterI
break; break;
case 0x2: { case 0x2: {
float oldCoulombCounterVoltageUpperThreshold = coulombCounterVoltageUpperThreshold; float oldCoulombCounterVoltageUpperThreshold = coulombCounterVoltageUpperThreshold;
parameterWrapper->set(coulombCounterVoltageUpperThreshold); ReturnValue_t result = newValues->getElement(&coulombCounterVoltageUpperThreshold);
ReturnValue_t result = calculateCoulombCounterChargeUpperThreshold();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
coulombCounterVoltageUpperThreshold = oldCoulombCounterVoltageUpperThreshold; coulombCounterVoltageUpperThreshold = oldCoulombCounterVoltageUpperThreshold;
return returnvalue::FAILED; return result;
} }
result = calculateCoulombCounterChargeUpperThreshold();
if (result != returnvalue::OK) {
coulombCounterVoltageUpperThreshold = oldCoulombCounterVoltageUpperThreshold;
return result;
}
// parameterWrapper->set(coulombCounterVoltageUpperThreshold);
break; break;
} }
case 0x3: case 0x3:
@ -230,6 +235,11 @@ void PowerController::calculateStateOfCharge() {
} }
void PowerController::watchStateOfCharge() { void PowerController::watchStateOfCharge() {
if (test < 100) {
test++;
} else if (test == 100) {
// pwrCtrlCoreHk.coulombCounterCharge.value = 0.7;
}
if (pwrCtrlCoreHk.coulombCounterCharge.isValid()) { if (pwrCtrlCoreHk.coulombCounterCharge.isValid()) {
if (pwrCtrlCoreHk.coulombCounterCharge.value < payloadOpLimitOn) { if (pwrCtrlCoreHk.coulombCounterCharge.value < payloadOpLimitOn) {
PoolReadGuard pg(&enablePl); PoolReadGuard pg(&enablePl);