Skip to content

Commit 7a6dbaa

Browse files
committed
stmhal: Make LED object print LED(x) for consistency with constructor.
1 parent b1bbe96 commit 7a6dbaa

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

stmhal/led.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void led_debug(int n, int delay) {
212212

213213
void led_obj_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
214214
pyb_led_obj_t *self = self_in;
215-
print(env, "<LED %lu>", self->led_id);
215+
print(env, "LED(%lu)", self->led_id);
216216
}
217217

218218
/// \classmethod \constructor(id)
@@ -228,7 +228,7 @@ STATIC mp_obj_t led_obj_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n
228228

229229
// check led number
230230
if (!(1 <= led_id && led_id <= NUM_LEDS)) {
231-
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "LED %d does not exist", led_id));
231+
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "LED(%d) does not exist", led_id));
232232
}
233233

234234
// return static led object

tests/pyb/led.py.exp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<LED 1>
2-
<LED 2>
3-
<LED 3>
4-
<LED 4>
1+
LED(1)
2+
LED(2)
3+
LED(3)
4+
LED(4)

0 commit comments

Comments
 (0)