Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/LedTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ void LedTask::updateBlinkLed(void) {
// check to see if it's time to change the state of the LED
unsigned long current_millis = millis();

if ((led_state == HIGH) && (current_millis - previous_millis >= on_time)) {
if ((led_state == HIGH) && (off_time > 0) &&
(current_millis - previous_millis >= on_time)) {
led_state = LOW; // Turn it off
previous_millis = current_millis; // Remember the time
digitalWrite(led_pin, led_state); // Update the actual LED
} else if ((led_state == LOW) &&
} else if ((led_state == LOW) && (on_time > 0) &&
(current_millis - previous_millis >= off_time)) {
led_state = HIGH; // Turn it on
previous_millis = current_millis; // Remember the time
Expand Down Expand Up @@ -214,4 +215,4 @@ void LedTask::pulseLedBlk(uint8_t pulse_cnt, uint32_t ms_on_tm,

*/
/**************************************************************************/
uint16_t LedTask::getInstanceCount(void) { return instance_count; }
uint16_t LedTask::getInstanceCount(void) { return instance_count; }