Keepalive Canon anti-veille : get_config() toutes les 10s quand preview KO
Quand capture_preview() echoue (I/O error, miroir bloque), le thread preview n'envoyait plus de commande PTP au Canon → l'appareil finissait par s'eteindre via auto power off. Ajoute un keepalive de secours via get_config() qui declenche ptp_canon_eos_keepdeviceon cote libgphoto2. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -330,6 +330,18 @@ class Camera:
|
||||
except Exception as e:
|
||||
log.warning(f"Viewfinder non supporté : {e}")
|
||||
|
||||
def keepalive(self) -> bool:
|
||||
"""Envoie une commande legere au Canon pour empecher l'auto power off.
|
||||
Utilise get_config qui declenche internement ptp_canon_eos_keepdeviceon."""
|
||||
if self.mode != "gphoto2" or not self.connectee or not self.camera:
|
||||
return False
|
||||
try:
|
||||
with self._gp_lock:
|
||||
self.camera.get_config()
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def _preview_gphoto2(self) -> bytes | None:
|
||||
try:
|
||||
with self._gp_lock:
|
||||
|
||||
Reference in New Issue
Block a user