Update for new filenames

This commit is contained in:
Djuri 2024-12-31 11:52:58 +01:00
parent c820fb9421
commit 46da0c049b
3 changed files with 15 additions and 6 deletions

View file

@ -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}")

View file

@ -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)

View file

@ -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]