Fix capture DSLR: pause avant capture + retry si I/O in progress
- Frontend: arrete le preview 300ms avant la capture - Backend: 3 tentatives avec 500ms entre chaque si DSLR occupe Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -146,6 +146,7 @@ class Camera:
|
||||
return self._capture_simulation(chemin_dest)
|
||||
|
||||
def _capture_gphoto2(self, chemin_dest: Path) -> Path | None:
|
||||
for attempt in range(3):
|
||||
try:
|
||||
chemin_camera = self.camera.capture(gp.GP_CAPTURE_IMAGE)
|
||||
fichier_camera = gp.CameraFile()
|
||||
@@ -156,6 +157,10 @@ class Camera:
|
||||
log.info(f"Photo capturee (DSLR) : {chemin_dest}")
|
||||
return chemin_dest
|
||||
except gp.GPhoto2Error as e:
|
||||
if "I/O in progress" in str(e) and attempt < 2:
|
||||
log.warning(f"DSLR occupe, retry {attempt + 1}/3...")
|
||||
time.sleep(0.5)
|
||||
continue
|
||||
log.error(f"Erreur capture DSLR : {e}")
|
||||
return None
|
||||
|
||||
|
||||
@@ -46,9 +46,11 @@ async function lancerCapture() {
|
||||
}
|
||||
|
||||
await compteARebours();
|
||||
afficherFlash();
|
||||
|
||||
arreterPreview();
|
||||
await pause(300); // Laisser le DSLR se liberer du preview
|
||||
|
||||
afficherFlash();
|
||||
const resultat = await apiPost('/api/capturer');
|
||||
|
||||
if (resultat.erreur) {
|
||||
|
||||
Reference in New Issue
Block a user