From fccd9b59a31166d2d757a932d1b587c3f2c8bae9 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Sat, 12 Dec 2020 14:42:35 +0100 Subject: [PATCH] pybricks.pupdevices.ColorSensor: remove power hack Sensors that require power are now automatically powered when plugged in, so we no longer need this hack at the module level. This also lets us remove the hardcoded delay so scripts with this sensor start more quickly. --- pybricks/pupdevices/pb_type_pupdevices_colorsensor.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pybricks/pupdevices/pb_type_pupdevices_colorsensor.c b/pybricks/pupdevices/pb_type_pupdevices_colorsensor.c index b6de8d528..cd91f4dbc 100644 --- a/pybricks/pupdevices/pb_type_pupdevices_colorsensor.c +++ b/pybricks/pupdevices/pb_type_pupdevices_colorsensor.c @@ -73,9 +73,6 @@ STATIC mp_obj_t pupdevices_ColorSensor_make_new(const mp_obj_type_t *type, size_ // Get iodevices self->pbdev = pb_device_get_device(port, PBIO_IODEV_TYPE_ID_SPIKE_COLOR_SENSOR); - // This sensor requires power, which iodevice does not do automatically yet - pb_device_set_power_supply(self->pbdev, 100); - // Create an instance of the LightArray class self->lights = common_LightArray_obj_make_new(self->pbdev, PBIO_IODEV_MODE_PUP_COLOR_SENSOR__LIGHT, 3); @@ -86,9 +83,6 @@ STATIC mp_obj_t pupdevices_ColorSensor_make_new(const mp_obj_type_t *type, size_ // Save default settings pb_color_map_save_default(&self->color_map); - // This sensor needs some time to get values right after turning power on - mp_hal_delay_ms(1000); - return MP_OBJ_FROM_PTR(self); }