|
48 | 48 | _OV5640_CMD_TRIGGER_AUTOFOCUS = const(0x03)
|
49 | 49 | _OV5640_CMD_AUTO_AUTOFOCUS = const(0x04)
|
50 | 50 | _OV5640_CMD_RELEASE_FOCUS = const(0x08)
|
| 51 | +_OV5640_CMD_AF_SET_VCM_STEP = const(0x1A) |
| 52 | +_OV5640_CMD_AF_GET_VCM_STEP = const(0x1B) |
51 | 53 |
|
52 | 54 | _OV5640_CMD_MAIN = const(0x3022)
|
53 | 55 | _OV5640_CMD_ACK = const(0x3023)
|
@@ -493,6 +495,24 @@ def autofocus(self) -> list[int]:
|
493 | 495 | print(f"zones focused: {zone_focus}")
|
494 | 496 | return zone_focus
|
495 | 497 |
|
| 498 | + @property |
| 499 | + def autofocus_vcm_step(self): |
| 500 | + """Get the voice coil motor step location""" |
| 501 | + if not self._send_autofocus_command( |
| 502 | + _OV5640_CMD_AF_GET_VCM_STEP, "get vcm step" |
| 503 | + ): |
| 504 | + return None |
| 505 | + return self.read_camera_register(_OV5640_CMD_PARA4) |
| 506 | + |
| 507 | + @autofocus_vcm_step.setter |
| 508 | + def autofocus_vcm_step(self, step): |
| 509 | + """Get the voice coil motor step location, from 0 to 255""" |
| 510 | + if not 0 <= step <= 255: |
| 511 | + raise RuntimeError("VCM step must be 0 to 255") |
| 512 | + self.write_camera_register(_OV5640_CMD_PARA3, 0x00) |
| 513 | + self.write_camera_register(_OV5640_CMD_PARA4, step) |
| 514 | + self._send_autofocus_command(_OV5640_CMD_AF_SET_VCM_STEP, "set vcm step") |
| 515 | + |
496 | 516 | def select_setting(self, setting_name):
|
497 | 517 | """For the point & shoot camera mode, control what setting is being set"""
|
498 | 518 | self._effect_label.color = 0xFFFFFF
|
|
0 commit comments