Skip to content

Commit 7f3f4e4

Browse files
committed
Update set_rgb_status_brightness doc and arg check
1 parent bdee6cf commit 7f3f4e4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

shared-bindings/supervisor/__init__.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,15 @@ STATIC mp_obj_t supervisor_disable_autoreload(void) {
7676
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_autoreload_obj, supervisor_disable_autoreload);
7777

7878
//| 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."""
8182
//| ...
8283
//|
8384
STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl) {
8485
// This must be int. If cast to uint8_t first, will never raise a ValueError.
8586
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);
8988
set_status_brightness((uint8_t)brightness_int);
9089
return mp_const_none;
9190
}

0 commit comments

Comments
 (0)