Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac1ff41

Browse files
OSUpdate: check update depending on current hardware identifier
1 parentcc5c039 commitac1ff41

File tree

8 files changed

+36
-4
lines changed

8 files changed

+36
-4
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.1.1
2+
=====
3+
- OSUpdate: check update depending on current hardware identifier
4+
15
0.1.0
26
=====
37
- Update to MicroPython 1.25.1 and LVGL 9.3

‎internal_filesystem/boot.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
importtask_handler
1212

1313
importmpos.ui
14+
importmpos.info
15+
16+
mpos.info.set_hardware_id("waveshare-esp32-s3-touch-lcd-2")
1417

1518
# Pin configuration
1619
SPI_BUS=2

‎internal_filesystem/boot_fri3d-2024.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
importtask_handler
1111

1212
importmpos.ui
13+
importmpos.info
14+
15+
mpos.info.set_hardware_id("fri3d-2024")
1316

1417
# Pin configuration
1518
SPI_BUS=2

‎internal_filesystem/boot_unix.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
importmpos.ui
1111
importmpos.clipboard
12+
importmpos.info
13+
14+
mpos.info.set_hardware_id("linux-desktop")
1215

1316
# Same as Waveshare ESP32-S3-Touch-LCD-2
1417
TFT_HOR_RES=320

‎internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ def onCreate(self):
1010
screen.set_style_border_width(0,0)
1111
screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
1212
screen.set_style_pad_all(mpos.ui.pct_of_display_width(2),0)
13+
label0=lv.label(screen)
14+
label0.set_text(f"Hardware ID:{mpos.info.get_hardware_id()}")
1315
label1=lv.label(screen)
1416
label1.set_text(f"MicroPythonOS version:{mpos.info.CURRENT_OS_VERSION}")
1517
label2=lv.label(screen)

‎internal_filesystem/builtin/apps/com.micropythonos.osupdate/META-INF/MANIFEST.JSON‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"publisher":"MicroPythonOS",
44
"short_description":"Operating System Updater",
55
"long_description":"Updates the operating system in a safe way, to a secondary partition. After the update, the device is restarted. If the system starts up successfully, it is marked as valid and kept. Otherwise, a rollback to the old, primary partition is performed.",
6-
"icon_url":"https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.4_64x64.png",
7-
"download_url":"https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.4.mpk",
6+
"icon_url":"https://apps.micropythonos.com/apps/com.micropythonos.osupdate/icons/com.micropythonos.osupdate_0.0.5_64x64.png",
7+
"download_url":"https://apps.micropythonos.com/apps/com.micropythonos.osupdate/mpks/com.micropythonos.osupdate_0.0.5.mpk",
88
"fullname":"com.micropythonos.osupdate",
9-
"version":"0.0.4",
9+
"version":"0.0.5",
1010
"category":"osupdate",
1111
"activities": [
1212
{

‎internal_filesystem/builtin/apps/com.micropythonos.osupdate/assets/osupdate.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ def onStop(self, screen):
5151

5252
defshow_update_info(self):
5353
self.status_label.set_text("Checking for OS updates...")
54-
url="https://updates.micropythonos.com/osupdate.json"
54+
hwid=mpos.info.get_hardware_id()
55+
if (hwid=="waveshare-esp32-s3-touch-lcd-2"):
56+
infofile="osupdate.json"
57+
# Device that was first supported did not have the hardware ID in the URL, so it's special:
58+
else:
59+
infofile=f"osupdate_{hwid}.json"
60+
url=f"https://updates.micropythonos.com/{infofile}"
5561
print(f"OSUpdate: fetching{url}")
5662
try:
5763
print("doing requests.get()")
@@ -71,6 +77,7 @@ def show_update_info(self):
7177
print("Changelog:",changelog)
7278
self.handle_update_info(version,download_url,changelog)
7379
else:
80+
self.status_label.set_text(f"Error:{response.status_code} while checking\nfile:{infofile}\nat:{url}")
7481
print("Failed to download JSON. Status code:",response.status_code)
7582
# Close response
7683
response.close()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
CURRENT_OS_VERSION="0.1.0"
2+
3+
# Unique string that defines the hardware, used by OSUpdate and the About app
4+
_hardware_id="missing-hardware-info"
5+
6+
defset_hardware_id(value):
7+
global_hardware_id
8+
_hardware_id=value
9+
10+
defget_hardware_id():
11+
return_hardware_id

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp