diff --git a/backend/camera.py b/backend/camera.py index 85bfd69..10d1a49 100644 --- a/backend/camera.py +++ b/backend/camera.py @@ -185,14 +185,6 @@ class Camera: log.error("Camera None pendant capture") self.preview_dslr_ok = False return None - try: - cfg = self.camera.get_config() - vf = cfg.get_child_by_name("viewfinder") - vf.set_value(0) - self.camera.set_config(cfg) - time.sleep(0.2) - except Exception: - pass log.info(f"Déclenchement capture DSLR (tentative {attempt+1}/3)") chemin_camera = self.camera.capture(gp.GP_CAPTURE_IMAGE) fichier_camera = gp.CameraFile() @@ -201,8 +193,7 @@ class Camera: ) tmp_path = str(chemin_dest) + ".tmp" fichier_camera.save(tmp_path) - self.activer_viewfinder() - self._chauffer_liveview() + threading.Thread(target=self._post_capture_warmup, daemon=True).start() from PIL import ImageOps as PILImageOps img = PILImageOps.exif_transpose(PILImage.open(tmp_path)) if img.width > 4000: @@ -225,6 +216,10 @@ class Camera: self.preview_dslr_ok = False return None + def _post_capture_warmup(self): + self.activer_viewfinder() + self._chauffer_liveview() + def _chauffer_liveview(self, tentatives: int = 8, pause: float = 0.15): """Consomme les premieres frames LiveView juste apres la remontee du miroir (souvent en erreur ~1-2s le temps que l'AF/capteur se stabilise), pendant diff --git a/frontend/index.html b/frontend/index.html index 436cc6c..d2b0913 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -917,7 +917,7 @@ - + diff --git a/frontend/js/camera.js b/frontend/js/camera.js index e317987..f1542af 100644 --- a/frontend/js/camera.js +++ b/frontend/js/camera.js @@ -253,7 +253,6 @@ async function lancerCapture() { lancerPreview(); // Miroir live pendant le compte à rebours await compteARebours(); arreterPreview(); - await pause(150); const promesseCapture = apiPost('/api/capturer').catch(() => null); let resultat = await promesseCapture;