warning LED is for warnings only, communications have to reflected by COMMS LED

This commit is contained in:
rusefi 2020-06-13 13:23:34 -04:00
parent 7165b43030
commit 152fa17990
2 changed files with 14 additions and 11 deletions

View File

@ -340,8 +340,6 @@ static void initStatusLeds(void) {
enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync)); enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync));
} }
#define BLINKING_PERIOD_MS 33
#if EFI_PROD_CODE #if EFI_PROD_CODE
static bool isTriggerErrorNow() { static bool isTriggerErrorNow() {
@ -391,20 +389,25 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
enginePins.warningLedPin.setValue(0); enginePins.warningLedPin.setValue(0);
} }
} else { } else {
#define BLINKING_PERIOD_MS 33
if (hasFirmwareError()) { if (hasFirmwareError()) {
// special behavior in case of critical error - not equal on/off time // special behavior in case of critical error - not equal on/off time
// this special behaviour helps to notice that something is not right, also // this special behaviour helps to notice that something is not right, also
// differentiates software firmware error from critical interrupt error with CPU halt. // differentiates software firmware error from critical interrupt error with CPU halt.
offTimeMs = 50; offTimeMs = 50;
onTimeMs = 450; onTimeMs = 450;
} else if (consoleByteArrived) {
consoleByteArrived = false;
offTimeMs = 100;
onTimeMs = 33;
#if EFI_INTERNAL_FLASH
} else if (getNeedToWriteConfiguration()) {
offTimeMs = onTimeMs = 500;
#endif // EFI_INTERNAL_FLASH
} else { } else {
onTimeMs = is_usb_serial_ready() ? 3 * BLINKING_PERIOD_MS : BLINKING_PERIOD_MS; onTimeMs = is_usb_serial_ready() ? 3 * BLINKING_PERIOD_MS : BLINKING_PERIOD_MS;
#if EFI_INTERNAL_FLASH offTimeMs = 0.6 * onTimeMs;
if (getNeedToWriteConfiguration()) {
onTimeMs = 2 * onTimeMs;
}
#endif
offTimeMs = onTimeMs;
} }
enginePins.communicationLedPin.setValue(1); enginePins.communicationLedPin.setValue(1);
@ -415,8 +418,8 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
#endif // HW_CHECK_MODE #endif // HW_CHECK_MODE
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
if (lowVBatt || isTriggerErrorNow() || isIgnitionTimingError() || consoleByteArrived) { if (lowVBatt || isTriggerErrorNow() || isIgnitionTimingError()) {
consoleByteArrived = false; // todo: at the moment warning codes do not affect warning LED?!
enginePins.warningLedPin.setValue(1); enginePins.warningLedPin.setValue(1);
} }
#endif /* EFI_ENGINE_CONTROL */ #endif /* EFI_ENGINE_CONTROL */

View File

@ -717,6 +717,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0) if (initBootloader() != 0)
return 123; return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */ #endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20200604; return 20200613;
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */