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

Commitffb2eb1

Browse files
OSUpdate: improve failed update feedback
1 parent29f316f commitffb2eb1

File tree

1 file changed

+17
-7
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.osupdate/assets

1 file changed

+17
-7
lines changed

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,23 @@ def update_with_lvgl(self, url):
184184
iftotal_size:
185185
self.progress_callback(bytes_written/total_size*100)
186186
response.close()
187-
ifbytes_written>=total_sizeandnotsimulate:# if the update was completely installed
188-
next_partition.set_boot()
189-
importmachine
190-
machine.reset()
191-
# In case it didn't reset:
192-
lv.async_call(lambdal:self.status_label.set_text("Update finished! Please restart."),None)
193-
# self.install_button stays disabled to prevent the user from downloading an update twice
187+
try:
188+
ifbytes_written>=total_size:
189+
ifnotsimulate:# if the update was completely installed
190+
next_partition.set_boot()
191+
importmachine
192+
machine.reset()
193+
# In case it didn't reset:
194+
lv.async_call(lambdal:self.status_label.set_text("Update finished! Please restart."),None)
195+
# self.install_button stays disabled to prevent the user from installing the same update twice
196+
else:
197+
print("This is an OSUpdate simulation, not attempting to restart the device.")
198+
else:
199+
lv.async_call(lambdal:self.status_label.set_text(f"Wrote{bytes_written} <{total_size} so not enough!"),None)
200+
self.install_button.remove_state(lv.STATE.DISABLED)# allow retry
201+
exceptExceptionase:
202+
lv.async_call(lambdal:self.status_label.set_text(f"Update error:{e}"),None)
203+
self.install_button.remove_state(lv.STATE.DISABLED)# allow retry
194204

195205
# Non-class functions:
196206

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp