00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef TEMMADRIVER_H
00024 #define TEMMADRIVER_H
00025 #define VERSION "Temma indi driver Ver 0.0, fm-2004/10/09"
00026 #if 0
00027 bit definition for M message : slew speed and parameters
00028 #endif
00029 #define HS 0x01
00030 #define RR 0x02
00031 #define RL 0x04
00032 #define DU 0x08
00033 #define DD 0x10
00034 #define EN 0x20
00035 #define BB 0x40
00036 #if 0
00037 (HS|RR|EN|BB)
00038 #endif
00039 #define HRAD (M_PI/12)
00040 #define DEGRAD (M_PI/180)
00041 #define TEMMA_TIMEOUT 1
00042
00043
00044 #define SUCCESS (2)
00045 #define ETIMEOUT (-2)
00046 #define EREAD (-3)
00047 #define EWRITE (-4)
00048 #define ECOMMAND (-5)
00049
00050
00051 #define mydev "Temma"
00052 #define MAIN_GROUP "Main Control"
00053 #define COMM_GROUP "Communication"
00054 #define MOVE_GROUP "Movement Control"
00055 #define DATETIME_GROUP "Date/Time/Location"
00056
00057 #define SLEWSW OnCoordSetS[0].s
00058 #define SYNCSW OnCoordSetS[1].s
00059 #define TRACKSW OnCoordSetS[2].s
00060 #define POWSW (power[0].s==ISS_ON)
00061
00062 #define SLEWRATE 1
00063 #define POLLMS 1000
00064
00065 #define latitude geo[0].value
00066 #define longitude geo[1].value
00067 #define currentUTC UTC[0].value
00068 #define currentLST STime[0].value
00069 #define currentRA eq[0].value
00070 #define currentDec eq[1].value
00071 #define temmaRA eqtem[0].value
00072 #define temmaDec eqtem[1].value
00073
00074
00075 int openPort(const char *portID);
00076 int portRead(char *buf, int nbytes, int timeout);
00077 int portWrite(char * buf);
00078 int TemmareadOut(int timeout);
00079 static void mountInit(void);
00080 void ISGetProperties (const char *dev);
00081 void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
00082 void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
00083 void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
00084 double calcLST(char *strlst);
00085 int TemmaConnect(const char *device) ;
00086 int TemmaDisconnect(void) ;
00087 int set_CometTracking(int RArate, int DECrate);
00088 int TemmaabortSlew(void) ;
00089 int do_TemmaGOTO(void) ;
00090 int extractRA(char *buf);
00091 int extractDEC(char *buf);
00092 int get_TemmaCurrentpos(char *buffer);
00093 int set_TemmaCurrentpos(void) ;
00094 int do_TemmaSLEW(char mode);
00095 int get_TemmaVERSION(char *buffer);
00096 int get_TemmaGOTOstatus(char *buffer);
00097 int get_TemmaBOTHcorrspeed(char *buffer);
00098 int get_TemmaDECcorrspeed(char *buffer);
00099 int set_TemmaDECcorrspeed(char *buffer);
00100 int get_TemmaRAcorrspeed(char *buffer);
00101 int set_TemmaRAcorrspeed(char *buffer);
00102 int get_TemmaLatitude(char *buffer);
00103 int set_TemmaLatitude(char *buffer);
00104 int get_TemmaLST(char *buffer);
00105 int set_TemmaLST(char *buffer);
00106 int set_TemmaStandbyState(int on);
00107 int get_TemmaStandbyState(unsigned char *buffer);
00108 int get_TemmaCometTracking(char *buffer);
00109 int set_TemmaCometTracking(char *buffer);
00110 int set_TemmaSolarRate(void);
00111 int set_TemmaStellarRate(void);
00112 int switch_Temmamountside(void);
00113
00114 static void disconnectMount (void);
00115 static void connectMount (void);
00116 static void readMountcurrentpos (void *);
00117
00118
00119
00120
00121 static ISwitch RAmotor[] = {
00122 {"RUN", "On", ISS_OFF, 0, 0},
00123 {"STOP", "Off", ISS_ON, 0, 0} };
00124
00125 static ISwitchVectorProperty RAmotorSw = {
00126 mydev, "RA motor", "RA motor", MOVE_GROUP, IP_RW, ISR_ATMOST1,
00127 0, IPS_IDLE, RAmotor, NARRAY(RAmotor), "", 0};
00128
00129
00130
00131
00132 static ISwitch trackmode[] = {
00133 {"Sidereal", "Sidereal", ISS_ON, 0, 0},
00134 {"Lunar", "Lunar", ISS_OFF, 0, 0},
00135 {"Comet", "Comet", ISS_OFF, 0, 0}, };
00136
00137 static ISwitchVectorProperty trackmodeSw = {
00138 mydev, "Tracking mode", "Tracking mode", MOVE_GROUP, IP_RW, ISR_1OFMANY,
00139 0, IPS_IDLE, trackmode, NARRAY(trackmode), "", 0};
00140
00141
00142
00143
00144 static ISwitch power[] = {
00145 {"CONNECT", "On", ISS_OFF, 0, 0}, {"DISCONNECT", "Off", ISS_ON, 0, 0}, };
00146
00147 static ISwitchVectorProperty powSw = {
00148 mydev, "CONNECTION", "Connection", MAIN_GROUP, IP_RW, ISR_ATMOST1,
00149 0, IPS_IDLE, power, NARRAY(power), "", 0};
00150
00151
00152
00153
00154 static IText TemmaVersionT[] = {{"VERSION", "Version", 0, 0, 0, 0}};
00155 static ITextVectorProperty TemmaVersion = {
00156 mydev, "VERSION", "Temma version", COMM_GROUP, IP_RO, 0,
00157 IPS_OK, TemmaVersionT, NARRAY(TemmaVersionT), "", 0};
00158
00159
00160
00161
00162
00163 static IText TemmaNoteT[] = {{"Note", "", 0, 0, 0, 0}, {"Feedback", "", 0, 0,0 ,0}};
00164 static ITextVectorProperty TemmaNoteTP = { mydev, "Temma Driver", "", MAIN_GROUP, IP_RO, 0, IPS_OK, TemmaNoteT, NARRAY(TemmaNoteT), "", 0};
00165
00166
00167
00168
00169 static IText PortT[] = {{"PORT", "Port", 0, 0, 0, 0}};
00170 static ITextVectorProperty Port = {
00171 mydev, "DEVICE_PORT", "Ports", COMM_GROUP,
00172 IP_RW, 0, IPS_OK, PortT, NARRAY(PortT), "", 0};
00173
00174
00175
00176
00177 static INumber eq[] = {
00178 {"RA" ,"RA H:M:S" , "%10.6m", 0, 24, 0, 0, 0, 0, 0},
00179 {"DEC", "Dec D:M:S", "%10.6m", -90, 90, 0, 0, 0, 0, 0}
00180 };
00181 static INumberVectorProperty eqNum = {
00182 mydev, "EQUATORIAL_EOD_COORD", "Equatorial JNow",
00183 MAIN_GROUP , IP_RW, 0, IPS_IDLE, eq, NARRAY(eq), "", 0};
00184
00185
00186
00187
00188 static INumber eqtem[] = {
00189 {"RA", "RA H:M:S", "%10.6m", 0, 24, 0, 0, 0, 0, 0},
00190 {"DEC", "Dec D:M:S", "%10.6m", -90, 90, 0, 0, 0, 0, 0}
00191 };
00192 static INumberVectorProperty eqTemma = {
00193 mydev, "Temma", "Mount coordinates",
00194 MAIN_GROUP , IP_RO, 0, IPS_IDLE, eqtem, NARRAY(eqtem), "", 0};
00195
00196
00197
00198 static INumber comet[] = {
00199 {"RAcorrspeed","Comet RA motion arcmin/day","%+5d",-21541,21541,0,0,0,0,0},
00200 {"DECcor rspeed", "Comet DEC motion arcmin/day", "%+4d", -600, 600,0, 0., 0, 0, 0}
00201 };
00202
00203 static INumberVectorProperty cometNum = {
00204 mydev, "COMET_TRACKING", "Comet tracking parameters",
00205 MOVE_GROUP, IP_RW, 0, IPS_IDLE, comet, NARRAY(comet), "", 0};
00206
00207
00208 static INumber UTC[] = {
00209 {"UTC", "UTC", "%10.6m" , 0.,0.,0.,0., 0, 0, 0}};
00210 INumberVectorProperty Time = {
00211 mydev, "TIME", "UTC Time", DATETIME_GROUP,
00212 IP_RW, 0, IPS_IDLE, UTC, NARRAY(UTC), "", 0};
00213
00214 static INumber STime[] = {
00215 {"LST", "Sidereal time", "%10.6m" ,
00216 0.,0.,0.,0., 0, 0, 0}};
00217
00218 INumberVectorProperty SDTime = {
00219 mydev, "SDTIME", "Sidereal Time",
00220 DATETIME_GROUP, IP_RW, 0, IPS_IDLE,
00221 STime, NARRAY(STime), "", 0};
00222
00223 static ISwitch OnCoordSetS[] = {
00224 {"SLEW", "Goto", ISS_OFF, 0, 0 },
00225 {"SYNC", "Sync", ISS_ON, 0 , 0},
00226 {"TRACK", "Track", ISS_OFF, 0, 0 }};
00227
00228 static ISwitchVectorProperty OnCoordSetSw = {
00229 mydev, "ON_COORD_SET", "On Set",
00230 MAIN_GROUP, IP_RW, ISR_1OFMANY, 0,
00231 IPS_IDLE, OnCoordSetS, NARRAY(OnCoordSetS), "", 0};
00232
00233
00234
00235 static ISwitch abortSlewS[] = {
00236 {"ABORT", "Abort", ISS_OFF, 0, 0 }};
00237 static ISwitchVectorProperty abortSlewSw = {
00238 mydev, "ABORT_MOTION", "******* ABORT GOTO *********",
00239 MAIN_GROUP, IP_RW, ISR_1OFMANY, 0, IPS_IDLE,
00240 abortSlewS, NARRAY(abortSlewS), "", 0};
00241
00242
00243 static INumber geo[] = {
00244 {"LAT", "Lat. D:M:S +N", "%10.6m", -90., 90., 0., 0., 0, 0, 0},
00245 {"LONG", "Long. D:M:S +E", "%10.6m", 0., 360., 0., 0., 0, 0, 0} };
00246
00247 static INumberVectorProperty geoNum = {
00248 mydev, "GEOGRAPHIC_COORD", "Geographic Location",
00249 DATETIME_GROUP, IP_RW, 0., IPS_IDLE,
00250 geo, NARRAY(geo), "", 0};
00251
00252 #endif