Skip to content

Commit 1286b16

Browse files
authored
Merge pull request #879 from luxonis/update_flash_bl
Updated flash_bootlaoder example, so it will try to flash user BL
2 parents 8af147b + c971026 commit 1286b16

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/bootloader/flash_bootloader.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@
5656

5757
# Create a progress callback lambda
5858
progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
59-
60-
print(f"Flashing {blType.name} bootloader...")
6159
startTime = time.monotonic()
62-
(res, message) = bl.flashBootloader(dai.DeviceBootloader.Memory.FLASH, blType, progress)
60+
is_user_bl = bl.isUserBootloaderSupported()
61+
print(f"Flashing {blType.name} {'USER' if is_user_bl else 'FACTORY'} bootloader...")
62+
if is_user_bl:
63+
(res, message) = bl.flashUserBootloader(progress)
64+
else: # Factory bootloader
65+
(res, message) = bl.flashBootloader(dai.DeviceBootloader.Memory.FLASH, blType, progress)
6366
if res:
6467
print("Flashing successful. Took", time.monotonic() - startTime, "seconds")
6568
else:

0 commit comments

Comments
 (0)