diff --git a/src/ledHandler.c b/src/ledHandler.c index 5793609..53220d6 100644 --- a/src/ledHandler.c +++ b/src/ledHandler.c @@ -43,6 +43,15 @@ static void blink_on_board_led_cb(void *arg) { // toggle LED each tick mgos_gpio_toggle(ON_BOARD_LED); 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: LOG(LL_ERROR, ("Invalid current LED status: %d -- ignored", currentStatus)); break; diff --git a/src/ledHandler.h b/src/ledHandler.h index e9bdcd0..1cbbb54 100644 --- a/src/ledHandler.h +++ b/src/ledHandler.h @@ -10,7 +10,8 @@ enum LEDStatus { LED_OFF = 0, // permanently off LED_ON = 1, // permanently on 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);