implement suggested change
pass brightness value directly Co-authored-by: Dan Halbert <halbert@halwitz.org>
This commit is contained in:
parent
17ed2a6898
commit
4fd15acf77
@ -201,9 +201,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_rgb_status_brightness_obj, supe
|
|||||||
STATIC mp_obj_t supervisor_runtime_set_rgb_status_brightness(mp_obj_t self, mp_obj_t lvl) {
|
STATIC mp_obj_t supervisor_runtime_set_rgb_status_brightness(mp_obj_t self, mp_obj_t lvl) {
|
||||||
#if CIRCUITPY_STATUS_LED
|
#if CIRCUITPY_STATUS_LED
|
||||||
// This must be int. If cast to uint8_t first, will never raise a ValueError.
|
// This must be int. If cast to uint8_t first, will never raise a ValueError.
|
||||||
int brightness_int = mp_obj_get_int(lvl);
|
set_status_brightness((uint8_t)mp_arg_validate_int_range(mp_obj_get_int(lvl), 0, 255, MP_QSTR_brightness));
|
||||||
mp_arg_validate_int_range(brightness_int, 0, 255, MP_QSTR_brightness);
|
|
||||||
set_status_brightness((uint8_t)brightness_int);
|
|
||||||
#else
|
#else
|
||||||
mp_raise_NotImplementedError(NULL);
|
mp_raise_NotImplementedError(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user