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