diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 00404e1af8..668fb311e0 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -604,6 +604,9 @@ class CommunicationBlinkingTask : public PeriodicTimerController { void PeriodicTask() override { counter++; + + bool lowVBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) < LOW_VBATT; + if (counter == 1) { // first invocation of BlinkingTask setAllLeds(1); @@ -612,7 +615,9 @@ class CommunicationBlinkingTask : public PeriodicTimerController { setAllLeds(0); } else if (counter % 2 == 0) { enginePins.communicationLedPin.setValue(0); - enginePins.warningLedPin.setValue(0); + if (!lowVBatt) { + enginePins.warningLedPin.setValue(0); + } } else { if (hasFirmwareError()) { // special behavior in case of critical error - not equal on/off time @@ -632,7 +637,7 @@ class CommunicationBlinkingTask : public PeriodicTimerController { enginePins.communicationLedPin.setValue(1); #if EFI_ENGINE_CONTROL - if (isTriggerErrorNow() || isIgnitionTimingError() || consoleByteArrived) { + if (lowVBatt || isTriggerErrorNow() || isIgnitionTimingError() || consoleByteArrived) { consoleByteArrived = false; enginePins.warningLedPin.setValue(1); } diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 1381d0e4fe..a8aa8fb08e 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -740,7 +740,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // see MAIN_RELAY_LOGIC if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) { - enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode()); + enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > LOW_VBATT) || engine->isInShutdownMode()); } // see STARTER_RELAY_LOGIC if (CONFIG(starterRelayDisablePin) != GPIO_UNASSIGNED) { diff --git a/firmware/controllers/sensors/voltage.h b/firmware/controllers/sensors/voltage.h index be1e3859d3..b7b40bf0d2 100644 --- a/firmware/controllers/sensors/voltage.h +++ b/firmware/controllers/sensors/voltage.h @@ -12,6 +12,8 @@ #include "global.h" #include "engine_configuration.h" +#define LOW_VBATT 7 + float getVRef(DECLARE_ENGINE_PARAMETER_SIGNATURE); float getVBatt(DECLARE_ENGINE_PARAMETER_SIGNATURE); bool hasVBatt(DECLARE_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/hw_layer/drivers/gpio/tle8888.c b/firmware/hw_layer/drivers/gpio/tle8888.c index 31b266dba7..a864886461 100644 --- a/firmware/hw_layer/drivers/gpio/tle8888.c +++ b/firmware/hw_layer/drivers/gpio/tle8888.c @@ -627,7 +627,7 @@ static THD_FUNCTION(tle8888_driver_thread, p) { /* should we care about msg == MSG_TIMEOUT? */ (void)msg; - if (vBattForTle8888 < 7) { + if (vBattForTle8888 < LOW_VBATT) { // we assume TLE8888 is down and we should not bother with SPI communication if (!needInitialSpi) { needInitialSpi = true;