From 46da0c049be779d6eb98b639422d68aaa8bb1893 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Tue, 31 Dec 2024 11:52:58 +0100 Subject: [PATCH] Update for new filenames --- app/fw_updater.py | 16 ++++++++++++---- app/gui/action_button_panel.py | 3 ++- app/release_checker.py | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/fw_updater.py b/app/fw_updater.py index 8bd2206..6ac6b97 100644 --- a/app/fw_updater.py +++ b/app/fw_updater.py @@ -93,18 +93,26 @@ class FwUpdater: address, os.path.abspath(local_filename), FLASH)) thread.start() - def start_fs_update(self, release_name, address): + def start_fs_update(self, release_name, address, hw_rev): + hw_rev_to_model = { + "REV_B_EPD_2_13": "littlefs_8MB", + "REV_V8_EPD_2_13": "littlefs_16MB", + "REV_A_EPD_2_9": "littlefs_4MB" + } + # Path to the firmware file - local_filename = f"{get_app_data_folder()}/{release_name}_littlefs.bin" + local_filename = f"{get_app_data_folder()}/{release_name}_{hw_rev_to_model.get(hw_rev, "littlefs_4MB")}.bin" self.updatingName = address self.currentlyUpdating = True if self.event_cb is not None: - self.event_cb("Starting WebUI update") + self.event_cb(f"Starting WebUI update {local_filename}") if os.path.exists(os.path.abspath(local_filename)): thread = Thread(target=self.run_fs_update, args=( address, os.path.abspath(local_filename), SPIFFS)) thread.start() - + else: + if self.event_cb is not None: + self.event_cb(f"Firmware file not found: {local_filename}") diff --git a/app/gui/action_button_panel.py b/app/gui/action_button_panel.py index bfbf3a2..34e66e2 100644 --- a/app/gui/action_button_panel.py +++ b/app/gui/action_button_panel.py @@ -80,6 +80,7 @@ class ActionButtonPanel(wx.Panel): selected_index = self.device_list.GetFirstSelected() if selected_index != -1: service_name = self.device_list.GetItemText(selected_index, 0) + hw_rev = self.device_list.GetItemText(selected_index, 3) info = self.listener.services.get(service_name) if self.currentlyUpdating: wx.MessageBox("Please wait, already updating", @@ -89,7 +90,7 @@ class ActionButtonPanel(wx.Panel): if info: address = info.parsed_addresses( )[0] if info.parsed_addresses() else "N/A" - self.parent_frame.fw_updater.start_fs_update(self.parent_frame.releaseChecker.release_name, address) + self.parent_frame.fw_updater.start_fs_update(self.parent_frame.releaseChecker.release_name, address, hw_rev) else: wx.MessageBox( "No service information available for selected device", "Error", wx.ICON_ERROR) diff --git a/app/release_checker.py b/app/release_checker.py index f811c94..64b0f79 100644 --- a/app/release_checker.py +++ b/app/release_checker.py @@ -65,7 +65,7 @@ class ReleaseChecker: "lolin_s3_mini_29epd_firmware.bin", "btclock_v8_213epd_firmware.bin", "btclock_rev_b_213epd_firmware.bin", - "littlefs.bin"] + "littlefs_4MB.bin", "littlefs_8MB.bin", "littlefs_16MB.bin"] asset_urls = [asset['browser_download_url'] for asset in latest_release['assets'] if asset['name'] in filenames_to_download]