new LED logic: constant WARNING if VBATT is below 7v

This commit is contained in:
rusefi 2020-05-13 01:17:48 -04:00
parent f233628c2c
commit 257ed04fac
4 changed files with 11 additions and 4 deletions

View File

@ -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);
}

View File

@ -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) {

View File

@ -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);

View File

@ -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;