Browse Source

Fixing crash when voltage was measured when no battery was plugged in

master
Torsten Stauder 4 years ago
parent
commit
993b8d7ebf
  1. 3
      src/Led.cpp
  2. 2
      src/revision.h

3
src/Led.cpp

@ -348,6 +348,9 @@ static void Led_Task(void *parameter) {
FastLED.show(); FastLED.show();
} else { } else {
uint8_t numLedsToLight = ((float)vDiffCurrent / vDiffIndicatorRange) * NUM_LEDS; 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++) { for (uint8_t led = 0; led < numLedsToLight; led++) {
if (((float)numLedsToLight / NUM_LEDS) >= 0.6) { if (((float)numLedsToLight / NUM_LEDS) >= 0.6) {
leds[Led_Address(led)] = CRGB::Green; leds[Led_Address(led)] = CRGB::Green;

2
src/revision.h

@ -1,4 +1,4 @@
#ifndef __REVISION_H__ #ifndef __REVISION_H__
#define __REVISION_H__ #define __REVISION_H__
constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211028-1";
constexpr const char softwareRevision[] PROGMEM = "Software-revision: 20211031-1";
#endif #endif
Loading…
Cancel
Save