Skip to content

Commit cc168ca

Browse files
committed
pybricks/common/pb_type_device: Wait for LUMP device to be ready.
It's a good problem to have, but the EV3 now boots faster than its sensors, so we need to make sure they are ready.
1 parent b8f99e4 commit cc168ca

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pybricks/common/pb_type_device.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ lego_device_type_id_t pb_type_device_init_class(pb_type_device_obj_base_t *self,
161161
mp_hal_delay_ms(50);
162162
}
163163
pb_assert(err);
164+
while ((err = pbio_port_lump_is_ready(self->lump_dev)) == PBIO_ERROR_AGAIN) {
165+
mp_hal_delay_ms(50);
166+
}
167+
pb_assert(err);
164168
self->last_awaitable = NULL;
165169
return actual_id;
166170
}

0 commit comments

Comments
 (0)