pybricks-micropython icon indicating copy to clipboard operation
pybricks-micropython copied to clipboard

Add setting for disabling Bluetooth

Open nkarstens opened this issue 2 years ago • 10 comments

Adds a button control to change the setting, and the light around the button to indicate current state.

Implements https://github.com/pybricks/support/issues/1123

nkarstens avatar Aug 29 '23 05:08 nkarstens

Thanks for the contribution! We’ll review this when we can.

There’s some things we still need to decide about persistent settings, so maybe we can start without that part of it. It shouldn’t be too much trouble for people to press the Bluetooth button if they want to turn it off.

laurensvalk avatar Sep 02 '23 07:09 laurensvalk

@laurensvalk Sounds good, I'll update it to remove the patch for persistence and mark it ready for review.

nkarstens avatar Sep 06 '23 04:09 nkarstens

@dlech It would be great if I could get your thoughts on this one as well if you have time. I think there may be an outstanding question about persistent settings. @laurensvalk had mentioned there were some things still being worked on there, have you had a chance to figure anything out?

nkarstens avatar Nov 27 '23 18:11 nkarstens

My thinking right now is to finish USB support first, then come back to this. Having USB support could change the behavoir we want here.

dlech avatar Nov 27 '23 18:11 dlech

Thanks @nkarstens. To add to David comment, I think it would be nice if the default behavior stays consistent with what we had, so Bluetooth on by default.

Besides consistency, I've always found it much more convenient too. With the official app you always have to do multiple clicks, button pushes, and so on, just to connect and run a program.

laurensvalk avatar Nov 27 '23 19:11 laurensvalk

Thanks @nkarstens. To add to David comment, I think it would be nice if the default behavior stays consistent with what we had, so Bluetooth on by default.

Besides consistency, I've always found it much more convenient too. With the official app you always have to do multiple clicks, button pushes, and so on, just to connect and run a program.

I can update this to change the default value. I wanted it off by default for our team so that it's one less thing they have to worry about during competition.

Ideally we could get setting storage figured out so that it would remember the previous state. If that won't happen for a while, then I would be fine merging this in with the default being Bluetooth enabled and I can just do a custom build for our team.

nkarstens avatar Dec 17 '23 12:12 nkarstens

Rebased for v3.3.0 release / v7.10.0 firmware.

nkarstens avatar Dec 17 '23 12:12 nkarstens

Fixed formatting issues.

nkarstens avatar Dec 17 '23 12:12 nkarstens

Coverage Status

coverage: 56.427% (-0.2%) from 56.596% when pulling 13b8548d3503b6a9f08623e017c39645c2ddb8bc on nkarstens:bluetooth-toggle into 2d783d362dc5fdf1a5d4364b92748813451cb98e on pybricks:master.

coveralls avatar Dec 27 '23 07:12 coveralls

Hi! @nkarstens @laurensvalk Is there a way for the artifacts to be created again? or do you have any documentation on how I could generate a custom firmware with these changes?

I want to use Pybrick for WRO competition, having bluetooth enabled permanently is problematic for competition purposes. The rules (Section 5.11 in https://wro-association.org/wp-content/uploads/WRO-2023-RoboMission-General-Rules.pdf) I appreciate any help you can provide me!!!

sodes-proxy avatar Jun 03 '24 02:06 sodes-proxy

@sodes-proxy - please keep an eye on https://github.com/pybricks/support/issues/1615 later this week. Thank you!

laurensvalk avatar Jun 04 '24 11:06 laurensvalk

A version of this has been merged in https://github.com/pybricks/pybricks-micropython/pull/247 and was made persistent in https://github.com/pybricks/pybricks-micropython/pull/249, so we'll close this one.

Thanks for your contribution @nkarstens !


  • Bluetooth is on by default, same as now (no breaking change).
  • Toggle Bluetooth on/off with button.
  • Bluetooth light: blue is on, red is off.
  • Make it persistent after reboot. So you can achieve off-on-boot, for judge review.
  • Spike Prime / Robot Inventor only.

If anyone want to try it out before we release a new beta in a few weeks, just follow these instructions. That page includes a link to the latest build.

laurensvalk avatar Jun 07 '24 13:06 laurensvalk