Skip to content

Commit

Permalink
pybricks.pupdevices.LUMPDevice: remove power hack
Browse files Browse the repository at this point in the history
Sensors that require power are now automatically powered when plugged in, so we no longer need this hack at the module level.
  • Loading branch information
laurensvalk committed Dec 23, 2020
1 parent fbd13cf commit 9c9dfa2
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions pybricks/iodevices/pb_type_iodevices_lumpdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@ STATIC mp_obj_t iodevices_LUMPDevice_make_new(const mp_obj_type_t *type, size_t
pb_device_get_info(self->pbdev, &_port, &id, &curr_mode, &num_values);
self->id = mp_obj_new_int(id);

#if PYBRICKS_PY_PUPDEVICES
// FIXME: Read sensor capability flag to see which sensor uses power. As
// a precaution, only enable power for selected known sensors for now.
int32_t duty = (id == PBIO_IODEV_TYPE_ID_SPIKE_COLOR_SENSOR || id == PBIO_IODEV_TYPE_ID_SPIKE_ULTRASONIC_SENSOR) ? 100 : 0;
pb_device_set_power_supply(self->pbdev, duty);
#endif // PYBRICKS_PY_PUPDEVICES

return MP_OBJ_FROM_PTR(self);
}

Expand Down

0 comments on commit 9c9dfa2

Please sign in to comment.