Skip to content

Commit d6cc1b4

Browse files
author
Yveaux
committed
Fix led blinking
1 parent 0bb5e22 commit d6cc1b4

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

libraries/MySensors/MySensor.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,12 @@ bool MySensor::isValidFirmware() {
9595

9696
#ifdef WITH_LEDS_BLINKING
9797
void MySensor::handleLedsBlinking() {
98-
static unsigned long next_time = hw_millis() + ledBlinkPeriod;
99-
10098
// Just return if it is not the time...
10199
// http://playground.arduino.cc/Code/TimingRollover
102-
if ((long)(hw_millis() - next_time) < 0)
100+
if ((long)(hw_millis() - blink_next_time) < 0)
103101
return;
104102
else
105-
next_time = hw_millis() + ledBlinkPeriod;
103+
blink_next_time = hw_millis() + ledBlinkPeriod;
106104

107105
// do the actual blinking
108106
if(countRx && countRx != 255) {

libraries/MySensors/MySensor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ class MySensor
361361

362362
unsigned long ledBlinkPeriod;
363363
void handleLedsBlinking(); // do the actual blinking
364+
unsigned long blink_next_time;
364365
#endif
365366

366367
MyTransport& radio;

0 commit comments

Comments
 (0)