File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
shared-bindings/supervisor Expand file tree Collapse file tree 1 file changed +4
-5
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
}
You can’t perform that action at this time.
0 commit comments