We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fda2d14 commit a78a4c9Copy full SHA for a78a4c9
extmod/modpupdevices.c
@@ -370,7 +370,7 @@ STATIC mp_obj_t pupdevices_UltrasonicSensor_distance(mp_obj_t self_in) {
370
pupdevices_UltrasonicSensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
371
int32_t distance;
372
pbdevice_get_values(self->pbdev, PBIO_IODEV_MODE_PUP_ULTRASONIC_SENSOR__DISTL, &distance);
373
- return mp_obj_new_int(distance < 0 ? 3000 : distance);
+ return mp_obj_new_int(distance < 0 || distance >= 2000 ? 2000 : distance);
374
}
375
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pupdevices_UltrasonicSensor_distance_obj, pupdevices_UltrasonicSensor_distance);
376
0 commit comments