New mpremote default soft-reset behaviour #19706
Replies: 2 comments
|
It would be helpful if there was a simple(r) way to install Mpremote preview from either the downloads pages, or from PyPI (preferred). Installing from the GitHub repo will fail, at a pip install will attempt to recursive sync all submodules, and then time out. So currently the only option is to clone, and then If we can make this simpler, we make it simpler to test all those tools that wrap Mpremote (yep, it's on my backlog as well) |
|
A week ago I sent a message to @dpgeorge with some special cases I find myself into that do require a Thank you for adding I'm sold, new behaviour works for me 😄 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We've recently merged PR 17485 "mpremote: Make resume the default behaviour". The mpremote command line tool has new default behaviour in the nightly v1.30-preview builds, and this change will be part of the future MicroPython v1.30 release.
In MicroPython v1.29 and earlier, mpremote automatically soft resets the target board before running the requested commands. This means mpremote always starts from a minimal initial state, and any existing state (loaded code, set variables, etc) is lost each time it runs. In order to keep the existing state of the board there is a subcommand
mpremote resume [command(s)]which skips the soft reset and "resumes" the existing Python programming session.In MicroPython v1.30 and newer, the default behaviour is now
resume- i.e. the board is not automatically soft reset, and when you runmpremotethen it keeps the existing state of the board. There is a new subcommandmpremote soft-reset [command(s)]which you can use to soft reset the board before mpremote starts running the requested commands.Most workflows will not need to change, but there are some subtle differences. For example, if you run
import mycodeon a board and then later usempremote cp mycode.py :to copy a new version of themycodemodule, MicroPython will still have the oldmycodemodule imported until you trigger a soft-reset (either by runningmpremote soft-reset cp mycode.py :, by typing Ctrl-D in the REPL, etc.)It is possible to change back to the v1.29 default behaviour via a new setting in the mpremote config.py file. Adding the line
auto_soft_reset = Truewill bring back the v1.29 default behaviour.If you're writing a script that calls
mpremotethen suggest explicitly runningmpremote soft-reset [...]ormpremote resume [...]each time, so correct behaviour doesn't depend on the local config.For more details see this section of the mpremote documentation
Feel free to post a comment if this change breaks any workflows in a way which is difficult to accommodate.
All reactions