wificonf: auto connect at boot

This commit is contained in:
Thomas Farstrike
2025-05-01 15:44:12 +02:00
parent 7242a5aed1
commit fb96e6ccf9
6 changed files with 25 additions and 10 deletions
@@ -1,3 +1,5 @@
Manifest-Version: 1.0
Name: WiFiConf
Start-Script: assets/wificonf.py
WiFi-Connect-Script: assets/auto_connect.py
WiFi-Configure-Script: assets/wificonf.py
+16 -5
View File
@@ -355,17 +355,28 @@ def start_app(app_dir, is_launcher=False):
# Execute this if it exists
execute_script_new_thread("/autorun.py", True, False, False)
# A generic "start at boot" mechanism hasn't been implemented yet, so do it like this:
execute_script_new_thread("/builtin/apps/com.example.wificonf/assets/auto_connect.py", True, False, False)
try:
import freezefs_mount_builtin
except Exception as e:
print("/main.py: WARNING: could not import/run freezefs_mount_builtin: ", e)
# The launcher might have been updated from the builtin one, so check that:
# A generic "start at boot" mechanism hasn't been implemented yet, so do it like this:
import uos
custom_auto_connect = "/apps/com.example.wificonf/assets/auto_connect.py"
builtin_auto_connect = "/builtin/apps/com.example.wificonf/assets/auto_connect.py"
try:
stat = uos.stat(custom_auto_connect)
execute_script_new_thread(custom_auto_connect, True, False, False)
except OSError:
try:
print(f"Couldn't execute {custom_auto_connect}, trying {builtin_auto_connect}...")
stat = uos.stat(builtin_auto_connect)
execute_script_new_thread(builtin_auto_connect, True, False, False)
except OSError:
print("Couldn't execute {builtin_auto_connect}, continuing...")
# The launcher might have been updated from the builtin one, so check that:
custom_launcher = "/apps/com.example.launcher"
builtin_launcher = "/builtin/apps/com.example.launcher"
try:
+1 -1
View File
@@ -1,4 +1,4 @@
freeze('internal_filesystem/', 'boot.py') # Hardware initialization
freeze('internal_filesystem/', 'main.py') # User Interface initialization
freeze('internal_filesystem/lib', '') # Additional libraries
freeze('/home/user/sources/freezeFS/', 'freezefs_mount.py') # Built-in apps
freeze('/home/user/sources/freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps
+2
View File
@@ -1 +1,3 @@
pushd ~/sources/freezeFS
python3 -m freezefs --target /builtin --on-import mount ~/sources/PiggyOS/internal_filesystem/builtin freezefs_mount_builtin.py
popd
+1 -1
View File
@@ -3,4 +3,4 @@
# --partition size: both OTA partitions are 4MB
# --flash-size: total flash size is 16MB
#
python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" FROZEN_MANIFEST=manifest.py
python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" FROZEN_MANIFEST=~/sources/PiggyOS/manifest.py
Regular → Executable
+3 -3
View File
@@ -1,4 +1,4 @@
fwfile="build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin"
ls -al "$fwfile"
~/.espressif/python_env/idf5.2_py3.9_env/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m --erase-all 0x0 "$fwfile"
fwfile="/home/user/sources/lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin"
ls -al $fwfile
~/.espressif/python_env/idf5.2_py3.9_env/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m --erase-all 0x0 $fwfile