fix: ignore flash method when checking for firmware files

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-04-15 21:52:32 +02:00
parent 8de7ab7e11
commit cd63034b74
2 changed files with 9 additions and 10 deletions

View File

@@ -20,17 +20,16 @@ from utils.logger import Logger
from utils.system_utils import log_process from utils.system_utils import log_process
def find_firmware_file(method: FlashMethod) -> bool: def find_firmware_file() -> bool:
target = KLIPPER_DIR.joinpath("out") target = KLIPPER_DIR.joinpath("out")
target_exists = target.exists() target_exists = target.exists()
if method is FlashMethod.REGULAR:
f1 = "klipper.elf.hex" f1 = "klipper.elf.hex"
f2 = "klipper.elf" f2 = "klipper.elf"
fw_file_exists = target.joinpath(f1).exists() and target.joinpath(f2).exists() f3 = "klipper.bin"
elif method is FlashMethod.SD_CARD: fw_file_exists = (
fw_file_exists = target.joinpath("klipper.bin").exists() target.joinpath(f1).exists() and target.joinpath(f2).exists()
else: ) or target.joinpath(f3).exists()
raise Exception("Unknown flash method")
return target_exists and fw_file_exists return target_exists and fw_file_exists

View File

@@ -101,7 +101,7 @@ class KlipperFlashMethodMenu(BaseMenu):
self.goto_next_menu() self.goto_next_menu()
def goto_next_menu(self, **kwargs): def goto_next_menu(self, **kwargs):
if find_firmware_file(self.flash_options.flash_method): if find_firmware_file():
KlipperFlashCommandMenu(previous_menu=self.__class__).run() KlipperFlashCommandMenu(previous_menu=self.__class__).run()
else: else:
KlipperNoFirmwareErrorMenu().run() KlipperNoFirmwareErrorMenu().run()