only: board on/off const char *msg

This commit is contained in:
rusefi 2024-04-23 16:42:47 -04:00
parent 3e0fde22d2
commit eff8589b0a
3 changed files with 11 additions and 9 deletions

View File

@ -63,12 +63,14 @@ static bool hellenEnPinInitialized = false;
return !getHellenBoardEnabled(); return !getHellenBoardEnabled();
} }
void hellenEnableEn() { void hellenEnableEn(const char *msg) {
megaEn.setValue(1); efiPrintf("Turning board ON [%s]", msg);
megaEn.setValue(1, /*isForce*/ true);
} }
void hellenDisableEn() { void hellenDisableEn(const char *msg) {
megaEn.setValue(0); efiPrintf("Turning board off [%s]", msg);
megaEn.setValue(0, /*isForce*/ true);
} }
void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp) { void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp) {
@ -76,7 +78,7 @@ void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp) {
hellenEnPinInitialized = true; hellenEnPinInitialized = true;
megaEn.initPin("EN", pin); megaEn.initPin("EN", pin);
if (enableBoardOnStartUp) { if (enableBoardOnStartUp) {
hellenEnableEn(); hellenEnableEn("start-up");
} }
} }
} }

View File

@ -18,8 +18,8 @@ void setHellenEnPin(Gpio pin, bool enableBoardOnStartUp = true);
void setHellen64MegaEnPin(); void setHellen64MegaEnPin();
bool isBoardWithPowerManagement(); bool isBoardWithPowerManagement();
bool getHellenBoardEnabled(); bool getHellenBoardEnabled();
void hellenEnableEn(); void hellenEnableEn(const char *msg = "");
void hellenDisableEn(); void hellenDisableEn(const char *msg = "");
void hellenBoardStandBy(); void hellenBoardStandBy();
void hellenMegaAccelerometerPreInitCS2Pin(); void hellenMegaAccelerometerPreInitCS2Pin();

View File

@ -1103,11 +1103,11 @@ void configureRusefiLuaHooks(lua_State* lState) {
#if EFI_PROD_CODE && HW_HELLEN #if EFI_PROD_CODE && HW_HELLEN
lua_register(lState, "hellenEnablePower", [](lua_State*) { lua_register(lState, "hellenEnablePower", [](lua_State*) {
hellenEnableEn(); hellenEnableEn("Lua");
return 0; return 0;
}); });
lua_register(lState, "hellenDisablePower", [](lua_State*) { lua_register(lState, "hellenDisablePower", [](lua_State*) {
hellenDisableEn(); hellenDisableEn("Lua");
return 0; return 0;
}); });
#endif // HW_HELLEN #endif // HW_HELLEN