diff --git a/src/Led.cpp b/src/Led.cpp index cecf8ef..299f733 100644 --- a/src/Led.cpp +++ b/src/Led.cpp @@ -348,6 +348,9 @@ static void Led_Task(void *parameter) { FastLED.show(); } else { uint8_t numLedsToLight = ((float)vDiffCurrent / vDiffIndicatorRange) * NUM_LEDS; + if (numLedsToLight > NUM_LEDS) { // Can happen e.g. if no battery is connected + numLedsToLight = NUM_LEDS; + } for (uint8_t led = 0; led < numLedsToLight; led++) { if (((float)numLedsToLight / NUM_LEDS) >= 0.6) { leds[Led_Address(led)] = CRGB::Green; diff --git a/src/revision.h b/src/revision.h index 2feea33..fd671da 100644 --- a/src/revision.h +++ b/src/revision.h @@ -1,4 +1,4 @@ #ifndef __REVISION_H__ #define __REVISION_H__ - constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211028-1"; + constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211031-1"; #endif \ No newline at end of file