42 #include <libnova/transform.h>
51 #define MAX_LX200AP_PULSE_LEN 999
63 return "AstroPhysics";
69 if (!activeConnection->
name().compare(
"CONNECTION_TCP"))
125 IUFillSwitchVector(&
SwapSP,
SwapS, 2,
getDeviceName(),
"SWAP",
"Swap buttons",
MOTION_TAB,
IP_RW,
ISR_1OFMANY, 0,
131 IUFillSwitchVector(&
SyncCMRSP,
SyncCMRS, 2,
getDeviceName(),
"SYNCCMR",
"Sync",
MOTION_TAB,
IP_RW,
ISR_1OFMANY, 0,
156 IUFillSwitchVector(&
ParkToSP,
ParkToS, 5,
getDeviceName(),
"PARK_TO",
"Park To?",
MAIN_CONTROL_TAB,
IP_RW,
ISR_1OFMANY, 0,
212 if (firmwareVersion <
MCV_G)
232 LOG_WARN(
"No valid park position found or ParkData.xml missing");
252 double longitude = -1000, latitude = -1000;
256 if (longitude != -1000 && latitude != -1000)
279 double parkAz, parkAlt;
280 if (calcParkPosition(parkPos, &parkAlt, &parkAz))
284 LOGF_DEBUG(
"Set park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
288 LOGF_ERROR(
"Unable to set park position %d!!", parkPos);
310 bool LX200AstroPhysics::getFirmwareVersion()
314 char versionString[128];
319 strncpy(versionString,
"VCP4-P01-01", 128);
333 if (strstr(versionString,
"VCP4"))
335 firmwareVersion =
MCV_V;
340 else if (strlen(versionString) == 1 || strlen(versionString) == 2)
344 int typeIndex =
VersionT[0].text[0] -
'D';
348 LOGF_DEBUG(
"Firmware version index: %d", typeIndex);
349 if (firmwareVersion <
MCV_G)
354 strncpy(rev, versionString, 8);
366 LOGF_INFO(
"Servo Box Controller: GTOCP%d.", servoType);
367 LOGF_INFO(
"Firmware Version: '%s' - %s", rev, versionString + 5);
374 bool LX200AstroPhysics::initMount()
378 if (!IsMountInitialized(&mountInitialized))
380 LOG_ERROR(
"Error determining if mount is initialized!");
383 if (!IsMountParked(&mountParked))
389 if (!mountInitialized)
391 LOG_DEBUG(
"Mount is not yet initialized. Initializing it...");
407 mountInitialized =
true;
422 LOGF_ERROR(
"Error setting center (MoveTo) rate (%d).", err);
432 LOGF_ERROR(
"Error setting slew to rate (%d).", err);
463 LOGF_ERROR(
"Error setting UTC offset (%d).", err);
482 bool success =
false;
522 LOG_ERROR(
"Connect first before reading mount's park configuration");
532 LOG_INFO(
"Mount's park configuration already read");
541 LOGF_ERROR(
"Time is %s ok and location is %s ok must be set before mount initialization is invoked.",
553 LOG_DEBUG(
"could not load config data for UnparkFromSP.name");
557 LOG_DEBUG(
"could not load config data for ParkTo.name");
562 LOGF_INFO(
"Driver's config 'Unpark From ?' is set to 'Last Parked': will unpark from Alt=%f Az=%f",
GetAxis2Park(),
572 LOG_WARN(
"Set 'Park To' and 'Unpark From ?' manually and save dirver's config and park data");
580 LOG_WARN(
"No ParkData.xml or parkstatus is false, do a cold start");
610 LOGF_ERROR(
"StartUpSP: Error setting tracking mode (%d).", err);
624 LOGF_ERROR(
"StartUpSP: Error setting move rate (%d).", err);
635 LOGF_ERROR(
"StartUpSP: Error setting slew to rate (%d).", err);
650 char versionString[64];
675 LOGF_ERROR(
"Error swapping buttons (%d).", err);
696 LOGF_ERROR(
"Error setting move to rate (%d).", err);
715 LOGF_ERROR(
"Error setting guiding to rate (%d).", err);
750 LOGF_ERROR(
"Error setting PEC state (%d).", err);
771 double unparkAlt, unparkAz;
772 if (!calcParkPosition(unparkPos, &unparkAlt, &unparkAz))
774 LOG_WARN(
"Error calculating unpark position!");
812 double parkAz, parkAlt;
821 if (calcParkPosition(parkPos, &parkAlt, &parkAz))
825 LOGF_INFO(
"Set predefined park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
829 LOGF_ERROR(
"Unable to set predefined park position %d!!", parkPos);
834 LOG_WARN(
"ISNewSwitch: park custom not yet supported");
856 bool isAPParked =
false;
857 IsMountParked(&isAPParked);
876 LOG_ERROR(
"Reading sidereal time failed %d");
893 double val_utc_offset;
901 LOG_DEBUG(
"Reading local time failed :GL %d");
903 if (firmwareVersion >=
MCV_G)
908 LOG_DEBUG(
"Reading calendar day failed :GC");
924 LOG_DEBUG(
"Reading longitude failed :Gg %d");
942 if (dx == 0 && dy == 0)
945 LOG_INFO(
"Slew is complete. Tracking...");
957 bool slewcomplete =
false;
958 double PARKTHRES = 0.1;
964 LOGF_DEBUG(
"parkStatus: %c slewStatus: %c", parkStatus, slewStatus);
966 if (slewStatus ==
'0')
978 double dx = lastAZ - currentAz;
979 double dy = lastAL - currentAlt;
981 LOGF_DEBUG(
"Parking... currentAz: %g dx: %g currentAlt: %g dy: %g", currentAz, dx, currentAlt, dy);
985 if (slewcomplete && (dx > PARKTHRES || dy > PARKTHRES))
987 LOG_WARN(
"Parking... slew status indicates mount stopped by dx/dy too far from mount - continuing!");
989 slewcomplete =
false;
992 if (slewcomplete || (dx <= PARKTHRES && dy <= PARKTHRES))
994 LOG_DEBUG(
"Parking slew is complete. Asking astrophysics mount to park...");
1007 LOG_INFO(
"Please, disconnect and power off the mount");
1011 lastAL = currentAlt;
1024 bool LX200AstroPhysics::IsMountInitialized(
bool *initialized)
1029 LOG_DEBUG(
"IsMountInitialized I am initialized");
1033 bool raZE, deZE, de90;
1035 double epscheck = 1e-5;
1048 raZE = (fabs(
ra) < epscheck);
1049 deZE = (fabs(
dec) < epscheck);
1050 de90 = (fabs(
dec - 90) < epscheck);
1052 LOGF_DEBUG(
"IsMountInitialized: raZE: %s - deZE: %s - de90: %s, (raZE && deZE): %s, (raZE && de90): %s",
1053 raZE ?
"true" :
"false", deZE ?
"true" :
"false", de90 ?
"true" :
"false", (raZE && deZE) ?
"true" :
"false", (raZE
1054 && de90) ?
"true" :
"false");
1059 if ( (raZE || deZE || de90))
1061 LOG_WARN(
"IsMountInitialized: Mount is not yet initialized.");
1062 *initialized =
false;
1067 LOG_INFO(
"IsMountInitialized: Mount is initialized.");
1068 *initialized =
true;
1070 LOGF_DEBUG(
"IsMountInitialized: Mount is initialized, loc: %s time: %s mount: %s", locationUpdated ?
"true" :
"false",
1071 timeUpdated ?
"true" :
"false", mountInitialized ?
"true" :
"false");
1078 bool LX200AstroPhysics::IsMountParked(
bool *isAPParked)
1091 return getMountStatus(isAPParked);
1093 const struct timespec timeout = {0, 250000000L};
1100 nanosleep(&timeout,
nullptr);
1106 if (fabs(ra1 - ra2) < (1.0 / (15.0 * 3600.0)))
1108 *isAPParked =
false;
1118 LOG_ERROR(
"IsMountParked: park status undefined");
1122 bool LX200AstroPhysics::getMountStatus(
bool *isAPParked)
1131 *isAPParked = (parkStatus ==
'P');
1140 const struct timespec timeout = {0, 100000000L};
1145 char RAStr[64], DecStr[64];
1176 nanosleep(&timeout,
nullptr);
1194 IDSetNumber(&
EqNP,
"Error Slewing to JNow RA %s - DEC %s\n", RAStr, DecStr);
1199 motionCommanded =
true;
1208 LOGF_INFO(
"Slewing to RA: %s - DEC: %s", RAStr, DecStr);
1244 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1256 LOGF_DEBUG(
"GuideNorth using SendPulseCmd() for duration %d", ms);
1262 LOGF_DEBUG(
"GuideNorth using simulated pulse for duration %d", ms);
1264 if (rememberSlewRate == -1)
1287 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1304 LOGF_DEBUG(
"GuideSouth using simulated pulse for duration %d", ms);
1306 if (rememberSlewRate == -1)
1329 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1346 LOGF_DEBUG(
"GuideEast using simulated pulse for duration %d", ms);
1348 if (rememberSlewRate == -1)
1371 LOG_ERROR(
"Cannot pulse guide while manually in motion. Stop first.");
1388 LOGF_DEBUG(
"GuideWest using simulated pulse for duration %d", ms);
1390 if (rememberSlewRate == -1)
1430 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutWE() pulse guide simul = %d", simul);
1448 LOGF_DEBUG(
"AstroPhysicsGuideTimeoutNS() pulse guide simul = %d", simul);
1473 LOG_INFO(
"Simulated Astrophysics is online. Retrieving basic data...");
1474 getFirmwareVersion();
1482 LOGF_ERROR(
"Error clearing the buffer (%d): %s", err, strerror(err));
1491 LOGF_ERROR(
"Error setting back lash compensation (%d): %s.", err, strerror(err));
1500 rc = getFirmwareVersion();
1505 LOG_ERROR(
"Firmware version is not 'V' - too old to use the experimental driver!");
1511 LOG_INFO(
"Firmware level 'V' detected - driver loaded.");
1516 LOG_ERROR(
"Firmware detection failed or is unknown");
1520 if(firmwareVersion ==
MCV_V)
1522 LOG_INFO(
"Firmware level 'V' detected - driver loaded.");
1524 else if(firmwareVersion ==
MCV_D)
1526 LOG_INFO(
"Firmware level 'D' detected - driver loaded.");
1531 LOGF_ERROR(
"Handshake: Error setting tracking mode to zero (%d).", err);
1547 timeUpdated =
false;
1548 locationUpdated =
false;
1549 mountInitialized =
false;
1560 char syncString[256] =
"";
1613 LOG_DEBUG(
"LX200AstroPhysics::updateTime entry");
1616 struct ln_zonedate ltm;
1618 ln_date_to_zonedate(utc, <m, utc_offset * 3600.0);
1620 JD = ln_get_julian_day(utc);
1622 LOGF_DEBUG(
"New JD is %f, local time: %d, %d, %d, utc offset: %f",
JD, ltm.hours, ltm.minutes, (
int)ltm.seconds,
1632 LOGF_DEBUG(
"Set Local Time %02d:%02d:%02d is successful.", ltm.hours, ltm.minutes,
1641 LOGF_DEBUG(
"Set Local Date %02d/%02d/%02d is successful.", ltm.days, ltm.months, ltm.years);
1650 double ap_utc_offset = - utc_offset;
1660 LOGF_DEBUG(
"Set UTC Offset %g as AP UTC Offset %g is successful.", utc_offset, ap_utc_offset);
1667 if (locationUpdated && timeUpdated && !mountInitialized)
1677 LOG_DEBUG(
"LX200AstroPhysics::updateLocation entry");
1679 if ((latitude == 0.) && (longitude == 0.))
1681 LOG_DEBUG(
"updateLocation: latitude, longitude both zero");
1687 LOG_ERROR(
"Error setting site longitude coordinates");
1693 LOG_ERROR(
"Error setting site latitude coordinates");
1698 fs_sexa(l, latitude, 3, 3600);
1699 fs_sexa(L, longitude, 4, 3600);
1701 LOGF_DEBUG(
"Site location updated to Lat %.32s - Long %.32s, deg: %f, %f", l, L, latitude, longitude);
1704 locationUpdated =
true;
1706 if (locationUpdated && timeUpdated && !mountInitialized)
1745 double parkAz {90}, parkAlt {0};
1746 if (calcParkPosition(parkPos, &parkAlt, &parkAz))
1750 LOGF_DEBUG(
"Set park position %d to az=%f alt=%f", parkPos, parkAz, parkAlt);
1754 LOGF_ERROR(
"Unable to set park position %d!!", parkPos);
1757 char AzStr[16] = {0}, AltStr[16] = {0};
1758 fs_sexa(AzStr, parkAz, 2, 3600);
1759 fs_sexa(AltStr, parkAlt, 2, 3600);
1760 LOGF_INFO(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
1775 Goto(equatorialCoords.rightascension, equatorialCoords.declination);
1790 LOGF_ERROR(
"Error Slewing to Az %s - Alt %s", AzStr, AltStr);
1795 motionCommanded =
true;
1803 LOG_INFO(
"Parking is in progress...");
1808 bool LX200AstroPhysics::calcParkPosition(ParkPosition pos,
double *parkAlt,
double *parkAz)
1814 LOG_ERROR(
"Called calcParkPosition with PARK_CUSTOM!");
1822 LOG_INFO(
"Computing PARK1 position...");
1831 LOG_INFO(
"Computing PARK2 position...");
1844 LOG_INFO(
"Computing PARK3 position");
1851 LOG_INFO(
"Computing PARK4 position...");
1861 LOGF_DEBUG(
"calcParkPosition: parkPos=%d parkAlt=%f parkAz=%f", pos, *parkAlt, *parkAz);
1870 bool parkDataValid_and_parked = (parkDataValid &&
isParked());
1871 bool unpark_from_last_config =
false;
1874 double unparkAlt, unparkAz;
1875 if (unpark_from_last_config)
1877 if (parkDataValid_and_parked)
1879 LOG_INFO(
"UnPark: mount is parked, has valid park data and driver config is set to Last Parked");
1885 LOG_ERROR(
"UnPark: Missing unpark position!");
1894 LOGF_DEBUG(
"UnPark: park position = %d from current driver", unparkfromPos);
1895 if (!calcParkPosition(unparkfromPos, &unparkAlt, &unparkAz))
1897 LOG_ERROR(
"UnPark: Error calculating unpark position!");
1902 LOGF_DEBUG(
"UnPark: parkPos=%d parkAlt=%f parkAz=%f", unparkfromPos, unparkAlt, unparkAz);
1912 bool isAPParked =
true;
1915 if (firmwareVersion ==
MCV_D)
1923 if (!IsMountParked(&isAPParked))
1925 LOG_WARN(
"UnPark:could not determine AP park status");
1933 LOG_WARN(
"UnPark: AP mount status: unparked, park first");
1946 LOG_ERROR(
"UnParking AP mount failed.");
1978 char AzStr[16], AltStr[16];
1979 fs_sexa(AzStr, unparkAz, 2, 3600);
1980 fs_sexa(AltStr, unparkAlt, 2, 3600);
1981 char RaStr[16], DecStr[16];
1982 fs_sexa(RaStr, equatorialCoords.rightascension, 2, 3600);
1983 fs_sexa(DecStr, equatorialCoords.declination, 2, 3600);
1989 LOGF_INFO(
"UnPark: Current parking position Az (%s) Alt (%s), HA (%s) RA (%s) Dec (%s)", AzStr, AltStr, HaStr,
1997 bool success =
Sync(equatorialCoords.rightascension, equatorialCoords.declination);
2007 Sync(equatorialPos.rightascension / 15.0, equatorialPos.dec);
2018 char syncString[256];
2039 timeUpdated =
false;
2040 locationUpdated =
false;
2042 if (!IsMountParked(&mountParked))
2053 LOGF_ERROR(
"Error setting center (MoveTo) rate (%d).", err);
2063 LOGF_ERROR(
"Error setting slew to rate (%d).", err);
2070 LOG_DEBUG(
"UnPark: Mount unparked successfully");
2080 double parkAZ = horizontalCoords.azimuth;
2081 double parkAlt = horizontalCoords.altitude;
2083 char AzStr[16], AltStr[16];
2084 fs_sexa(AzStr, parkAZ, 2, 3600);
2085 fs_sexa(AltStr, parkAlt, 2, 3600);
2087 LOGF_DEBUG(
"SetCurrentPark: Setting current parking position to coordinates Az (%s) Alt (%s)", AzStr, AltStr);
2106 void LX200AstroPhysics::syncSideOfPier()
2108 const char *
cmd =
":pS#";
2110 char response[16] = { 0 };
2111 int rc = 0, nbytes_read = 0, nbytes_written = 0;
2115 tcflush(
PortFD, TCIOFLUSH);
2121 LOGF_ERROR(
"Error writing to device %s (%d)", errmsg, rc);
2130 LOGF_ERROR(
"Error reading from device %s (%d)", errmsg, rc);
2134 response[nbytes_read - 1] =
'\0';
2136 tcflush(
PortFD, TCIOFLUSH);
2140 if (!strcmp(response,
"East"))
2142 else if (!strcmp(response,
"West"))
2145 LOGF_ERROR(
"Invalid pier side response from device-> %s", response);
2166 LOGF_DEBUG(
"LX200AstroPhysics::SetTrackMode(%d)", mode);
2172 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2181 LOGF_ERROR(
"Error setting tracking mode (%d).", err);
2192 LOGF_DEBUG(
"LX200AstroPhysics::SetTrackEnabled(%d)", enabled);
2196 LOGF_DEBUG(
"LX200AstroPhysics::SetTrackMode() returned %d", rc);
2245 states[rememberSlewRate] =
ISS_ON;
2250 rememberSlewRate = -1;
2256 motionCommanded =
true;
2268 states[rememberSlewRate] =
ISS_ON;
2273 rememberSlewRate = -1;
2279 motionCommanded =
true;
2292 motionCommanded =
true;
2305 motionCommanded =
true;
The Interface class is the base class for all INDI connection plugins.
virtual std::string name()=0
const char * getDeviceName() const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool Disconnect()
Disconnect from device.
virtual bool loadConfig(bool silent=false, const char *property=nullptr)
Load the last saved configuration file.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
bool isSimulation() const
Connection::Interface * getActiveConnection()
virtual bool Connect()
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
INumberVectorProperty GuideNSNP
INumberVectorProperty GuideWENP
INumberVectorProperty TrackRateNP
TelescopeStatus TrackState
ISwitchVectorProperty TrackStateSP
void SetAxis1Park(double value)
SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData....
ISwitchVectorProperty MovementNSSP
ISwitchVectorProperty AbortSP
void SetAxis1ParkDefault(double steps)
SetRAPark Set default RA/AZ parking position.
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
INumberVectorProperty LocationNP
ITextVectorProperty TimeTP
double GetAxis1Park() const
ISwitchVectorProperty CoordSP
double GetAxis2Park() const
bool isParked()
isParked is mount currently parked?
ISwitchVectorProperty PECStateSP
ISwitchVectorProperty TrackModeSP
ISwitchVectorProperty SlewRateSP
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
INumberVectorProperty EqNP
@ TELESCOPE_HAS_TRACK_RATE
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_CAN_CONTROL_TRACK
const char * LoadParkData()
ISwitchVectorProperty ParkSP
IGeographicCoordinates m_Location
uint32_t GetTelescopeCapability() const
GetTelescopeCapability returns the capability of the Telescope.
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
void setPierSide(TelescopePierSide side)
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
ISwitchVectorProperty MovementWESP
void SetAxis2Park(double steps)
SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData....
void SetAxis2ParkDefault(double steps)
SetDEParkDefault Set default DEC/ALT parking position.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
ISwitchVectorProperty StartUpSP
ISwitchVectorProperty APSlewSpeedSP
virtual bool UnPark() override
Unpark the telescope if already parked.
ISwitchVectorProperty APGuideSpeedSP
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
static void pulseGuideTimeoutHelperWE(void *p)
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
INumber HorizontalCoordsN[2]
ISwitchVectorProperty SwapSP
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
virtual bool Park() override
Park the telescope to its home position.
void AstroPhysicsGuideTimeoutNS(bool simul)
virtual const char * getDefaultName() override
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking 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 IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
bool updateAPSlewRate(int index)
ISwitchVectorProperty UnparkFromSP
virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override
static void simulGuideTimeoutHelperWE(void *p)
static void pulseGuideTimeoutHelperNS(void *p)
ITextVectorProperty VersionTP
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual bool GuideNS(INDI_DIR_NS dir, TelescopeMotionCommand command)
INumber APSiderealTimeN[1]
INumberVectorProperty APUTCOffsetNP
virtual bool Handshake() override
perform handshake with device to check communication
INumberVectorProperty HorizontalCoordsNP
static void simulGuideTimeoutHelperNS(void *p)
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
ISwitchVectorProperty ParkToSP
virtual bool GuideWE(INDI_DIR_WE dir, TelescopeMotionCommand command)
virtual bool getUTFOffset(double *offset) override
virtual bool Disconnect() override
Disconnect from device.
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
INumberVectorProperty APSiderealTimeNP
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
INumber HourangleCoordsN[2]
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.
ISwitchVectorProperty SyncCMRSP
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
void AstroPhysicsGuideTimeoutWE(bool simul)
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
INumberVectorProperty HourangleCoordsNP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
virtual bool SetSlewRate(int index) override
SetSlewRate Set desired slew rate index.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
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...
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual void slewError(int slewCode)
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
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.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
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...
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
@ LX200_HAS_PULSE_GUIDING
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
void setLX200Capability(uint32_t cap)
ISwitchVectorProperty UsePulseCmdSP
const char * GUIDE_TAB
GUIDE_TAB Where all the properties for guiding are located.
const char * MAIN_CONTROL_TAB
MAIN_CONTROL_TAB Where all the primary controls for the device are located.
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
const char * SITE_TAB
SITE_TAB Where all site information setting are located.
void IERmTimer(int timerid)
Remove the timer with the given timerid, as returned from IEAddTimer() or IEAddPeriodicTimer().
int IEAddTimer(int millisecs, IE_TCF *fp, void *p)
Register a new single-shot timer function, fp, to be called with ud as argument after ms.
#define setLocalTime(fd, x, y, z)
int tty_read_section(int fd, char *buf, char stop_char, int timeout, int *nbytes_read)
read buffer from terminal with a delimiter
int tty_write(int fd, const char *buf, int nbytes, int *nbytes_written)
Writes a buffer to fd.
void tty_error_msg(int err_code, char *err_msg, int err_msg_len)
Retrieve the tty error message.
int fs_sexa(char *out, double a, int w, int fracbase)
Converts a sexagesimal number to a string. sprint the variable a in sexagesimal format into out[].
void tty_clr_trailing_read_lf(int enabled)
double get_local_hour_angle(double sideral_time, double ra)
get_local_hour_angle Returns local hour angle of an object
Implementations for common driver routines.
double get_local_sidereal_time(double longitude)
get_local_sidereal_time Returns local sideral time given longitude and system clock.
#define TRACKRATE_SIDEREAL
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
ISwitch * IUFindSwitch(const ISwitchVectorProperty *svp, const char *name)
Find an ISwitch member in a vector switch property.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUGetConfigNumber(const char *dev, const char *property, const char *member, double *value)
IUGetConfigNumber Opens configuration file and reads single number property.
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
#define LOGF_INFO(fmt,...)
#define LOGF_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
#define LOGF_ERROR(fmt,...)
#define MAX_LX200AP_PULSE_LEN
int selectAPMoveToRate(int fd, int moveToIndex)
int setAPUTCOffset(int fd, double hours)
int setAPSiteLatitude(int fd, double Lat)
void set_lx200ap_name(const char *deviceName, unsigned int debug_level)
int setAPRATrackRate(int fd, double rate)
int setAPObjectRA(int fd, double ra)
int APSyncCMR(int fd, char *matchedObject)
int setAPObjectAlt(int fd, double alt)
int swapAPButtons(int fd, int currentSwap)
int setAPObjectDEC(int fd, double dec)
int APSendPulseCmd(int fd, int direction, int duration_msec)
int selectAPCenterRate(int fd, int centerIndex)
int selectAPSlewRate(int fd, int slewIndex)
int check_lx200ap_status(int fd, char *parkStatus, char *slewStatus)
int APUnParkMount(int fd)
int selectAPPECState(int fd, int pecstate)
int selectAPGuideRate(int fd, int guideRate)
int setAPObjectAZ(int fd, double az)
int APSyncCM(int fd, char *matchedObject)
int getAPUTCOffset(int fd, double *value)
int setAPDETrackRate(int fd, double rate)
int setAPSiteLongitude(int fd, double Long)
int selectAPTrackingMode(int fd, int trackMode)
#define setAPBackLashCompensation(fd, x, y, z)
#define getAPVersionNumber(fd, x)
#define setAPClearBuffer(fd)
#define AP_TRACKING_SIDEREAL
int getSiteLongitude(int fd, int *ddd, int *mm, double *ssf)
int checkLX200EquatorialFormat(int fd)
int setCalenderDate(int fd, int dd, int mm, int yy, bool addSpace)
int getCalendarDate(int fd, char *date)
#define getLX200DEC(fd, x)
#define getLX200RA(fd, x)
#define getLX200Alt(fd, x)
#define getLX200Az(fd, x)
#define getLocalTime24(fd, x)
void EquatorialToHorizontal(IEquatorialCoordinates *object, IGeographicCoordinates *observer, double JD, IHorizontalCoordinates *position)
EquatorialToHorizontal Calculate horizontal coordinates from equatorial coordinates.
void HorizontalToEquatorial(IHorizontalCoordinates *object, IGeographicCoordinates *observer, double JD, IEquatorialCoordinates *position)
HorizontalToEquatorial Calculate Equatorial EOD Coordinates from horizontal coordinates.
char device[MAXINDIDEVICE]