|
3 | 3 | from esp32 import Partition |
4 | 4 | import urequests |
5 | 5 |
|
6 | | - |
7 | 6 | subwindow.clean() |
8 | 7 | canary = lv.obj(subwindow) |
9 | 8 | canary.add_flag(lv.obj.FLAG.HIDDEN) |
10 | 9 |
|
11 | | - |
12 | 10 | import ota.status |
13 | 11 | ota.status.status() |
14 | 12 | current = Partition(Partition.RUNNING) |
15 | 13 | current |
16 | | -current.get_next_update() |
| 14 | +next_partition = current.get_next_update() |
| 15 | +next_partition |
17 | 16 |
|
18 | | -# Initialize LVGL display (assuming setup is done) |
19 | 17 | label = lv.label(subwindow) |
20 | | -label.set_text("OTA Update: 0.00%") |
| 18 | +label.set_text("OS Update: 0.00%") |
21 | 19 | label.align(lv.ALIGN.CENTER, 0, -30) |
| 20 | + |
22 | 21 | progress_bar = lv.bar(subwindow) |
23 | 22 | progress_bar.set_size(200, 20) |
24 | 23 | progress_bar.align(lv.ALIGN.BOTTOM_MID, 0, -50) |
|
29 | 28 | def update_with_lvgl(url): |
30 | 29 | def progress_callback(percent): |
31 | 30 | print(f"OTA Update: {percent:.1f}%") |
32 | | - label.set_text(f"OTA Update: {percent:.2f}%") # Cloud upload symbol |
| 31 | + label.set_text(f"OTA Update: {percent:.2f}%") |
33 | 32 | progress_bar.set_value(int(percent), lv.ANIM.ON) |
34 | 33 | current = Partition(Partition.RUNNING) |
35 | 34 | next_partition = current.get_next_update() |
@@ -59,4 +58,4 @@ def progress_callback(percent): |
59 | 58 | machine.reset() |
60 | 59 |
|
61 | 60 | # Start OTA update |
62 | | -update_with_lvgl("http://demo.lnpiggy.com:2121/ESP32_GENERIC_S3-SPIRAM_OCT_micropython.bin") |
| 61 | +update_with_lvgl("http://demo.lnpiggy.com:2121/latest.bin") |
0 commit comments