Add UART LED_RING command for progress bar, digits, and clear.

Stop the main-loop digit demo so host-driven display persists; expose
clear/progress/digit modes with RGB and intensity via protobuf and goTool.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-19 21:18:18 +02:00
co-authored by Cursor
parent a0f4a81a55
commit 508b684fdf
16 changed files with 649 additions and 66 deletions
+11 -2
View File
@@ -67,10 +67,11 @@ void vTaskLedRing(void *pvParameters) {
led_command_t cmd;
while (1) {
if (xQueueReceive(led_queue, &cmd, portMAX_DELAY)) {
// Clear all LEDS
led_strip_clear(led_ring);
if (cmd.mode == LED_CMD_SET_DIGIT && cmd.value <= 10) {
if (cmd.mode == LED_CMD_CLEAR) {
/* ring already cleared */
} else if (cmd.mode == LED_CMD_SET_DIGIT && cmd.value <= 10) {
digit_definition_t digit = digit_lookup[cmd.value];
for (int i = 0; i < digit.count; i++) {
@@ -78,6 +79,14 @@ void vTaskLedRing(void *pvParameters) {
led_strip_set_pixel(led_ring, RING_LEDS - digit.leds[i], cmd.r, cmd.g,
cmd.b);
}
} else if (cmd.mode == LED_CMD_PROGRESS) {
uint32_t lit = ((uint32_t)cmd.progress * RING_LEDS + 50) / 100;
if (lit > RING_LEDS) {
lit = RING_LEDS;
}
for (uint32_t i = 0; i < lit; i++) {
led_strip_set_pixel(led_ring, i, cmd.r, cmd.g, cmd.b);
}
}
led_strip_refresh(led_ring);
}