Instrument Neutral Distributed Interface INDI 2.2.5
lx200gemini.h
Go to the documentation of this file.
1/*
2 Losmandy Gemini INDI driver
3
4 Copyright (C) 2017 Jasem Mutlaq
5 Copyright (C) 2018 Eric Vickery
6
7 Difference from LX200 Generic:
8
9 1. Added Side of Pier
10 2. Reimplemented isSlewComplete to use :Gv# since it is more reliable
11
12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Lesser General Public
14 License as published by the Free Software Foundation; either
15 version 2.1 of the License, or (at your option) any later version.
16
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public
23 License along with this library; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25*/
26
27#pragma once
28
29#include "lx200generic.h"
30
32{
33public:
35 ~LX200Gemini() override = default;
36
37 virtual void ISGetProperties(const char *dev) override;
38
39 /* Return True if any property was successfully processed, false otherwise.*/
40 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
41 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
42 virtual bool ISNewText(const char *dev, const char *name, char **texts, char **names, int n) override;
43
44protected:
45 virtual const char *getDefaultName() override;
46
47 virtual bool Connect() override;
48
49 virtual bool initProperties() override ;
50 virtual bool updateProperties() override;
51
52 virtual bool isSlewComplete() override;
53 virtual bool ReadScopeStatus() override;
54
55 virtual bool Park()override ;
56 virtual bool UnPark() override;
57
58 virtual bool SetTrackMode(uint8_t mode) override;
59 virtual bool SetTrackEnabled(bool enabled) override;
60
61 virtual bool checkConnection() override;
62
63 virtual bool saveConfigItems(FILE *fp) override;
64
65 // Guide Pulse Commands
66 virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override;
67 virtual bool Flip(double ra, double dec) override;
68 virtual bool Goto(double ra, double dec) override;
69
70private:
71 void syncState();
72 void syncSideOfPier();
73 bool getRefraction(bool &on);
74 bool getRefractionJNOW(int &data);
75 bool setRefraction(int data);
76 bool setRefraction(bool on);
77 bool sleepMount();
78 bool wakeupMount();
79 bool GotoInternal(double ra, double dec, bool flip);
80 int Flip(int fd);
81 bool getGeminiProperty(uint32_t propertyNumber, char* value);
82 bool setGeminiProperty(uint32_t propertyNumber, char* value);
83
84 // Checksum for private commands
85 uint8_t calculateChecksum(char *cmd);
86
87 INumber ManualSlewingSpeedN[1];
88 INumberVectorProperty ManualSlewingSpeedNP;
89
90 INumber GotoSlewingSpeedN[1];
91 INumberVectorProperty GotoSlewingSpeedNP;
92
93 INumber MoveSpeedN[1];
94 INumberVectorProperty MoveSpeedNP;
95
96 INumber GuidingSpeedBothN[1];
97 INumberVectorProperty GuidingSpeedBothNP;
98
99 INumber GuidingSpeedN[2];
100 INumberVectorProperty GuidingSpeedNP;
101
102 INumber CenteringSpeedN[1];
103 INumberVectorProperty CenteringSpeedNP;
104
105 ISwitch ParkSettingsS[3];
106 ISwitchVectorProperty ParkSettingsSP;
107
108 ITextVectorProperty PECCounterTP;
109 IText PECCounterT[1];
110
111 ISwitchVectorProperty PECControlSP;
112 ISwitch PECControlS[2];
113
114 ITextVectorProperty PECStateTP;
115 IText PECStateT[6] {};
116
117 INumber PECMaxStepsN[1];
118 INumberVectorProperty PECMaxStepsNP;
119
120 ISwitch PECEnableAtBootS[1];
121 ISwitchVectorProperty PECEnableAtBootSP;
122
123 INumber PECGuidingSpeedN[1];
124 INumberVectorProperty PECGuidingSpeedNP;
125
126 ISwitch ServoPrecisionS[2];
127 ISwitchVectorProperty ServoPrecisionSP;
128
129 ISwitch FlipControlS[2];
130 ISwitchVectorProperty FlipControlSP;
131
132 INumber FlipPositionN[2];
133 INumberVectorProperty FlipPositionNP;
134
135 ITextVectorProperty VersionTP;
136 IText VersionT[5] {};
137
138 ISwitch RefractionControlS[1];
139 ISwitchVectorProperty RefractionControlSP;
140
141 ISwitch SetSafetyLimitToCurrentS[1];
142 ISwitchVectorProperty SetSafetyLimitToCurrentSP;
143
144 INumber SafetyLimitsN[3];
145 INumberVectorProperty SafetyLimitsNP;
146
147 float gemini_software_level_;
148
149 enum
150 {
151 EAST_SAFETY,
152 WEST_SAFETY,
153 WEST_GOTO
154 };
155
156 enum
157 {
158 FIRMWARE_DATE,
159 FIRMWARE_TIME,
160 FIRMWARE_LEVEL,
161 FIRMWARE_NAME
162 };
163
164 enum
165 {
166 PARK_HOME,
167 PARK_STARTUP,
168 PARK_ZENITH
169 };
170
171 enum
172 {
173 GUIDING_BOTH,
174 };
175
176 enum
177 {
178 GUIDING_WE,
179 GUIDING_NS
180 };
181
182 enum
183 {
184 PEC_START_TRAINING,
185 PEC_ABORT_TRAINING
186 };
187
188 enum
189 {
190 PEC_STATUS_ACTIVE,
191 PEC_STATUS_FRESH_TRAINED,
192 PEC_STATUS_TRAINING_IN_PROGRESS,
193 PEC_STATUS_TRAINING_COMPLETED,
194 PEC_STATUS_WILL_TRAIN,
195 PEC_STATUS_DATA_AVAILABLE
196 };
197
198 enum
199 {
200 SERVO_RA,
201 SERVO_DEC,
202 };
203
204 ISwitch StartupModeS[3];
205 ISwitchVectorProperty StartupModeSP;
206 enum
207 {
208 COLD_START,
209 WARM_START,
210 WARM_RESTART
211 };
212
213 enum
214 {
215 GEMINI_TRACK_SIDEREAL,
216 GEMINI_TRACK_KING,
217 GEMINI_TRACK_LUNAR,
218 GEMINI_TRACK_SOLAR,
219 GEMINI_TRACK_TERRESTRIAL
220 };
221
222 enum MovementState
223 {
224 NO_MOVEMENT,
225 TRACKING,
226 GUIDING,
227 CENTERING,
228 SLEWING,
229 STALLED
230 };
231
232 enum ParkingState
233 {
234 NOT_PARKED,
235 PARKED,
236 PARK_IN_PROGRESS
237 };
238
239 enum FlipPointState
240 {
241 FLIP_DISABLED,
242 FLIP_EAST,
243 FLIP_WEST
244 };
245
246 enum ServoPrecisionState
247 {
248 PRECISION_DISABLED,
249 RA_PRECISION_ENABLED,
250 DEC_PRECISION_ENABLED
251 };
252
253 enum FlipPointControl
254 {
255 FLIP_EAST_CONTROL,
256 FLIP_WEST_CONTROL
257 };
258
259 enum FlipPointValue
260 {
261 FLIP_EAST_VALUE,
262 FLIP_WEST_VALUE
263 };
264
265 const uint8_t GEMINI_TIMEOUT = 3;
266
267 void setTrackState(INDI::Telescope::TelescopeStatus state);
268 void updateParkingState();
269 void updateMovementState();
270 MovementState getMovementState();
271 ParkingState getParkingState();
272
273 ParkingState priorParkingState = PARK_IN_PROGRESS;
274
275};
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool ISNewText(const char *dev, const char *name, char **texts, char **names, int n) override
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool checkConnection() override
virtual const char * getDefaultName() override
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual bool isSlewComplete() override
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
~LX200Gemini() override=default
virtual bool Flip(double ra, double dec) override
Move and flip the scope to the supplied RA and DEC coordinates.
virtual bool Park() override
Park the telescope to its home position.
double ra
double dec
ISState
Switch state.
Definition indiapi.h:148
int fd
uint8_t cmd[4]
Definition pwc-ioctl.h:2
One number descriptor.
One switch descriptor.
One text descriptor.
Number vector property descriptor.
Definition indiapi.h:317
Switch vector property descriptor.
Definition indiapi.h:365
Text vector property descriptor.
Definition indiapi.h:244