Commit 75826d0f authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Add reading of switches

parent c34d79b7
......@@ -48,6 +48,9 @@ class telescope():
self.speed_az = None
self.speed_el = None
self.focusbox_pos = None
self.tracking_enabled = None
self.refraction_enabled = None
self.model_enabled = None
__num_instances += 1
......@@ -108,6 +111,8 @@ class telescope():
raise IOError("Error with j2000 read socket")
msg = readable[0].recv(4096).decode("UTF-8")
vals = msg.strip().split()
# Read the sky position
(ra, dec) = (vals[2], vals[3])
self.radec = SkyCoord(ra, dec, frame='icrs')
(setpoint_ra, setpoint_dec) = (vals[0], vals[1])
......@@ -116,6 +121,13 @@ class telescope():
self.setpoint_radec = SkyCoord(setpoint_ra, setpoint_dec, frame='icrs')
except RangeError:
self.setpoint_radec = None
# Read the flags, they look like "enabled=0,refraction=1,dt_model=0"
switches = [kv.split("=") for kv in vals[5].split(",")]
self.tracking_enabled = bool(int(switches[0][1]))
self.refraction_enabled = bool(int(switches[1][1]))
self.model_enabled = bool(int(switches[2][1]))
self._event_j2000.set()
def _readtraces(self, tracehost, traceport):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment