File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -384,9 +384,19 @@ def autofocus_init_from_bitstream(self, firmware: bytes):
384
384
raise RuntimeError (f"Autofocus not supported on { self .camera .sensor_name } " )
385
385
386
386
self .write_camera_register (0x3000 , 0x20 ) # reset autofocus coprocessor
387
+ time .sleep (0.01 )
387
388
388
- for addr , val in enumerate (firmware ):
389
- self .write_camera_register (0x8000 + addr , val )
389
+ arr = bytearray (256 )
390
+ with self ._camera_device as i2c :
391
+ for offset in range (0 , len (firmware ), 254 ):
392
+ num_firmware_bytes = min (254 , len (firmware ) - offset )
393
+ reg = offset + 0x8000
394
+ arr [0 ] = reg >> 8
395
+ arr [1 ] = reg & 0xFF
396
+ arr [2 : 2 + num_firmware_bytes ] = firmware [
397
+ offset : offset + num_firmware_bytes
398
+ ]
399
+ i2c .write (arr , end = 2 + num_firmware_bytes )
390
400
391
401
self .write_camera_list (self ._finalize_firmware_load )
392
402
for _ in range (100 ):
You can’t perform that action at this time.
0 commit comments