Skip to content

Commit

Permalink
pybricks.tools.hub_menu: Allow Bluetooth button as exit.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensvalk committed Dec 10, 2024
1 parent 40cc061 commit cc5521f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
of pbdrv_usb_get_bcd(). This will allow pro users to be able to tell if they
have a "nonstandard" charger that could prevent proper
charging ([pybricks-micropython#274]).
- When the Bluetooth button is selected to stop the program, don't disable the
stop button while the hub menu is active ([support#1975]).

### Fixed
- Fixed `DriveBase.angle()` getting an incorrectly rounded gyro value, which
Expand All @@ -38,6 +40,7 @@
[support#943]: https://github.com/pybricks/support/issues/943
[support#1886]: https://github.com/pybricks/support/issues/1886
[support#1844]: https://github.com/pybricks/support/issues/1844
[support#1875]: https://github.com/pybricks/support/issues/1975

## [3.6.0b2] - 2024-10-15

Expand Down
8 changes: 7 additions & 1 deletion pybricks/tools/pb_module_tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,13 @@ static mp_obj_t pb_module_tools_hub_menu(size_t n_args, const mp_obj_t *args) {

// Disable stop button and cache original setting to restore later.
pbio_button_flags_t stop_button = pbsys_program_stop_get_buttons();
pbsys_program_stop_set_buttons(0);

// Disable normal stop behavior since we need the buttons for the menu.
// Except if the Bluetooth button is used for stopping, since we don't need
// it for the menu.
if (stop_button != PBIO_BUTTON_RIGHT_UP) {
pbsys_program_stop_set_buttons(0);
}

nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
Expand Down

0 comments on commit cc5521f

Please sign in to comment.