Skip to content

Commit 9350d38

Browse files
appstore: use good_stack_size()
1 parent 31c8586 commit 9350d38

File tree

1 file changed

+5
-13
lines changed
  • internal_filesystem/builtin/apps/com.example.appstore/assets

1 file changed

+5
-13
lines changed

internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,7 @@ def create_apps_list():
310310
desc_label.add_event_cb(lambda e, a=app: show_app_detail(a), lv.EVENT.CLICKED, None)
311311
print("create_apps_list app done")
312312
try:
313-
stacksize = 24*1024
314-
import sys
315-
if sys.platform == "esp32":
316-
stacksize = 16*1024
317-
_thread.stack_size(stacksize)
313+
_thread.stack_size(mpos.apps.good_stack_size())
318314
_thread.start_new_thread(download_icons,())
319315
except Exception as e:
320316
print("Could not start thread to download icons: ", e)
@@ -407,14 +403,14 @@ def toggle_install(download_url, fullname):
407403
label_text = install_label.get_text()
408404
if label_text == action_label_install:
409405
try:
410-
_thread.stack_size(12*1024)
406+
_thread.stack_size(mpos.apps.good_stack_size())
411407
_thread.start_new_thread(download_and_unzip, (download_url, f"apps/{fullname}", fullname))
412408
except Exception as e:
413409
print("Could not start download_and_unzip thread: ", e)
414410
elif label_text == action_label_uninstall or label_text == action_label_restore:
415411
print("Uninstalling app....")
416412
try:
417-
_thread.stack_size(12*1024)
413+
_thread.stack_size(mpos.apps.good_stack_size())
418414
_thread.start_new_thread(uninstall_app, (f"apps/{fullname}", fullname))
419415
except Exception as e:
420416
print("Could not start download_and_unzip thread: ", e)
@@ -425,7 +421,7 @@ def update_button_click(download_url, fullname):
425421
update_button.add_flag(lv.obj.FLAG.HIDDEN)
426422
install_button.set_size(lv.pct(100), 40)
427423
try:
428-
_thread.stack_size(12*1024)
424+
_thread.stack_size(mpos.apps.good_stack_size())
429425
_thread.start_new_thread(download_and_unzip, (download_url, f"apps/{fullname}", fullname))
430426
except Exception as e:
431427
print("Could not start download_and_unzip thread: ", e)
@@ -453,10 +449,6 @@ def janitor_cb(timer):
453449
if can_check_network and not network.WLAN(network.STA_IF).isconnected():
454450
please_wait_label.set_text("Error: WiFi is not connected.")
455451
else:
456-
stacksize = 24*1024
457-
import sys
458-
if sys.platform == "esp32":
459-
stacksize = 16*1024
460-
_thread.stack_size(stacksize)
452+
_thread.stack_size(mpos.apps.good_stack_size())
461453
_thread.start_new_thread(download_apps, ("http://demo.lnpiggy.com:2121/apps.json",))
462454

0 commit comments

Comments
 (0)