File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed
shared-bindings/supervisor Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -76,16 +76,15 @@ STATIC mp_obj_t supervisor_disable_autoreload(void) {
76
76
MP_DEFINE_CONST_FUN_OBJ_0 (supervisor_disable_autoreload_obj , supervisor_disable_autoreload );
77
77
78
78
//| def set_rgb_status_brightness(brightness: int) -> None:
79
- //| """Set brightness of status neopixel from 0-255
80
- //| `set_rgb_status_brightness` is called."""
79
+ //| """Set brightness of status RGB LED from 0-255. This will take effect
80
+ //| after the current code finishes and the status LED is used to show
81
+ //| the finish state."""
81
82
//| ...
82
83
//|
83
84
STATIC mp_obj_t supervisor_set_rgb_status_brightness (mp_obj_t lvl ) {
84
85
// This must be int. If cast to uint8_t first, will never raise a ValueError.
85
86
int brightness_int = mp_obj_get_int (lvl );
86
- if (brightness_int < 0 || brightness_int > 255 ) {
87
- mp_raise_ValueError (translate ("Brightness must be between 0 and 255" ));
88
- }
87
+ mp_arg_validate_int_range (brightness_int , 0 , 255 , MP_QSTR_brightness );
89
88
set_status_brightness ((uint8_t )brightness_int );
90
89
return mp_const_none ;
91
90
}
Original file line number Diff line number Diff line change @@ -324,12 +324,9 @@ uint32_t color_brightness(uint32_t color, uint8_t brightness) {
324
324
void set_status_brightness (uint8_t level ) {
325
325
#if CIRCUITPY_STATUS_LED
326
326
rgb_status_brightness = level ;
327
- uint32_t current_color = current_status_color ;
328
- // Temporarily change the current color global to force the new_status_color call to update the
329
- // LED. Usually duplicate calls of the same color are ignored without regard to brightness
330
- // changes.
331
- current_status_color = 0 ;
332
- new_status_color (current_color );
327
+ // This is only called by user code and we're never controlling the status
328
+ // LED when user code is running. So, we don't need to update the current
329
+ // state (there is none.)
333
330
#endif
334
331
}
335
332
You can’t perform that action at this time.
0 commit comments