• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

temmadriver.h

Go to the documentation of this file.
00001 /*
00002     Temma INDI driver
00003     Copyright (C) 2004 Francois Meyer (dulle @ free.fr)
00004     Remi Petitdemange for the temma protocol
00005   Reference site is http://dulle.free.fr/alidade/indi.php
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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   /* high speed */
00030 #define RR 0x02     /* RA right */
00031 #define RL 0x04     /* RA left */
00032 #define DU 0x08     /* DEC up */
00033 #define DD 0x10   /* DEC down */
00034 #define EN 0x20     /* ENC on */
00035 #define BB 0x40     /* Allways set */
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       /* FD timeout in seconds */
00042 
00043     /* error codes */
00044 #define SUCCESS (2) /* return value for successful read */
00045 #define ETIMEOUT (-2)   /* timeout */
00046 #define EREAD (-3)           /* error reading from port */  
00047 #define EWRITE (-4)          /* error writing to port */
00048 #define ECOMMAND (-5) /* unexpected answer */
00049     /* Definitions */
00050 
00051 #define mydev    "Temma"    /* Device name */
00052 #define MAIN_GROUP "Main Control"   /* Group name */
00053 #define COMM_GROUP "Communication"  /* Group name */
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          /* slew rate, degrees/s */
00063 #define POLLMS   1000       /* poll period, ms */
00064 
00065 #define     latitude    geo[0].value    /* scope's current rads. */
00066 #define     longitude   geo[1].value    /* scope's current rads. */
00067 #define     currentUTC  UTC[0].value    /* scope's current rads. */
00068 #define     currentLST  STime[0].value  /* scope's current rads. */
00069 #define     currentRA   eq[0].value /* scope's current RA, rads. */
00070 #define     currentDec  eq[1].value /* scope's current Dec, rads. */
00071 #define     temmaRA eqtem[0].value  /* scope's current RA, rads. */
00072 #define     temmaDec    eqtem[1].value  /* scope's current Dec, rads. */
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 /* RA motor control switch */
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 /* Track mode control switch */
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 /* Power control switch          */
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 /* Temma version text property */
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 /* Driver notes text property */
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 /* Port names text property */
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 /* EQUATORIAL_COORD RW property */
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 /* MOUNT_COORD RO property */
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 /* Traccking correction parameters (i.e. to track comets) */
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 /* Date & Time */
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 /* geographic location */
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

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal