implement suggested change

pass brightness value directly

Co-authored-by: Dan Halbert <halbert@halwitz.org>
This commit is contained in:
MicroDev 2022-10-04 08:28:48 +05:30 committed by GitHub
parent 17ed2a6898
commit 4fd15acf77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {
#if CIRCUITPY_STATUS_LED
// This must be int. If cast to uint8_t first, will never raise a ValueError.
int brightness_int = mp_obj_get_int(lvl);
mp_arg_validate_int_range(brightness_int, 0, 255, MP_QSTR_brightness);
set_status_brightness((uint8_t)brightness_int);
set_status_brightness((uint8_t)mp_arg_validate_int_range(mp_obj_get_int(lvl), 0, 255, MP_QSTR_brightness));
#else
mp_raise_NotImplementedError(NULL);
#endif