You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy-paste this into your device's REPL (e.g. over serial) and hit enter. The `or True` handles the case where the directories already exist.
17
18
18
-
## What it does
19
+
There are other ways to create this file:
20
+
21
+
- use mpremote.py to mkdir and then cp the new main.py or
22
+
- use a Web IDE like https://fri3dcamp.github.io/Fri3d-IDE/ which have file managers that can create and edit files and folders
23
+
24
+
## How this works
25
+
26
+
When the firmware boots, the built-in `main.py` (from `internal_filesystem/main.py` in the repo) adds `/lib` to the start of sys.path and then executes `import mpos.main`.
19
27
20
-
`/lib/mpos/main.py` is MicroPythonOS's entry point, imported by the frozen `internal_filesystem/main.py`.
28
+
Since the internal filesystem's `/lib` is on the sys.path _before_the .frozen library folder, placing `mpos/main.py` in `/lib` will take precedence and will get executed.
21
29
22
-
When the firmware boots, it looks for `main.py` on the filesystem — if found, it runs it first. This one-liner writes a stub that raises an error instead, which means:
30
+
The one-liner above writes a stub that raises an exception, which means:
23
31
24
32
1. The device boots into a clean MicroPython REPL.
25
33
2. No MicroPythonOS code (LVGL, apps, frameworks) is loaded.
@@ -37,10 +45,8 @@ This runs the full boot sequence (LVGL init, app loading, launcher) as if nothin
37
45
38
46
## Undoing the hijack
39
47
40
-
To restore normal boot on every power-on, delete the stub:
48
+
To restore normal boot on every power-on, delete the override and its containing folder:
0 commit comments