From 04c081f4aa4015265b1505e6ef5e13306bd3ae48 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 13:52:56 +0200 Subject: [PATCH 1/2] transition --- mission/controller/PowerController.cpp | 7 +++++++ mission/controller/PowerController.h | 1 + 2 files changed, 8 insertions(+) diff --git a/mission/controller/PowerController.cpp b/mission/controller/PowerController.cpp index 7b7db9e8..f31c589f 100644 --- a/mission/controller/PowerController.cpp +++ b/mission/controller/PowerController.cpp @@ -370,3 +370,10 @@ ReturnValue_t PowerController::calculateCoulombCounterChargeUpperThreshold() { lookUpTableOcv[0][lookUpTableIdx + 1]); return returnvalue::OK; } + +void PowerController::startTransition(Mode_t mode, Submode_t submode) { + if (mode == MODE_OFF) { + enablePl.setValidity(false, true); + } + ControllerBase::startTransition(mode, submode); +} diff --git a/mission/controller/PowerController.h b/mission/controller/PowerController.h index 1f27616d..8777fe53 100644 --- a/mission/controller/PowerController.h +++ b/mission/controller/PowerController.h @@ -22,6 +22,7 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) override; + void startTransition(Mode_t mode, Submode_t submode) override; private: bool enableHkSets = false; From f0cafedda7e035aec0b6fc89fca40bdc04a6154d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Oct 2023 14:10:51 +0200 Subject: [PATCH 2/2] this is better --- mission/controller/PowerController.cpp | 18 ++++++------------ mission/controller/PowerController.h | 1 - 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/mission/controller/PowerController.cpp b/mission/controller/PowerController.cpp index f31c589f..2a735782 100644 --- a/mission/controller/PowerController.cpp +++ b/mission/controller/PowerController.cpp @@ -100,15 +100,16 @@ void PowerController::performControlOperation() { return; } case InternalState::READY: { + if (mode != MODE_NORMAL) { + PoolReadGuard pg(&enablePl); + if (pg.getReadResult() == returnvalue::OK) { + enablePl.setValidity(false, true); + } + } if (mode != MODE_OFF) { calculateStateOfCharge(); if (mode == MODE_NORMAL) { watchStateOfCharge(); - } else { - PoolReadGuard pg(&enablePl); - if (pg.getReadResult() == returnvalue::OK) { - enablePl.setValidity(false, true); - } } } break; @@ -370,10 +371,3 @@ ReturnValue_t PowerController::calculateCoulombCounterChargeUpperThreshold() { lookUpTableOcv[0][lookUpTableIdx + 1]); return returnvalue::OK; } - -void PowerController::startTransition(Mode_t mode, Submode_t submode) { - if (mode == MODE_OFF) { - enablePl.setValidity(false, true); - } - ControllerBase::startTransition(mode, submode); -} diff --git a/mission/controller/PowerController.h b/mission/controller/PowerController.h index 8777fe53..1f27616d 100644 --- a/mission/controller/PowerController.h +++ b/mission/controller/PowerController.h @@ -22,7 +22,6 @@ class PowerController : public ExtendedControllerBase, public ReceivesParameterM ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) override; - void startTransition(Mode_t mode, Submode_t submode) override; private: bool enableHkSets = false;