diff --git a/Software/ChainLube/src/main.cpp b/Software/ChainLube/src/main.cpp index a5ee19e..290deed 100644 --- a/Software/ChainLube/src/main.cpp +++ b/Software/ChainLube/src/main.cpp @@ -253,7 +253,8 @@ void LED_Process(tSystem_Status newSysStatus) uint8_t color = 0; uint32_t timer = 0; - uint32_t timestamp = 0; + static uint32_t timestamp = 0; + timer = millis(); if (oldSysStatus != newSysStatus) { @@ -261,20 +262,25 @@ void LED_Process(tSystem_Status newSysStatus) { case sysStat_Startup: LED_Status = LED_Startup; + debugA("sysStat: Startup"); break; case sysStat_Normal: - timestamp = millis() + 1500; + timestamp = timer + 3500; LED_Status = LED_Confirm_Normal; + debugA("sysStat: Normal"); break; case sysStat_Rain: - timestamp = millis() + 1500; + timestamp = timer + 3500; LED_Status = LED_Confirm_Rain; + debugA("sysStat: Rain"); break; case sysStat_Purge: LED_Status = LED_Purge; + debugA("sysStat: Purge"); break; case sysStat_Error: LED_Status = LED_Error; + debugA("sysStat: Error"); break; case sysStat_NOP: default: @@ -283,8 +289,6 @@ void LED_Process(tSystem_Status newSysStatus) oldSysStatus = newSysStatus; } - timer = millis(); - switch (LED_Status) { case LED_Startup: @@ -296,11 +300,12 @@ void LED_Process(tSystem_Status newSysStatus) case LED_Confirm_Normal: FastLED.setBrightness(255); - leds[0] = timer % 500 > 250 ? CRGB(0, 255, 0) : CRGB(0, 4, 0); + leds[0] = timer % 250 > 125 ? CRGB(0, 255, 0) : CRGB(0, 4, 0); if (timestamp < timer) { LED_Status = LED_Normal; FastLED.setBrightness(64); + debugA("LED_Status: Confirm -> Normal"); } break; @@ -310,11 +315,12 @@ void LED_Process(tSystem_Status newSysStatus) case LED_Confirm_Rain: FastLED.setBrightness(255); - leds[0] = timer % 500 > 250 ? CRGB(0, 0, 255) : CRGB(0, 0, 4); + leds[0] = timer % 250 > 125 ? CRGB(0, 0, 255) : CRGB(0, 0, 4); if (timestamp < timer) { LED_Status = LED_Rain; FastLED.setBrightness(64); + debugA("LED_Status: Confirm -> Rain"); } break;