Keeping your hub connected while using pybricksdev #2348
Replies: 3 comments 3 replies
-
Can you add some more details here? The "recompile and run" option sounds like it is meant to just send the same program to the hub again and run it. Recompile and Download sounds like it will download your same code but this time not execute it. Which seems strange since the code is already downloaded on the hub. I guess Exit just exits the pybricks program and stops the running code on the hub? Then after a couple of minutes the hub will time out and turn off? I have a couple of use cases that I would like to consider
Since you are working on pybricksdev right now, I would like to see if we can have a configurable timeout parameter that keeps the hub powered on for a longer period of time. I'm not sure what the delay is now, but it is too short for us. It would be great as a command line option so I can configure it with our VS Code script, I don't have a hub with me, but I look forward to testing this! |
Beta Was this translation helpful? Give feedback.
-
This is a very cool feature, thx! One question though: Can I specify which command for it to run when "recompiling"? In my case I got tons of custom build scripts / monitor wrappers around my dev environment, so code changes arent reflected by my src/main.py but rather a build/main.py file. Is that possible, to opt out of the default behavior and pass a custom recompile script to it? I'll be fine without it, just wondering if thats possible and I just can find the CLI option for it... Best Sam |
Beta Was this translation helpful? Give feedback.
-
Finally got a chance to do some testing. I see how it works, and I can easily see how some people will love it. For us, we use Tasks in VS Code to run the pybricksdev program, triggered by a keyboard shortcut. When the programmer is ready to test their code, they type "ctrl-L" (L for Launch). That will save their code and launch pybricksdev.exe and run their code. Assuming the code runs to completion, but requires an update, they simply make the desired changes and type ctrl-L again. Update, Ctrl-L. Update, Ctrl-L. Sometimes we have to hit the Big Brick Button, and sometimes the hub powers off, or sometimes the kids will accidentally turn the bluetooth off, but we have gotten pretty used to those things. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This has been a common request for
pybricksdev
. 1Thanks to some hard work and dedication by @shaggysa you no longer have to reconnect your hub each time you want to download and run a new version of the program you are working on each time you make a change. Just update
pybricksdev
to version 2.1.0 or higher and then add--stay-connected
the next time you dopybricksdev run ...
and when the program running on the hub ends, you will see a menu asking what to do next and the hub will stay connected so that it won't turn of while you are making changes to your code!It looks like this:
Footnote:
1: Although my search skills are failing me at the moment to actually find them. If anyone has a link to where someone asked for this feature, add it in a comment below.
Beta Was this translation helpful? Give feedback.
All reactions