fix(rgbled): double-buffer WS2812 strip to eliminate races (#7304)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
462b0351ef
commit
ac4c4d7b6b
@@ -27,7 +27,6 @@
|
||||
#include "edgetx.h"
|
||||
#include "mainwindow.h"
|
||||
#include "static.h"
|
||||
#include "stm32_ws2812.h"
|
||||
#include "LvglWrapper.h"
|
||||
|
||||
#define __BATTERY_DRIVER_C__
|
||||
@@ -603,8 +602,8 @@ void setLedGroupColor(uint8_t index, uint8_t color, uint8_t brightness) {
|
||||
scaled_b = brightness;
|
||||
}
|
||||
|
||||
ws2812_set_color(rgbMapping[index], scaled_r, scaled_g, scaled_b);
|
||||
ws2812_set_color(rgbMapping[index] + 1, scaled_r, scaled_g, scaled_b);
|
||||
rgbSetLedColor(rgbMapping[index], scaled_r, scaled_g, scaled_b);
|
||||
rgbSetLedColor(rgbMapping[index] + 1, scaled_r, scaled_g, scaled_b);
|
||||
}
|
||||
|
||||
uint8_t ledBreathBright(float angle, uint8_t maxBright) {
|
||||
@@ -655,11 +654,10 @@ void ledLoop(void) {
|
||||
ledBreathUpdate(led_info.led_state, led_info.led_color, led_info.led_group);
|
||||
}
|
||||
|
||||
extern const stm32_pulse_timer_t _led_timer;
|
||||
static uint8_t _led_charge_colors[WS2812_BYTES_PER_LED * LED_STRIP_LENGTH];
|
||||
void rgbChargeInit(void) {
|
||||
ws2812_init(&_led_timer, _led_charge_colors, LED_STRIP_LENGTH, WS2812_GRB);
|
||||
rgbLedClearAll();
|
||||
// Bring up the WS2812 strip without starting the periodic refresh timer
|
||||
// (the FreeRTOS scheduler isn't running yet during the charging UI).
|
||||
rgbLedHwInit();
|
||||
}
|
||||
|
||||
constexpr uint16_t vbatLedTable[] = {650, 720, 760, 800, 823 };
|
||||
|
||||
Reference in New Issue
Block a user