From 644cba8d55941d05097179c7447b9ad2c638899e Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 23 Mar 2024 15:39:13 -0400 Subject: [PATCH] only: more hellen power management --- .../hellen/hellen-honda-k/board_configuration.cpp | 2 -- firmware/config/boards/hellen/hellen_common.cpp | 12 ++++++++++-- firmware/config/boards/hellen_meta.h | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp b/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp index f907f2f2ce..c90489e8d7 100644 --- a/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen-honda-k/board_configuration.cpp @@ -45,8 +45,6 @@ void onBoardStandBy() { hellenBoardStandBy(); } - - void setBoardConfigOverrides() { setHellenMegaEnPin(); setHellenVbatt(); diff --git a/firmware/config/boards/hellen/hellen_common.cpp b/firmware/config/boards/hellen/hellen_common.cpp index 2c3d3f43ad..e8bc238e87 100644 --- a/firmware/config/boards/hellen/hellen_common.cpp +++ b/firmware/config/boards/hellen/hellen_common.cpp @@ -43,12 +43,20 @@ void setHellen64Can() { static OutputPin megaEn; +void hellenEnableEn() { + megaEn.setValue(1); +} + +void hellenDisableEn() { + megaEn.setValue(0); +} + void setHellenEnPin(Gpio pin) { static bool initialized = false; if (!initialized) { initialized = true; megaEn.initPin("EN", pin); - megaEn.setValue(1); + hellenEnableEn(); } } @@ -63,7 +71,7 @@ void setHellen64MegaEnPin() { void hellenBoardStandBy() { // we need to turn 'megaEn' and pause for a bit to make sure that WBO is off and does not wake main firmware right away - megaEn.setValue(0); + hellenDisableEn(); // todo: 200ms is totally random what's the science for this sleep duration? chThdSleepMilliseconds(200); } diff --git a/firmware/config/boards/hellen_meta.h b/firmware/config/boards/hellen_meta.h index dc129f6c4c..ea6a56476f 100644 --- a/firmware/config/boards/hellen_meta.h +++ b/firmware/config/boards/hellen_meta.h @@ -16,6 +16,9 @@ void hellenWbo(); void setHellenMegaEnPin(); void setHellenEnPin(Gpio pin); void setHellen64MegaEnPin(); +void hellenEnableEn(); +void hellenDisableEn(); + void hellenBoardStandBy(); void hellenMegaAccelerometerPreInitCS2Pin(); void configureHellenCanTerminator();