Skip to content

Commit

Permalink
pybricks.common.charger: change return value of connected()
Browse files Browse the repository at this point in the history
Change return value of `connected()` property from `bool` to `int` using the value of `pbdrv_usb_get_bcd()`. This will allow pro users to be able to tell if they have a "nonstandard" charger that could prevent proper charging.
  • Loading branch information
dlech authored Nov 16, 2024
1 parent 4d457a1 commit b3fe921
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pybricks/common/pb_type_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static mp_obj_t Charger_status(mp_obj_t self_in) {
static MP_DEFINE_CONST_FUN_OBJ_1(Charger_status_obj, Charger_status);

static mp_obj_t Charger_connected(mp_obj_t self_in) {
return mp_obj_new_bool(pbdrv_usb_get_bcd() != PBDRV_USB_BCD_NONE);
return mp_obj_new_int(pbdrv_usb_get_bcd());
}
static MP_DEFINE_CONST_FUN_OBJ_1(Charger_connected_obj, Charger_connected);

Expand Down

0 comments on commit b3fe921

Please sign in to comment.