Skip to content

Commit a149641

Browse files
committed
Updated bootloader_config example
1 parent 5e82ca7 commit a149641

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

depthai-core

examples/bootloader/bootloader_config.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,25 @@
3333
if res:
3434
print(f'Found device with name: {info.name}');
3535
with dai.DeviceBootloader(info) as bl:
36-
if read:
37-
print('Current flashed configuration')
38-
print(json.dumps(bl.readConfigData()))
39-
else:
40-
success = None
41-
error = None
42-
if clear:
43-
(success, error) = bl.flashConfigClear()
36+
try:
37+
if read:
38+
print('Current flashed configuration')
39+
print(json.dumps(bl.readConfigData()))
4440
else:
45-
if path == '':
46-
(success, error) = bl.flashConfig(dai.DeviceBootloader.Config())
41+
success = None
42+
error = None
43+
if clear:
44+
(success, error) = bl.flashConfigClear()
4745
else:
48-
(success, error) = bl.flashConfigFile(path)
49-
if success:
50-
print('Successfully flashed bootloader configuration')
51-
else:
52-
print(f'Error flashing bootloader configuration: {error}')
46+
if path == '':
47+
(success, error) = bl.flashConfig(dai.DeviceBootloader.Config())
48+
else:
49+
(success, error) = bl.flashConfigFile(path)
50+
if success:
51+
print('Successfully flashed bootloader configuration')
52+
else:
53+
print(f'Error flashing bootloader configuration: {error}')
54+
except Exception as ex:
55+
print(f'Error accessing config: {ex}')
5356
else:
5457
print('No devices found')

0 commit comments

Comments
 (0)