Command for safe boot
-
Is it possible to do a safe boot (or a soft reboot) from the command line? I know that you can accomplish these with Ctrl+F and Ctrl+D, respectively, but I would like to include a safe boot in my script so I need a command line option.
machine.reset()is a command line reset but it does a hard reset and I don't wantmain.pyandboot.pyto run. -
@alexpul No, but it would be easy to add something like machine.safe_boot(). It would more or less only consist of the name definition, and a function with a single statement, which just calls another function.
-
@alexpul But if it's only about not executing boot.py and main.py on boot, you can do similar with python scripts:
from machine import reset def safe_boot.py() # create a special main.py and reset f= open("no_main.py", "w") f.write('''import os\nos.remove("no_main.py")\n''') f.close() reset()and then a specific boot.py, which checks for that special main.py:
import machine import os try: f = open("no_main.py") f.close() machine.main("no_main.py") except OSError: # do the previous boot.py stuff hereOr something similar in you regular boot.py and main.py, which just checks for the existence of a flag for bypassing.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login