Skip to content

Commit

Permalink
drv/ioport_lpf2: set vcc pin to input on shutdown
Browse files Browse the repository at this point in the history
There seem to still be issues with the some city hubs turning back on
when the power button is released.

This changes the gpio state for the I/O port VCC pin from out low to
input (floating) on shutdown. This seems to fix a similar issue
observed on the move hub as well, so we can drop the quirk for that
platform.

Fixes: pybricks/support#692
  • Loading branch information
dlech committed Aug 1, 2022
1 parent 6acc817 commit 019d95c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
- Indicate that the SPIKE Prime hub is booting and shutting down by fading
the stop sign in and out.

### Fixed
- Fixed city hub turning back on after shutdown ([support#692]).

[support#692]: https://github.com/pybricks/support/issues/692

## [3.2.0b3] - 2022-07-20

### Fixed
Expand Down
11 changes: 4 additions & 7 deletions lib/pbio/drv/ioport/ioport_lpf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,11 @@ PROCESS_THREAD(pbdrv_ioport_lpf2_process, ev, data) {
// TODO: we need to ensure H-bridge power is off here to avoid potentially
// damaging custom I/O devices.

#if PBDRV_CONFIG_IOPORT_LPF2_BOOST_SHUTDOWN_QUIRK
// The LEGO BOOST Move hub will turn right back on when the power button
// is released if we turn off VCC at shutdown for some reason (hardware bug?).
pbdrv_gpio_out_high(&pbdrv_ioport_lpf2_platform_data.port_vcc);
#else
// Turn off power on pin 4 on all ports
pbdrv_gpio_out_low(&pbdrv_ioport_lpf2_platform_data.port_vcc);
#endif
// NB: there seems to be a hardware? issue on move/city hubs that if we
// set this to output low instead of input, the hub will turn back on
// as soon as the user releases the power button
pbdrv_gpio_input(&pbdrv_ioport_lpf2_platform_data.port_vcc);

PROCESS_EXIT();
});
Expand Down
1 change: 0 additions & 1 deletion lib/pbio/platform/move_hub/pbdrvconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

#define PBDRV_CONFIG_IOPORT (1)
#define PBDRV_CONFIG_IOPORT_LPF2 (1)
#define PBDRV_CONFIG_IOPORT_LPF2_BOOST_SHUTDOWN_QUIRK (1)
#define PBDRV_CONFIG_IOPORT_LPF2_NUM_PORTS (2)
#define PBDRV_CONFIG_IOPORT_LPF2_FIRST_PORT PBIO_PORT_ID_C
#define PBDRV_CONFIG_IOPORT_LPF2_LAST_PORT PBIO_PORT_ID_D
Expand Down

0 comments on commit 019d95c

Please sign in to comment.