diff --git a/firmware/controllers/alternatorController.cpp b/firmware/controllers/alternatorController.cpp index d45b851a71..263cc3f126 100644 --- a/firmware/controllers/alternatorController.cpp +++ b/firmware/controllers/alternatorController.cpp @@ -53,10 +53,20 @@ static void applySettings(void) { altPid.updateFactors(engineConfiguration->alternatorControlPFactor, 0, 0); } +static void showAltInfo(void) { + scheduleMsg(logger, "alt=%s @ %s", boolToString(engineConfiguration->isAlternatorControlEnabled), + hwPortname(boardConfiguration->alternatorControlPin)); + scheduleMsg(logger, "p=%f/i=%f/d=%f", engineConfiguration->alternatorControlPFactor, + 0, 0); // todo: i & d + scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty, + boardConfiguration->targetVBatt); +} + static void setAltPFactor(float p) { engineConfiguration->alternatorControlPFactor = p; scheduleMsg(logger, "setAltPid: %f", p); applySettings(); + showAltInfo(); } static void applyAlternatorPinState(PwmConfig *state, int stateIndex) { @@ -68,15 +78,6 @@ static void applyAlternatorPinState(PwmConfig *state, int stateIndex) { output->setValue(value); } -static void showAltInfo(void) { - scheduleMsg(logger, "alt=%s @ %s", boolToString(engineConfiguration->isAlternatorControlEnabled), - hwPortname(boardConfiguration->alternatorControlPin)); - scheduleMsg(logger, "p=%f/i=%f/d=%f", engineConfiguration->alternatorControlPFactor, - 0, 0); // todo: i & d - scheduleMsg(logger, "vbatt=%f/duty=%f/target=%f", getVBatt(engineConfiguration), currentAltDuty, - boardConfiguration->targetVBatt); -} - void initAlternatorCtrl(Logging *sharedLogger) { logger = sharedLogger; if (boardConfiguration->alternatorControlPin == GPIO_UNASSIGNED)