Fix firmware path initialization and upload logic in MultiDongle

- Always store firmware paths (scpu_fw_path, ncpu_fw_path) when provided, not just when upload_fw=True
- Restore firmware upload condition to only run when upload_fw=True
- Fix 'MultiDongle' object has no attribute 'scpu_fw_path' error during pipeline initialization
- Ensure firmware paths are available for both upload and non-upload scenarios

This resolves the pipeline deployment error where firmware paths were missing
even when provided to the constructor, causing initialization failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Masonmason 2025-07-16 22:11:42 +08:00
parent e34cdfb856
commit 049dedf2f7

View File

@ -286,11 +286,9 @@ class MultiDongle:
self.upload_fw = upload_fw self.upload_fw = upload_fw
# Check if the firmware is needed # Always store firmware paths when provided
if self.upload_fw: self.scpu_fw_path = scpu_fw_path
self.scpu_fw_path = scpu_fw_path self.ncpu_fw_path = ncpu_fw_path
self.ncpu_fw_path = ncpu_fw_path
self.model_path = model_path self.model_path = model_path
self.device_group = None self.device_group = None
@ -332,16 +330,16 @@ class MultiDongle:
# kp.core.set_timeout(device_group=self.device_group, milliseconds=5000) # kp.core.set_timeout(device_group=self.device_group, milliseconds=5000)
# print(' - Success') # print(' - Success')
# if self.upload_fw: if self.upload_fw:
try: try:
print('[Upload Firmware]') print('[Upload Firmware]')
kp.core.load_firmware_from_file(device_group=self.device_group, kp.core.load_firmware_from_file(device_group=self.device_group,
scpu_fw_path=self.scpu_fw_path, scpu_fw_path=self.scpu_fw_path,
ncpu_fw_path=self.ncpu_fw_path) ncpu_fw_path=self.ncpu_fw_path)
print(' - Success') print(' - Success')
except kp.ApiKPException as exception: except kp.ApiKPException as exception:
print('Error: upload firmware failed, error = \'{}\''.format(str(exception))) print('Error: upload firmware failed, error = \'{}\''.format(str(exception)))
sys.exit(1) sys.exit(1)
# upload model to device # upload model to device
try: try: