Commit 3f228143 authored by vertighel's avatar vertighel
Browse files

stx.py: elimina la race "camera occupata" nel loop di acquisizione

Camera._run_loop chiamava _start() non appena ready==1, ma il buffer
veniva letto solo da un task asincrono separato (_broadcast_loop in
camera.py, poll ogni 0.5s). Se la camera non tornava idle prima del
prossimo _start(), il loop andava in spin di errori "Camera not idle"
dalla seconda immagine in poi.

Ora _run_loop chiama self.download() subito dopo ready==1, prima del
prossimo _start(): il buffer viene consumato in modo sincrono nello
stesso loop che decide quando ritentare, e il FITS viene anche
persistito su disco (serve /panoramic, /tile, /info).
parent 65873401
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -204,6 +204,11 @@ class Camera(STX):
            self._start(self.loop_exposure, 1)
            while self._looping and self.ready != 1:
                time.sleep(0.3)
            if self._looping:
                # Consume the buffer (HTTP readout) synchronously, in the same
                # loop that decides when to retrigger — otherwise the next
                # _start() can fire before the camera has left Reading state.
                self.download()

    def _start(self, duration, imagetype, datetime=None):
        """Trigger an exposure unconditionally (no loop guard).