pybricks / support

Pybricks support and general discussion
MIT License
107 stars 6 forks source link

Support turning on/off Bluetooth on hubs with Bluetooth button for use at competitions #1123

Open ttn-c4plus opened 1 year ago

ttn-c4plus commented 1 year ago

Question Hello, the most important thing is the Brick always turn on Bluetooth and ready for connect when it on This is very dangerous when we join competition, because some bad guys can connect to the Robot at competition area. How can I turn on Bluetooth when click Bluetooth button on brick?

dlech commented 1 year ago

This is not currently possible. It was discussed recently at https://github.com/orgs/pybricks/discussions/1089 and someone made a quick hack for their own use and shared it.

But it sounds like something we should consider including in the default firmware.

ttn-c4plus commented 1 year ago

Yeah, if it's going to true, it will be awesome..

laurensvalk commented 1 year ago

Here's how it might work from a user perspective.

This won't be included in release V3.3, but we can consider it for V3.4.

nkarstens commented 1 year ago

I have an implementation of this in a draft pull request here: pybricks/pybricks-micropython#195. It mostly works, but I'm having trouble with the persistent storage part of it. If someone could take a look it would be appreciated!

nothingtodowu commented 5 months ago

Hi Karstens,

I had clone and build with this image, but when I download it to primehub, when I press bluetooth button, nothing happen. What should I do to turn off/on the bluetooth? Thanks a lot.

https://github.com/nkarstens/pybricks-micropython/tree/bluetooth-toggle

nothingtodowu commented 5 months ago

Hi Karstens,

Thanks a lot. It fiexed. You have done a great job.

nkarstens commented 4 months ago

@nothingtodowu Thanks, glad it worked out for you!