Skip to content

Commit 1a39a64

Browse files
OSUpdate: simplify
1 parent 0accfa2 commit 1a39a64

File tree

1 file changed

+3
-12
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.osupdate/assets

1 file changed

+3
-12
lines changed

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ def network_changed(self, online):
133133
if self.current_state == UpdateState.IDLE or self.current_state == UpdateState.WAITING_WIFI:
134134
# Was waiting for network, now can check for updates
135135
self.set_state(UpdateState.CHECKING_UPDATE)
136-
self.schedule_show_update_info()
136+
self.show_update_info()
137137
elif self.current_state == UpdateState.ERROR:
138138
# Was in error state (possibly network error), retry now that network is back
139139
print("OSUpdate: Retrying update check after network came back online")
140140
self.set_state(UpdateState.CHECKING_UPDATE)
141-
self.schedule_show_update_info()
141+
self.show_update_info()
142142
elif self.current_state == UpdateState.DOWNLOAD_PAUSED:
143143
# Download was paused, will auto-resume in download thread
144144
pass
@@ -181,15 +181,6 @@ def _get_user_friendly_error(self, error):
181181
else:
182182
return f"An error occurred:\n{str(error)}\n\nPlease try again."
183183

184-
# Show update info with a delay, to ensure ordering of multiple lv.async_call()
185-
def schedule_show_update_info(self):
186-
# Create async task for show_update_info with a delay
187-
async def delayed_show_update_info():
188-
await TaskManager.sleep_ms(150)
189-
await self.show_update_info()
190-
191-
TaskManager.create_task(delayed_show_update_info())
192-
193184
async def show_update_info(self):
194185
hwid = mpos.info.get_hardware_id()
195186

@@ -277,7 +268,7 @@ def check_again_click(self):
277268
print("OSUpdate: Check Again button clicked")
278269
self.check_again_button.add_flag(lv.obj.FLAG.HIDDEN)
279270
self.set_state(UpdateState.CHECKING_UPDATE)
280-
self.schedule_show_update_info()
271+
self.show_update_info()
281272

282273
async def async_progress_callback(self, percent):
283274
"""Async progress callback for DownloadManager.

0 commit comments

Comments
 (0)