Dim LED ring, add blink mode, and signal OTA outcome on the ring.
Default brightness is ~5%; UART blink mode and green/red pulses mark OTA success or failure. Failed UART uploads skip ESP-NOW distribution. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+24
-1
@@ -1,10 +1,17 @@
|
||||
#ifndef LED_RING_H
|
||||
#define LED_RING_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** Default RGB scale (~5 % of full brightness). */
|
||||
#define LED_RING_DEFAULT_INTENSITY 13
|
||||
|
||||
typedef enum {
|
||||
LED_CMD_CLEAR,
|
||||
LED_CMD_SET_DIGIT,
|
||||
LED_CMD_SET_COLOR,
|
||||
LED_CMD_PROGRESS
|
||||
LED_CMD_PROGRESS,
|
||||
LED_CMD_BLINK
|
||||
} led_mode_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -13,7 +20,23 @@ typedef struct {
|
||||
uint8_t r, g, b;
|
||||
uint8_t intensity;
|
||||
uint8_t progress;
|
||||
uint16_t blink_ms;
|
||||
uint8_t blink_count;
|
||||
} led_command_t;
|
||||
|
||||
void led_ring_send_command(led_command_t *cmd);
|
||||
void led_ring_init(void);
|
||||
|
||||
void led_ring_scale_rgb(uint8_t *r, uint8_t *g, uint8_t *b, uint8_t intensity);
|
||||
|
||||
/** OTA feedback: ring fill 0–100 % with RGB. */
|
||||
void led_ring_show_ota_progress(uint32_t bytes_done, uint32_t total_bytes,
|
||||
uint8_t r, uint8_t g, uint8_t b);
|
||||
void led_ring_show_ota_clear(void);
|
||||
|
||||
/** Single pulse on the full ring (blocking in LED task). */
|
||||
void led_ring_blink_once(uint8_t r, uint8_t g, uint8_t b);
|
||||
void led_ring_ota_success(void);
|
||||
void led_ring_ota_failed(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user