Commit 031c8741 authored by vertighel's avatar vertighel
Browse files

astelco: fix park property (READY_STATE) and park setter (READY)

parent 938fff41
Loading
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -380,20 +380,20 @@ class Telescope(OpenTSI):
    def park(self):
        """
        bool or None: The parked state of the telescope.

        Checks Bit 6 of TELESCOPE.MOTION_STATE.
        """

        res = self.get("TELESCOPE.MOTION_STATE")
        res = self.get("TELESCOPE.READY_STATE")
        if self.error:
            return None
        try:
            return bool(int(res) & (1 << 6))
            # return bool(int(res) & (1 << 6))
            return False if int(res) else True
        except (TypeError, ValueError):
            # ValueError for "FAILED 2"
            return None

    @park.setter
    def park(self, b):
    def park(self, b, timeout=90):
        """
        Parks or unparks the telescope.

@@ -404,8 +404,8 @@ class Telescope(OpenTSI):
            - ``False`` to move it to its startup (unparked) position.
        """

        park_val = 1 if b else 0
        self.put("TELESCOPE.PARK", park_val)
        park_val = 0 if b else 1
        self.put("TELESCOPE.READY", park_val)

    @property
    def altaz(self):