Added LED_ONCE to led handler
This commit is contained in:
parent
542ee83c04
commit
e03ea33bcd
|
@ -43,6 +43,15 @@ static void blink_on_board_led_cb(void *arg) {
|
||||||
// toggle LED each tick
|
// toggle LED each tick
|
||||||
mgos_gpio_toggle(ON_BOARD_LED);
|
mgos_gpio_toggle(ON_BOARD_LED);
|
||||||
break;
|
break;
|
||||||
|
case LED_ONCE:
|
||||||
|
++numTicksLedHasThisState;
|
||||||
|
if (numTicksLedHasThisState == 1) {
|
||||||
|
mgos_gpio_write(ON_BOARD_LED, 0); // on
|
||||||
|
} else
|
||||||
|
if (numTicksLedHasThisState > 8) {
|
||||||
|
set_led_status(LED_OFF);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(LL_ERROR, ("Invalid current LED status: %d -- ignored", currentStatus));
|
LOG(LL_ERROR, ("Invalid current LED status: %d -- ignored", currentStatus));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10,7 +10,8 @@ enum LEDStatus {
|
||||||
LED_OFF = 0, // permanently off
|
LED_OFF = 0, // permanently off
|
||||||
LED_ON = 1, // permanently on
|
LED_ON = 1, // permanently on
|
||||||
LED_BLINK_SLOW = 2, // on 0,5x / second (1s on, 1s off)
|
LED_BLINK_SLOW = 2, // on 0,5x / second (1s on, 1s off)
|
||||||
LED_BLINK_FAST = 3 // on 2x / second (250ms on, 250ms off)
|
LED_BLINK_FAST = 3, // on 2x / second (250ms on, 250ms off)
|
||||||
|
LED_ONCE = 4 // on for 2 seconds, then off again
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void set_led_status(enum LEDStatus newStatus);
|
extern void set_led_status(enum LEDStatus newStatus);
|
||||||
|
|
Loading…
Reference in New Issue