Commit a58773b6 authored by vertighel's avatar vertighel
Browse files

Align atik.Camera interface with stx.Camera



Add all missing methods and properties so both drivers are
interchangeable in the sequencer templates:
- set_window(start_x, start_y, width, height)
- ready, setpoint, fan, ambient, center, xrange, yrange, is_moving

Co-Authored-By: default avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent e1c2c1c5
Loading
Loading
Loading
Loading
Loading
+62 −1
Original line number Diff line number Diff line
@@ -151,6 +151,12 @@ class Camera(BaseDevice):

    # --- Windowing Methods ---

    def set_window(self, start_x, start_y, width, height):
        h = self._check_connection()
        if h:
            self._lib.ArtemisSubframe(h, start_x, start_y, width, height)
            self._subframe = [start_x, start_y, width, height]

    def full_frame(self):
        h = self._check_connection()
        nx, ny = self._props.nPixelsX, self._props.nPixelsY
@@ -248,6 +254,61 @@ class Camera(BaseDevice):
        by = by or 1
        return [(x + w) // bx, (y + h) // by]

    @property
    def ready(self):
        h = self._check_connection()
        if not h: return 0
        return 1 if self._lib.ArtemisImageReady(h) else 0

    @property
    def setpoint(self):
        h = self._check_connection()
        if not h: return None
        flags, level, minl, maxl, setp = [ctypes.c_int() for _ in range(5)]
        self._lib.ArtemisCoolingInfo(h, ctypes.byref(flags), ctypes.byref(level),
                                     ctypes.byref(minl), ctypes.byref(maxl),
                                     ctypes.byref(setp))
        return setp.value / 100.0

    @property
    def fan(self):
        h = self._check_connection()
        if not h: return None
        flags, level, minl, maxl, setp = [ctypes.c_int() for _ in range(5)]
        self._lib.ArtemisCoolingInfo(h, ctypes.byref(flags), ctypes.byref(level),
                                     ctypes.byref(minl), ctypes.byref(maxl),
                                     ctypes.byref(setp))
        return round((level.value / 255.0) * 100) if maxl.value > 0 else 0

    @property
    def ambient(self):
        return None

    @property
    def center(self):
        bx, by = self.binning
        bx = bx or 1
        by = by or 1
        return [self._props.nPixelsX // bx // 2, self._props.nPixelsY // by // 2]

    @property
    def xrange(self):
        x, y, w, h = self._subframe
        bx, by = self.binning
        bx = bx or 1
        return [x // bx, (x + w) // bx]

    @property
    def yrange(self):
        x, y, w, h = self._subframe
        bx, by = self.binning
        by = by or 1
        return [y // by, (y + h) // by]

    @property
    def is_moving(self):
        return 0

    @property
    def max_range(self):
        return [self._props.nPixelsX, self._props.nPixelsY]