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

[Feature request] add 'turn off' and 'reconnect to last hub' buttons...

Open biasedlogic opened this issue 1 year ago • 2 comments

I'd love to see two buttons added to the web IDE.

  1. 'turn the hub off'. While turning the hub on is very easy (just click the button) it takes a loooong press to turn it off and you have to get physically to the hub. So more often than not I fire REPL up and execute TechnicHub().system.shutdown() instead. I'd love to just have an IDE button that'd do just that. Shut the hub remotely down.

  2. Reconnect to last. When coding using Technic Hub AND Xbox remote each time you want to change something in the code you have to reconnect. I have a raise SystemExit bound to one controller button, so that I can kick it back remotely into standby and ready for connection, but it takes several clicks to get the IDE connected again. It'd be great if there was a 'reconnect' button that'd just try the last BT MAC address instead of opening the pairing dialogue.

Thanks in advance for consideration!

biasedlogic avatar Apr 13 '24 14:04 biasedlogic

Thanks for your notes. For what it's worth, the hub turns itself off after a few minutes if it is not connected. I suppose we could reduce this time.

Is pressing for three seconds slower than typing that command? What if we made it two seconds? :smile:

I agree that working with the Xbox Controller and the technic hub is inconvenient. Give it a try on prime hub - the controller can just stay connected while you work on the code. Hopefully, we can get there as well on technic hub one day.

Connecting to the last hub with a single click isn't as trivial as it may appear. Because of security considerations, a web based app like ours cannot initiate connections by itself. It has to go through the official browser dialog (which is probably a good thing). I think there have been some recent additions to the web ble api, so maybe this is possible now.

As mentioned above though, I'd rather just fix the Xbox connection so we don't have to invent workarounds for the real problem. I'm going to have to get some additional hardware to investigate what's wrong with that Bluetooth connection. I'll add some more links when I get back to a computer later.

laurensvalk avatar Apr 13 '24 18:04 laurensvalk

Is pressing for three seconds slower than typing that command? What if we made it two seconds? 😄

Making this timeout shorter will definitely improve my experience :-) But this is not always a solution.

I do a lot of experiments and have recently had a few proof-of-concept builds which were less than stable, example being a tower crane where the hub was the counterweight. Issuing the shutdown command was simply reliable, while trying to press and hold the button meant you have to be careful not to tip it all over. Another example would be a kind of a car I've built, where the hub was hard to access, so I had to take a few pieces off to reach the button. I had to do it to turn the hub on, but could save the effort when turning it off.

I agree that working with the Xbox Controller and the technic hub is inconvenient. Give it a try on prime hub - the controller can just stay connected while you work on the code. Hopefully, we can get there as well on technic hub one day.

That'd be great!

Connecting to the last hub with a single click isn't as trivial as it may appear. Because of security considerations, a web based app like ours cannot initiate connections by itself.

I thought that there would be something along these lines. How about the hub? Can the hub initiate a connection like requesting a handler?

biasedlogic avatar Apr 14 '24 05:04 biasedlogic