Skip to content

Commit a6d53fe

Browse files
committed
pybricks.iodevices.PUPDevice: Fix type assertion.
Any LUMP device is allowed here. Fixes this class raising ENODEV since recent port changes.
1 parent 75bb664 commit a6d53fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pybricks/iodevices/pb_type_iodevices_pupdevice.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static mp_obj_t iodevices_PUPDevice_info(mp_obj_t self_in) {
9595
pbio_port_lump_mode_info_t *mode_info;
9696
uint8_t current_mode;
9797
uint8_t num_modes;
98-
lego_device_type_id_t type_id;
98+
lego_device_type_id_t type_id = LEGO_DEVICE_TYPE_ID_ANY_LUMP_UART;
9999
pb_assert(pbio_port_lump_assert_type_id(self->device_base.lump_dev, &type_id));
100100
pb_assert(pbio_port_lump_get_info(self->device_base.lump_dev, &num_modes, &current_mode, &mode_info));
101101

@@ -127,7 +127,7 @@ static mp_obj_t get_pup_data_tuple(mp_obj_t self_in) {
127127
pbio_port_lump_mode_info_t *mode_info;
128128
uint8_t current_mode;
129129
uint8_t num_modes;
130-
lego_device_type_id_t type_id;
130+
lego_device_type_id_t type_id = LEGO_DEVICE_TYPE_ID_ANY_LUMP_UART;
131131
pb_assert(pbio_port_lump_assert_type_id(self->device_base.lump_dev, &type_id));
132132
pb_assert(pbio_port_lump_get_info(self->device_base.lump_dev, &num_modes, &current_mode, &mode_info));
133133

@@ -203,7 +203,7 @@ static mp_obj_t iodevices_PUPDevice_write(size_t n_args, const mp_obj_t *pos_arg
203203
pbio_port_lump_mode_info_t *mode_info;
204204
uint8_t current_mode;
205205
uint8_t num_modes;
206-
lego_device_type_id_t type_id;
206+
lego_device_type_id_t type_id = LEGO_DEVICE_TYPE_ID_ANY_LUMP_UART;
207207
pb_assert(pbio_port_lump_assert_type_id(self->device_base.lump_dev, &type_id));
208208
pb_assert(pbio_port_lump_get_info(self->device_base.lump_dev, &num_modes, &current_mode, &mode_info));
209209

0 commit comments

Comments
 (0)