Fastest way to upload, reset and follow output #13190
-
Hi, I've been playing around with all sorts of tools, mpr, ampy, rshell, mpremote but for some reason I don't understand I can't work out a simple work flow to...
I can then easily loop this and kill the repl session with inotifywatch or such like when I save my main.py on my laptop Quirks I'm seeing, which I expect are obvious... Connecting after a soft-rest, repl shows nothing, even though I thought mpremote resume" was meant to pick up on that existing interpreter? If I do a control D to do a soft reset inside repl, then it starts up as expected, but I don't want to have to do every time. If I do a full reset I can then connect to repl and see what it's up to, but this takes time, and destroys the ttyACM0 device during that reboot. when using "run" commands in various ways, my code terminates immediately, rather than waiting for the timers I have just configured. I have no infinite loop as I don't need one when the code runs normally outside of a dev environment. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
The quickest development workflow I use is to have my code in a different file, eg Then use mpremote to mount my local folder with Make changes in local file, ctrl-d to soft reset and reload changes on mount, then run it again. Eg.
After mounting the current local directory, it executes app.py from the mounted directory each time Ctrl-J is pressed. |
Beta Was this translation helpful? Give feedback.
-
I was keen to keep the file on board, so it will run the same when i disconnect it, and also to be able to run things totally hands free on that side. I've got this nonsense running currently, just want to turn the reset into a soft-reset really.
I probably just shouldn't resent a couple of extra keypresses I guess! I wasn't aware of the inject thing, i'll have a play around with that, Am I right to observe that your import approach won't work with timers though? it just gets to the end of the file and stops. There's something different in importing a file in repl like that compared to executing main.py on boot isn't there? |
Beta Was this translation helpful? Give feedback.
-
The mpremote mount stuff is just for during active development sure, once I've got the code right I'll mpremote cp to board and add a code imported in a file like |
Beta Was this translation helpful? Give feedback.
-
https://docs.micropython.org/en/latest/reference/mpremote.html#auto-connection-and-soft-reset If you've just done a file copy, then the current state will be sitting at the REPL. Which is why you then need to press Ctrl-D to start your program. (Note the soft-reset triggered by mpremote is special in that it doesn't cause main.py to be executed) It sounds like what you want is an explicit "run main.py" command (or a version of the |
Beta Was this translation helpful? Give feedback.
-
I've always been confused what/if special magic is done here. This really should be stated in the mpremote documentation, within that section. |
Beta Was this translation helpful? Give feedback.
I've always been confused what/if special magic is done here. This really should be stated in the mpremote documentation, within that section.