Fix led blinking
This commit is contained in:
@@ -95,14 +95,12 @@ bool MySensor::isValidFirmware() {
|
|||||||
|
|
||||||
#ifdef WITH_LEDS_BLINKING
|
#ifdef WITH_LEDS_BLINKING
|
||||||
void MySensor::handleLedsBlinking() {
|
void MySensor::handleLedsBlinking() {
|
||||||
static unsigned long next_time = hw_millis() + ledBlinkPeriod;
|
|
||||||
|
|
||||||
// Just return if it is not the time...
|
// Just return if it is not the time...
|
||||||
// http://playground.arduino.cc/Code/TimingRollover
|
// http://playground.arduino.cc/Code/TimingRollover
|
||||||
if ((long)(hw_millis() - next_time) < 0)
|
if ((long)(hw_millis() - blink_next_time) < 0)
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
next_time = hw_millis() + ledBlinkPeriod;
|
blink_next_time = hw_millis() + ledBlinkPeriod;
|
||||||
|
|
||||||
// do the actual blinking
|
// do the actual blinking
|
||||||
if(countRx && countRx != 255) {
|
if(countRx && countRx != 255) {
|
||||||
|
|||||||
@@ -361,6 +361,7 @@ class MySensor
|
|||||||
|
|
||||||
unsigned long ledBlinkPeriod;
|
unsigned long ledBlinkPeriod;
|
||||||
void handleLedsBlinking(); // do the actual blinking
|
void handleLedsBlinking(); // do the actual blinking
|
||||||
|
unsigned long blink_next_time;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MyTransport& radio;
|
MyTransport& radio;
|
||||||
|
|||||||
Reference in New Issue
Block a user