Instrument Neutral Distributed Interface INDI 2.2.5
celestrongps.h
Go to the documentation of this file.
1/*
2 Celestron GPS
3 Copyright (C) 2003-2017 Jasem Mutlaq ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21/*
22 Version with experimental pulse guide support. GC 04.12.2015
23*/
24
25#pragma once
26
27#include "celestrondriver.h"
28
29#include "indiguiderinterface.h"
30#include "inditelescope.h"
32
34{
35 public:
37
38 virtual const char *getDefaultName() override;
39 virtual bool Handshake() override;
40 virtual bool ReadScopeStatus() override;
41 virtual void ISGetProperties(const char *dev) override;
42 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
43 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
44 virtual bool initProperties() override;
45 virtual bool updateProperties() override;
46
47 virtual bool ISNewText(const char *dev, const char *name, char **texts, char **names, int n) override;
48
49 protected:
50 // Goto, Sync, and Motion
51 virtual bool Goto(double ra, double dec) override;
52 //bool GotoAzAlt(double az, double alt);
53 virtual bool Sync(double ra, double dec) override;
54 virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
55 virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
56 virtual bool Abort() override;
57
58 // Time and Location
59 virtual bool updateLocation(double latitude, double longitude, double elevation) override;
60 virtual bool updateTime(ln_date *utc, double utc_offset) override;
61
62 //GUIDE: guiding functions
63 virtual IPState GuideNorth(uint32_t ms) override;
64 virtual IPState GuideSouth(uint32_t ms) override;
65 virtual IPState GuideEast(uint32_t ms) override;
66 virtual IPState GuideWest(uint32_t ms) override;
67 // these all call this function
68 IPState Guide(CELESTRON_DIRECTION dirn, uint32_t ms);
69
70 // Guide Rate
71 INumber GuideRateN[2]; // 0 to 1 corresponding to 0 to 1.0x sidereal
73
74 uint8_t guideRateRa; // 0 to 255 corresponding to 0 to 100% sidereal
75 uint8_t guideRateDec;
76
77 //GUIDE guideTimerHelper() function
78 static void guideTimerHelperN(void *p);
79 static void guideTimerHelperS(void *p);
80 static void guideTimerHelperW(void *p);
81 static void guideTimerHelperE(void *p);
82 // these all call this function
84
85 void AddGuideTimer(CELESTRON_DIRECTION dirn, int ms);
86
87 // Focus Backlash
88 virtual bool SetFocuserBacklash(int32_t steps) override;
89
90 // Tracking
91 virtual bool SetTrackMode(uint8_t mode) override;
92 virtual bool SetTrackEnabled(bool enabled) override;
93
94 // Parking
95 virtual bool Park() override;
96 virtual bool UnPark() override;
97 virtual bool SetCurrentPark() override;
98 virtual bool SetDefaultPark() override;
99
100 virtual bool saveConfigItems(FILE *fp) override;
101
102 virtual void simulationTriggered(bool enable) override;
103
104 void mountSim();
105
106 //GUIDE variables.
111 //CELESTRON_DIRECTION guide_direction;
112
113 /* Firmware */
116
117 //INumberVectorProperty HorizontalCoordsNP;
118 //INumber HorizontalCoordsN[2];
119
120 //ISwitch TrackS[4];
121 //ISwitchVectorProperty TrackSP;
122
123 // Celestron Track Mode (AltAz, EQ N, EQ S, Ra and Dec)
126
127 //GUIDE Pulse guide switch
128 // ISwitchVectorProperty UsePulseCmdSP;
129 // ISwitch UsePulseCmdS[2];
130
133
134 // PEC - implemented without using the base definition because this doesn't match what is required
135 // shows status and index
138
139 ISwitch PecControlS[4]; // Find Index, Stop, Playback, Record
142
143 // move PEC data from file to mount
146
147 // FocuserInterface
148
149 IPState MoveAbsFocuser (uint32_t targetTicks) override;
150 IPState MoveRelFocuser (FocusDirection dir, uint32_t ticks) override;
151 bool AbortFocuser () override;
152
153 // End FocuserInterface
154
155 private:
156 bool setCelestronTrackMode(CELESTRON_TRACK_MODE mode);
157 bool checkMinVersion(double minVersion, const char *feature, bool debug = false);
158 void checkAlignment();
159
160 double currentRA, currentDEC, currentAZ, currentALT;
161 double targetRA, targetDEC, targetAZ, targetALT;
162
163 CelestronDriver driver;
164 FirmwareInfo fwInfo;
165
166 bool usePreciseCoords {false};
167 // bool usePulseCommand { false };
168 bool canAuxGuide { false};
169
170 //CelestronGuide guider;
171
172 // Last align property
173 ISwitch LastAlignS[1];
174 ISwitchVectorProperty LastAlignSP;
175
176 // DST setting
177 ISwitch DSTSettingS[1];
178 ISwitchVectorProperty DSTSettingSP;
179
180 bool slewToIndex;
181
182 size_t numPecBins = 0;
183
184 bool savePecData();
185
186 // Slew Offsets
187 double SlewOffsetRa = 0.0;
188
189 // focuser
190 // INumber FocusBacklashN[1];
191 // INumberVectorProperty FocusBacklashNP;
192
193 // INumber FocusMinPosN[1];
194 // INumberVectorProperty FocusMinPosNP;
195
196 bool focusBacklashMove; // set if a final move is needed
197 uint32_t focusAbsPosition;
198 bool focusReadLimits();
199 bool focuserIsCalibrated;
200
201 uint32_t focusTrueMax;
202 uint32_t focusTrueMin;
203
204 inline uint32_t focusTrue2Abs(uint32_t truePos) {return focusTrueMax - truePos;}
205 inline uint32_t focusAbs2True(uint32_t absPos) {return focusTrueMax - absPos;}
206
207};
CELESTRON_DIRECTION
CELESTRON_TRACK_MODE
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
ITextVectorProperty PecFileNameTP
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
ISwitch UseHibernateS[2]
IText PecInfoT[2]
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
ISwitchVectorProperty PecControlSP
uint8_t guideRateRa
static void guideTimerHelperE(void *p)
static void guideTimerHelperS(void *p)
virtual bool UnPark() override
Unpark the telescope if already parked.
INumber GuideRateN[2]
ISwitch PecControlS[4]
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
ITextVectorProperty FirmwareTP
void guideTimer(CELESTRON_DIRECTION dirn)
static void guideTimerHelperW(void *p)
IPState Guide(CELESTRON_DIRECTION dirn, uint32_t ms)
void AddGuideTimer(CELESTRON_DIRECTION dirn, int ms)
bool AbortFocuser() override
AbortFocuser all focus motion.
enum CelestronGPS::@340 PecControl
IText FirmwareT[7]
IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
INumberVectorProperty GuideRateNP
virtual const char * getDefaultName() override
ITextVectorProperty PecInfoTP
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool Park() override
Park the telescope to its home position.
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
virtual void simulationTriggered(bool enable) override
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
ISwitchVectorProperty CelestronTrackModeSP
uint8_t guideRateDec
IText PecFileNameT[1]
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
ISwitchVectorProperty UseHibernateSP
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
static void guideTimerHelperN(void *p)
ISwitch CelestronTrackModeS[4]
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool ISNewText(const char *dev, const char *name, char **texts, char **names, int n) override
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
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...
Provides interface to implement focuser functionality.
double ra
double dec
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
INDI_DIR_WE
INDI_DIR_NS
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