From 98a1ce5380c8ca45d38a08737275228bd7e3397d Mon Sep 17 00:00:00 2001 From: meggert Date: Tue, 10 Oct 2023 11:53:54 +0200 Subject: [PATCH] this should work --- mission/controller/PowerController.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mission/controller/PowerController.cpp b/mission/controller/PowerController.cpp index c990ee59..b1b94d61 100644 --- a/mission/controller/PowerController.cpp +++ b/mission/controller/PowerController.cpp @@ -44,12 +44,17 @@ ReturnValue_t PowerController::getParameter(uint8_t domainId, uint8_t parameterI break; case 0x2: { float oldCoulombCounterVoltageUpperThreshold = coulombCounterVoltageUpperThreshold; - parameterWrapper->set(coulombCounterVoltageUpperThreshold); - ReturnValue_t result = calculateCoulombCounterChargeUpperThreshold(); + ReturnValue_t result = newValues->getElement(&coulombCounterVoltageUpperThreshold); if (result != returnvalue::OK) { coulombCounterVoltageUpperThreshold = oldCoulombCounterVoltageUpperThreshold; - return returnvalue::FAILED; + return result; } + result = calculateCoulombCounterChargeUpperThreshold(); + if (result != returnvalue::OK) { + coulombCounterVoltageUpperThreshold = oldCoulombCounterVoltageUpperThreshold; + return result; + } + // parameterWrapper->set(coulombCounterVoltageUpperThreshold); break; } case 0x3: @@ -230,6 +235,11 @@ void PowerController::calculateStateOfCharge() { } void PowerController::watchStateOfCharge() { + if (test < 100) { + test++; + } else if (test == 100) { + // pwrCtrlCoreHk.coulombCounterCharge.value = 0.7; + } if (pwrCtrlCoreHk.coulombCounterCharge.isValid()) { if (pwrCtrlCoreHk.coulombCounterCharge.value < payloadOpLimitOn) { PoolReadGuard pg(&enablePl);