Skip to content

Commit e629d3e

Browse files
committed
pybricks.pupdevices.Motor: Wait for UART sync.
This is consistent with behavior before the port code revision. Translating it was missed.
1 parent a6d53fe commit e629d3e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pybricks/common/pb_type_motor.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ static mp_obj_t pb_type_Motor_make_new(const mp_obj_type_t *type, size_t n_args,
119119

120120
// Get and initialize servo
121121
type_id = LEGO_DEVICE_TYPE_ID_ANY_ENCODED_MOTOR;
122-
pb_assert(pbio_port_get_servo(port, &type_id, &self->srv));
122+
pbio_error_t err;
123+
while ((err = pbio_port_get_servo(port, &type_id, &self->srv)) == PBIO_ERROR_AGAIN) {
124+
mp_hal_delay_ms(1);
125+
}
126+
pb_assert(err);
123127
self->dcmotor = self->srv->dcmotor;
124128

125129
bool reset_angle = mp_obj_is_true(reset_angle_in);

0 commit comments

Comments
 (0)