Don't update status LED color on brightness change

Brightness changes now happen when the LED isn't active or
initialized. When not init, CP may crash.

Fixes #5872
This commit is contained in:
Scott Shawcroft 2022-02-17 14:21:03 -08:00
parent fe6e03f504
commit bdee6cf3b6
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 3 additions and 6 deletions

View File

@ -324,12 +324,9 @@ uint32_t color_brightness(uint32_t color, uint8_t brightness) {
void set_status_brightness(uint8_t level) {
#if CIRCUITPY_STATUS_LED
rgb_status_brightness = level;
uint32_t current_color = current_status_color;
// Temporarily change the current color global to force the new_status_color call to update the
// LED. Usually duplicate calls of the same color are ignored without regard to brightness
// changes.
current_status_color = 0;
new_status_color(current_color);
// This is only called by user code and we're never controlling the status
// LED when user code is running. So, we don't need to update the current
// state (there is none.)
#endif
}