From 02d9c3e60dcfa6c48c67bf8f2e3fd8ac039710c0 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Sun, 27 Apr 2025 19:50:06 +0200 Subject: [PATCH] Fix OSUpdate --- .../apps/com.example.osupdate/assets/osupdate.py | 13 ++++++------- internal_filesystem/main.py | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal_filesystem/apps/com.example.osupdate/assets/osupdate.py b/internal_filesystem/apps/com.example.osupdate/assets/osupdate.py index 1db12e6b..2831c485 100644 --- a/internal_filesystem/apps/com.example.osupdate/assets/osupdate.py +++ b/internal_filesystem/apps/com.example.osupdate/assets/osupdate.py @@ -3,22 +3,21 @@ import ota.update from esp32 import Partition import urequests - subwindow.clean() canary = lv.obj(subwindow) canary.add_flag(lv.obj.FLAG.HIDDEN) - import ota.status ota.status.status() current = Partition(Partition.RUNNING) current -current.get_next_update() +next_partition = current.get_next_update() +next_partition -# Initialize LVGL display (assuming setup is done) label = lv.label(subwindow) -label.set_text("OTA Update: 0.00%") +label.set_text("OS Update: 0.00%") label.align(lv.ALIGN.CENTER, 0, -30) + progress_bar = lv.bar(subwindow) progress_bar.set_size(200, 20) progress_bar.align(lv.ALIGN.BOTTOM_MID, 0, -50) @@ -29,7 +28,7 @@ progress_bar.set_value(0, lv.ANIM.OFF) def update_with_lvgl(url): def progress_callback(percent): print(f"OTA Update: {percent:.1f}%") - label.set_text(f"OTA Update: {percent:.2f}%") # Cloud upload symbol + label.set_text(f"OTA Update: {percent:.2f}%") progress_bar.set_value(int(percent), lv.ANIM.ON) current = Partition(Partition.RUNNING) next_partition = current.get_next_update() @@ -59,4 +58,4 @@ def update_with_lvgl(url): machine.reset() # Start OTA update -update_with_lvgl("http://demo.lnpiggy.com:2121/ESP32_GENERIC_S3-SPIRAM_OCT_micropython.bin") +update_with_lvgl("http://demo.lnpiggy.com:2121/latest.bin") diff --git a/internal_filesystem/main.py b/internal_filesystem/main.py index 3fec7e66..9bd37b5d 100644 --- a/internal_filesystem/main.py +++ b/internal_filesystem/main.py @@ -1,4 +1,5 @@ # Constants +CURRENT_VERSION = "0.0.1" TFT_HOR_RES=320 TFT_VER_RES=240 NOTIFICATION_BAR_HEIGHT=24