Skip to content

Commit 2f52c34

Browse files
committed
drv/ioport_lpf2: add move hub shutdown quirk
This adds a configuration option to handle a quirk of the BOOST Move hub. For some reason, this hub turns back on when the power button is released after shutdown if the port VCC is turned off. Also added PROCESS_EXIT() to the exit handler just to be safe while we are touching this (otherwise device connection manager might run one more iteration). Fixes: pybricks/support#386 Fixes: 1473c4b
1 parent b7cc563 commit 2f52c34

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## [Unreleased]
77

88
### Added
9-
- Added `reset_angle=False` keyword argument to `Motor()` class.
9+
- Added `reset_angle=False` keyword argument to `Motor()` class.
1010
This makes resetting the angle optional, allowing to maintain absolute
1111
positioning for robots with gears ([support#389]).
1212

@@ -16,6 +16,7 @@
1616

1717
### Fixed
1818
- Fixed City hub not always powering off on shutdown ([support#385]).
19+
- Fixed Move hub turning back on after shutdown ([support#386]).
1920

2021
## [3.1.0a2] - 2021-07-06
2122

@@ -95,6 +96,7 @@ Prerelease changes are documented at [support#48].
9596
[support#361]: https://github.com/pybricks/support/issues/361
9697
[support#379]: https://github.com/pybricks/support/issues/379
9798
[support#385]: https://github.com/pybricks/support/issues/385
99+
[support#386]: https://github.com/pybricks/support/issues/386
98100
[support#389]: https://github.com/pybricks/support/issues/389
99101

100102
[Unreleased]: https://github.com/pybricks/pybricks-micropython/compare/v3.1.0a2...HEAD

lib/pbio/drv/ioport/ioport_lpf2.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,16 @@ PROCESS_THREAD(pbdrv_ioport_lpf2_process, ev, data) {
409409
// TODO: we need to ensure H-bridge power is off here to avoid potentially
410410
// damaging custom I/O devices.
411411

412+
#if PBDRV_CONFIG_IOPORT_LPF2_BOOST_SHUTDOWN_QUIRK
413+
// The LEGO BOOST Move hub will turn right back on when the power button
414+
// is released if we turn off VCC at shutdown for some reason (hardware bug?).
415+
pbdrv_gpio_out_high(&pbdrv_ioport_lpf2_platform_data.port_vcc);
416+
#else
412417
// Turn off power on pin 4 on all ports
413418
pbdrv_gpio_out_low(&pbdrv_ioport_lpf2_platform_data.port_vcc);
419+
#endif
420+
421+
PROCESS_EXIT();
414422
});
415423

416424
PROCESS_BEGIN();

lib/pbio/platform/move_hub/pbdrvconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#define PBDRV_CONFIG_IOPORT (1)
4343
#define PBDRV_CONFIG_IOPORT_LPF2 (1)
44+
#define PBDRV_CONFIG_IOPORT_LPF2_BOOST_SHUTDOWN_QUIRK (1)
4445
#define PBDRV_CONFIG_IOPORT_LPF2_NUM_PORTS (2)
4546
#define PBDRV_CONFIG_IOPORT_LPF2_FIRST_PORT PBIO_PORT_ID_C
4647
#define PBDRV_CONFIG_IOPORT_LPF2_LAST_PORT PBIO_PORT_ID_D

0 commit comments

Comments
 (0)