Fix preview + miroir : thread continu, grace period, lock gphoto2
- _thread_preview tourne TOUJOURS quand DSLR connecté (plus de condition _preview_actif) → capture_preview() appelé en continu → miroir reste levé - Grace period 15 frames (~500ms) avant de signaler camera_erreur : évite la race condition qui tuait le preview avant la 1ère frame - _preview_gphoto2 protégé par _gp_lock (accès concurrent safe) - surveiller_dslr ne tourne plus quand le DSLR est en mode gphoto2 connecté Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -216,8 +216,9 @@ class Camera:
|
||||
|
||||
def _preview_gphoto2(self) -> bytes | None:
|
||||
try:
|
||||
fichier = self.camera.capture_preview()
|
||||
donnees = bytes(fichier.get_data_and_size())
|
||||
with self._gp_lock:
|
||||
fichier = self.camera.capture_preview()
|
||||
donnees = bytes(fichier.get_data_and_size())
|
||||
img = cv2.imdecode(np.frombuffer(donnees, dtype=np.uint8), cv2.IMREAD_COLOR)
|
||||
if img is not None:
|
||||
h, w = img.shape[:2]
|
||||
|
||||
Reference in New Issue
Block a user