source: BAORadio/libindi/libindi/drivers/telescope/ieq45driver.h @ 646

Last change on this file since 646 was 646, checked in by frichard, 12 years ago
File size: 10.6 KB
Line 
1/*
2    IEQ45 Driver
3    Copyright (C) 2011 Nacho Mas (mas.ignacio@gmail.com). Only litle changes
4    from lx200basic made it by Jasem Mutlaq (mutlaqja@ikarustech.com)
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
20*/
21
22#ifndef IEQ45DRIVER_H
23#define IEQ45DRIVER_H
24
25  /* Slew speeds */
26enum TSlew { IEQ45_SLEW_MAX, IEQ45_SLEW_FIND, IEQ45_SLEW_CENTER, IEQ45_SLEW_GUIDE};
27  /* Alignment modes */
28enum TAlign {  IEQ45_ALIGN_POLAR, IEQ45_ALIGN_ALTAZ, IEQ45_ALIGN_LAND };
29  /* Directions */
30enum TDirection { IEQ45_NORTH, IEQ45_WEST, IEQ45_EAST, IEQ45_SOUTH, IEQ45_ALL};
31  /* Formats of Right ascention and Declenation */
32enum TFormat { IEQ45_SHORT_FORMAT, IEQ45_LONG_FORMAT};
33  /* Time Format */
34enum TTimeFormat { IEQ45_24, IEQ45_AM, IEQ45_PM};
35  /* Focus operation */
36enum TFocusMotion { IEQ45_FOCUSIN, IEQ45_FOCUSOUT };
37enum TFocusSpeed  { IEQ45_HALTFOCUS = 0, IEQ45_FOCUSSLOW, IEQ45_FOCUSFAST};
38  /* Library catalogs */
39enum TCatalog { IEQ45_STAR_C, IEQ45_DEEPSKY_C};
40  /* Frequency mode */
41enum StarCatalog { IEQ45_STAR, IEQ45_SAO, IEQ45_GCVS };
42  /* Deep Sky Catalogs */
43enum DeepSkyCatalog { IEQ45_NGC, IEQ45_IC, IEQ45_UGC, IEQ45_CALDWELL, IEQ45_ARP, IEQ45_ABELL, IEQ45_MESSIER_C};
44  /* Mount tracking frequency, in Hz */
45enum TFreq { IEQ45_TRACK_SIDERAL, IEQ45_TRACK_LUNAR, IEQ45_TRACK_SOLAR,IEQ45_TRACK_ZERO};
46
47
48#define MaxReticleDutyCycle             15
49#define MaxFocuserSpeed                 4
50
51/* GET formatted sexagisemal value from device, return as double */
52#define getIEQ45RA(fd, x)                               getCommandSexa(fd, x, ":GR#")           //OK
53#define getIEQ45DEC(fd, x)                              getCommandSexa(fd, x, ":GD#")           //OK
54//#define getObjectRA(fd, x)                            getCommandSexa(fd, x, ":Gr#")           //NO OK
55//#define getObjectDEC(fd, x)                           getCommandSexa(fd, x, ":Gd#")           //NO OK
56//#define getLocalTime12(fd, x)                         getCommandSexa(fd, x, ":Ga#")           //NO OK
57#define getLocalTime24(fd, x)                           getCommandSexa(fd, x, ":GL#")           //OK
58#define getSDTime(fd, x)                                getCommandSexa(fd, x, ":GS#")           //OK
59#define getIEQ45Alt(fd, x)                              getCommandSexa(fd, x, ":GA#")           //OK
60#define getIEQ45Az(fd, x)                               getCommandSexa(fd, x, ":GZ#")           //OK
61
62/* GET String from device and store in supplied buffer x */
63//#define getObjectInfo(fd, x)                          getCommandString(fd, x, ":LI#") //NO OK
64//#define getVersionDate(fd, x)                         getCommandString(fd, x, ":GVD#")        //NO OK
65//#define getVersionTime(fd, x)                         getCommandString(fd, x, ":GVT#")        //NO OK
66//#define getFullVersion(fd, x)                         getCommandString(fd, x, ":GVF#")        //NO OK
67//#define getVersionNumber(fd, x)                       getCommandString(fd, x, ":GVN#")        //NO OK
68//#define getProductName(fd, x)                         getCommandString(fd, x, ":GVP#")        //NO OK
69//#define turnGPS_StreamOn(fd)                          getCommandString(fd, x, ":gps#")        //NO OK
70
71/* GET Int from device and store in supplied pointer to integer x */
72#define getUTCOffset(fd, x)                             getCommandInt(fd, x, ":GG#")            //OK
73//#define getMaxElevationLimit(fd, x)                   getCommandInt(fd, x, ":Go#")            //NO OK
74//#define getMinElevationLimit(fd, x)                   getCommandInt(fd, x, ":Gh#")            //NO OK
75
76/* Generic set, x is an integer */
77//#define setReticleDutyFlashCycle(fd, x)                       setCommandInt(fd, x, ":BD")
78#define setReticleFlashRate(fd, x)                      setCommandInt(fd, x, ":B")
79#define setFocuserSpeed(fd, x)                          setCommandInt(fd, x, ":F")
80#define setSlewSpeed(fd, x)                             setCommandInt(fd, x, ":Sw")
81
82/* Set X:Y:Z */
83#define setLocalTime(fd, x,y,z)                         setCommandXYZ(fd, x,y,z, ":SL")
84#define setSDTime(fd, x,y,z)                            setCommandXYZ(fd, x,y,z, ":SS")
85
86/* GPS Specefic */
87#define turnGPSOn(fd)                                   write(fd, ":g+#", 5)
88#define turnGPSOff(fd)                                  write(fd, ":g-#", 5)
89#define alignGPSScope(fd)                               write(fd, ":Aa#", 5)
90#define gpsSleep(fd)                                    write(fd, ":hN#", 5)
91#define gpsWakeUp(fd)                                   write(fd, ":hW#", 5);
92#define gpsRestart(fd)                                  write(fd, ":I#", 4);
93#define updateGPS_System(fd)                            setStandardProcedure(fd, ":gT#")
94#define enableDecAltPec(fd)                             write(fd, ":QA+#", 6)
95#define disableDecAltPec(fd)                            write(fd, ":QA-#", 6)
96#define enableRaAzPec(fd)                               write(fd, ":QZ+#", 6)
97#define disableRaAzPec(fd)                              write(fd, ":QZ-#", 6)
98#define activateAltDecAntiBackSlash(fd)                 write(fd, "$BAdd#", 7)
99#define activateAzRaAntiBackSlash(fd)                   write(fd, "$BZdd#", 7)
100#define SelenographicSync(fd)                           write(fd, ":CL#", 5);
101
102#define slewToAltAz(fd)                                 setStandardProcedure(fd, ":MA#")
103#define toggleTimeFormat(fd)                            write(fd, ":H#", 4)
104#define increaseReticleBrightness(fd)                   write(fd, ":B+#", 5)
105#define decreaseReticleBrightness(fd)                   write(fd, ":B-#", 5)
106#define turnFanOn(fd)                                   write(fd, ":f+#", 5)
107#define turnFanOff(fd)                                  write(fd, ":f-#", 5)
108#define seekHomeAndSave(fd)                             write(fd, ":hS#", 5)
109#define seekHomeAndSet(fd)                              write(fd, ":hF#", 5)
110#define turnFieldDeRotatorOn(fd)                        write(fd, ":r+#", 5)
111#define turnFieldDeRotatorOff(fd)                       write(fd, ":r-#", 5)
112#define slewToPark(fd)                                  write(fd, ":hP#", 5)
113
114
115#ifdef __cplusplus
116extern "C" {
117#endif
118
119/**************************************************************************
120 Basic I/O - OBSELETE
121**************************************************************************/
122/*int openPort(const char *portID);
123int portRead(char *buf, int nbytes, int timeout);
124int portWrite(const char * buf);
125int IEQ45readOut(int timeout);
126int Connect(const char* device);
127void Disconnect();*/
128
129/**************************************************************************
130 Diagnostics
131 **************************************************************************/
132char ACK(int fd);
133/*int testTelescope();
134int testAP();*/
135int check_IEQ45_connection(int fd);
136
137/**************************************************************************
138 Get Commands: store data in the supplied buffer. Return 0 on success or -1 on failure
139 **************************************************************************/
140 
141/* Get Double from Sexagisemal */
142int getCommandSexa(int fd, double *value, const char *cmd);
143/* Get String */
144int getCommandString(int fd, char *data, const char* cmd);
145/* Get Int */
146int getCommandInt(int fd, int *value, const char* cmd);
147/* Get tracking frequency */
148int getTrackFreq(int fd, double * value);
149/* Get site Latitude */
150int getSiteLatitude(int fd, int *dd, int *mm);
151/* Get site Longitude */
152int getSiteLongitude(int fd, int *ddd, int *mm);
153/* Get Calender data */
154int getCalenderDate(int fd, char *date);
155/* Get site Name */
156int getSiteName(int fd, char *siteName, int siteNum);
157/* Get Number of Bars */
158int getNumberOfBars(int fd, int *value);
159/* Get Home Search Status */
160int getHomeSearchStatus(int fd, int *status);
161/* Get OTA Temperature */
162int getOTATemp(int fd, double * value);
163/* Get time format: 12 or 24 */
164int getTimeFormat(int fd, int *format);
165/* Get RA, DEC from Sky Commander controller */
166int updateSkyCommanderCoord(int fd, double *ra, double *dec);
167/* Get RA, DEC from Intelliscope/SkyWizard controllers */
168int updateIntelliscopeCoord (int fd, double *ra, double *dec);
169
170/**************************************************************************
171 Set Commands
172 **************************************************************************/
173
174/* Set Int */
175int setCommandInt(int fd, int data, const char *cmd);
176/* Set Sexigesimal */
177int setCommandXYZ(int fd, int x, int y, int z, const char *cmd);
178/* Common routine for Set commands */
179int setStandardProcedure(int fd, char * writeData);
180/* Set Slew Mode */
181int setSlewMode(int fd, int slewMode);
182/* Set Alignment mode */
183int setAlignmentMode(int fd, unsigned int alignMode);
184/* Set Object RA */
185int setObjectRA(int fd, double ra);
186/* set Object DEC */
187int setObjectDEC(int fd, double dec);
188/* Set Calender date */
189int setCalenderDate(int fd, int dd, int mm, int yy);
190/* Set UTC offset */
191int setUTCOffset(int fd, double hours);
192/* Set Track Freq */
193int setTrackFreq(int fd, double trackF);
194/* Set current site longitude */
195int setSiteLongitude(int fd, double Long);
196/* Set current site latitude */
197int setSiteLatitude(int fd, double Lat);
198/* Set Object Azimuth */
199int setObjAz(int fd, double az);
200/* Set Object Altitude */
201int setObjAlt(int fd, double alt);
202/* Set site name */
203int setSiteName(int fd, char * siteName, int siteNum);
204/* Set maximum slew rate */
205int setMaxSlewRate(int fd, int slewRate);
206/* Set focuser motion */
207int setFocuserMotion(int fd, int motionType);
208/* SET GPS Focuser raneg (1 to 4) */
209int setGPSFocuserSpeed (int fd, int speed);
210/* Set focuser speed mode */
211int setFocuserSpeedMode (int fd, int speedMode);
212/* Set minimum elevation limit */
213int setMinElevationLimit(int fd, int min);
214/* Set maximum elevation limit */
215int setMaxElevationLimit(int fd, int max);
216
217/**************************************************************************
218 Motion Commands
219 **************************************************************************/
220/* Slew to the selected coordinates */
221int Slew(int fd);
222/* Synchronize to the selected coordinates and return the matching object if any */
223int Sync(int fd, char *matchedObject);
224/* Abort slew in all axes */
225int abortSlew(int fd);
226/* Move into one direction, two valid directions can be stacked */
227int MoveTo(int fd, int direction);
228/* Halt movement in a particular direction */
229int HaltMovement(int fd, int direction);
230/* Select the tracking mode */
231int selectTrackingMode(int fd, int trackMode);
232/* Select Astro-Physics tracking mode */
233int selectAPTrackingMode(int fd, int trackMode);
234/* Send Pulse-Guide command (timed guide move), two valid directions can be stacked */
235int SendPulseCmd(int fd, int direction, int duration_msec);
236
237/**************************************************************************
238 Other Commands
239 **************************************************************************/
240 /* Ensures IEQ45 RA/DEC format is long */
241int checkIEQ45Format(int fd);
242/* Select a site from the IEQ45 controller */
243int selectSite(int fd, int siteNum);
244/* Select a catalog object */
245int selectCatalogObject(int fd, int catalog, int NNNN);
246/* Select a sub catalog */
247int selectSubCatalog(int fd, int catalog, int subCatalog);
248
249#ifdef __cplusplus
250}
251#endif
252
253#endif
Note: See TracBrowser for help on using the repository browser.