Add setting for disabling Bluetooth
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
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 Sounds good, I'll update it to remove the patch for persistence and mark it ready for review.
@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?
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.
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.
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.
Rebased for v3.3.0 release / v7.10.0 firmware.
Fixed formatting issues.
coverage: 56.427% (-0.2%) from 56.596% when pulling 13b8548d3503b6a9f08623e017c39645c2ddb8bc on nkarstens:bluetooth-toggle into 2d783d362dc5fdf1a5d4364b92748813451cb98e on pybricks:master.
Download the artifacts for this pull request:
- cityhub-firmware-build-3182-git221de8af.zip
- essentialhub-firmware-build-3182-git221de8af.zip
- movehub-firmware-build-3182-git221de8af.zip
- mpy-cross.zip
- nxt-firmware-build-3182-git221de8af.zip
- pr_number.zip
- primehub-firmware-build-3182-git221de8af.zip
- pybricks-micropython-build-3182-git221de8af.zip
- technichub-firmware-build-3182-git221de8af.zip
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 - please keep an eye on https://github.com/pybricks/support/issues/1615 later this week. Thank you!
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.