-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathsample_update_firmware.py
More file actions
35 lines (28 loc) · 1.09 KB
/
sample_update_firmware.py
File metadata and controls
35 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Update firmware on the Zivid camera."""
import zivid
def _main() -> None:
app = zivid.Application()
cameras = app.cameras()
if len(cameras) == 0:
raise TimeoutError("No camera found.")
print(f"Found {len(cameras)} camera(s)")
for camera in cameras:
if not zivid.firmware.is_up_to_date(camera):
print("Firmware update required")
print(
f"Updating firmware on camera {camera.info.serial_number}, model name: {camera.info.model_name},"
f" firmware version: {camera.info.firmware_version}"
)
zivid.firmware.update(
camera,
progress_callback=lambda progress, description: print(
f'{progress}% : {description}{("", "...")[progress < 100]}'
),
)
else:
print(
f"Skipping update of camera {camera.info.serial_number}, model name: {camera.info.model_name},"
f" firmware version: {camera.info.firmware_version}"
)
if __name__ == "__main__":
_main()