diff --git a/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py b/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py index 24e9edcb..cbdcf2e7 100644 --- a/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py +++ b/internal_filesystem/apps/com.micropythonos.doom/assets/doom.py @@ -110,23 +110,19 @@ class Doom(Activity): warning = self.get_file_size_warning(self.bootfile_prefix + self.doomdir + '/' + wad_file) button_text = wad_file + warning button = self.wadlist.add_button(None, button_text) - button.add_event_cb(lambda e, f=wad_file: self.start_wad_file(f), lv.EVENT.CLICKED, None) + button.add_event_cb(lambda e, f=wad_file: TaskManager.create_task(self.start_wad_file(f)), lv.EVENT.CLICKED, None) # If only one WAD file, auto-start it if len(all_wads) == 1: print(f"refresh_wad_list: Only one WAD file found, auto-starting: {all_wads[0]}") - self.start_wad_file(all_wads[0]) + TaskManager.create_task(self.start_wad_file(all_wads[0])) - def start_wad_file(self, wad_file): + async def start_wad_file(self, wad_file): """Start a WAD file (called from list selection or auto-start)""" print(f"start_wad_file: WAD file selected: {wad_file}") wadfile_path = self.bootfile_prefix + self.doomdir + '/' + wad_file # Do it in a separate task so the UI doesn't hang (shows progress, status_label) and the serial console keeps showing prints - TaskManager.create_task(self._start_wad_task(self.bootfile_prefix, self.bootfile_to_write, wadfile_path)) - - async def _start_wad_task(self, bootfile_prefix, bootfile_to_write, wadfile): - """Wrapper to ensure start_wad is called as a coroutine""" - await self.start_wad(bootfile_prefix, bootfile_to_write, wadfile) + await self.start_wad(self.bootfile_prefix, self.bootfile_to_write, wadfile_path) def mkdir(self, dirname): # Would be better to only create it if it doesn't exist