Skip to content

Commit ceeaae1

Browse files
committed
companion: ui: Respect LED_STATE_ON for status LED
The current logic only works for active high LEDs. Some boards need an active low level control and therefore they set LED_STATE_ON to 0. Take this into account and use the correct LED pattern for both cases. Signed-off-by: Frieder Schrempf <[email protected]>
1 parent 92af202 commit ceeaae1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/companion_radio/ui-new/UITask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ void UITask::userLedHandler() {
618618
led_state = 0;
619619
next_led_change = cur_time + LED_CYCLE_MILLIS - last_led_increment;
620620
}
621-
digitalWrite(PIN_STATUS_LED, led_state);
621+
digitalWrite(PIN_STATUS_LED, led_state == LED_STATE_ON);
622622
}
623623
#endif
624624
}

examples/companion_radio/ui-orig/UITask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void UITask::userLedHandler() {
269269
state = 0;
270270
next_change = cur_time + LED_CYCLE_MILLIS - last_increment;
271271
}
272-
digitalWrite(PIN_STATUS_LED, state);
272+
digitalWrite(PIN_STATUS_LED, state == LED_STATE_ON);
273273
}
274274
#endif
275275
}

0 commit comments

Comments
 (0)