27#include <libnova/transform.h>
29#define LIBRARY_TAB "Library"
40 return "LX200 Classic";
81 IUFillNumber(&ObjectNoN[0],
"ObjectN",
"Number",
"%+03f", 1.0, 1000.0, 1.0, 0);
85 IUFillNumber(&MaxSlewRateN[0],
"RATE",
"Rate",
"%.2f", 2.0, 9.0, 1.0, 9.0);
89 IUFillNumber(&ElevationLimitN[0],
"MIN_ALT",
"Min Alt.",
"%+.2f", -90.0, 90.0, 0.0, 0.0);
90 IUFillNumber(&ElevationLimitN[1],
"MAX_ALT",
"Max Alt",
"%+.2f", -90.0, 90.0, 0.0, 0.0);
158 if (!strcmp(name, ObjectNoNP.name))
160 char object_name[256] = {0};
165 IDSetNumber(&ObjectNoNP,
"Failed to select catalog object.");
187 if (!strcmp(name, MaxSlewRateNP.name))
192 IDSetNumber(&MaxSlewRateNP,
"Error setting maximum slew rate.");
197 MaxSlewRateNP.np[0].value = values[0];
202 if (!strcmp(name, ElevationLimitNP.name))
205 double minAlt = 0, maxAlt = 0;
208 for (nset = i = 0; i <
n; i++)
211 if (altp == &ElevationLimitN[0])
214 nset += minAlt >= -90.0 && minAlt <= 90.0;
216 else if (altp == &ElevationLimitN[1])
219 nset += maxAlt >= -90.0 && maxAlt <= 90.0;
227 IDSetNumber(&ElevationLimitNP,
"Error setting elevation limit.");
232 ElevationLimitNP.np[0].value = minAlt;
233 ElevationLimitNP.np[1].value = maxAlt;
234 ElevationLimitNP.s =
IPS_OK;
241 IDSetNumber(&ElevationLimitNP,
"elevation limit missing or invalid.");
257 if (!strcmp(name, StarCatalogSP.name))
267 currentSubCatalog = index;
275 IDSetSwitch(&StarCatalogSP,
"Catalog unavailable.");
281 if (!strcmp(name, DeepSkyCatalogSP.name))
289 currentCatalog = index;
290 DeepSkyCatalogSP.s =
IPS_OK;
298 currentSubCatalog = index;
299 DeepSkyCatalogSP.s =
IPS_OK;
305 IDSetSwitch(&DeepSkyCatalogSP,
"Catalog unavailable");
313 if (!strcmp(name, SolarSP.name))
350 if (!strcmp(name, UnparkAlignmentSP.name))
353 UnparkAlignmentSP.s =
IPS_OK;
382 char AzStr[16], AltStr[16];
383 fs_sexa(AzStr, parkAz, 2, 3600);
384 fs_sexa(AltStr, parkAlt, 2, 3600);
385 LOGF_DEBUG(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
395 UnparkAlignmentS[curAlignment].s =
ISS_ON;
396 UnparkAlignmentSP.s =
IPS_OK;
410 LOG_INFO(
"Parking is in progress...");
435 char AzStr[16], AltStr[16];
436 fs_sexa(AzStr, parkAz, 2, 3600);
437 fs_sexa(AltStr, parkAlt, 2, 3600);
438 LOGF_DEBUG(
"Syncing to parked coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
441 double parkDEC = 0.0;
456 LOG_ERROR(
"Error setting Unpark RA/Dec.");
460 char syncString[256];
478 char AzStr[16], AltStr[16];
481 LOGF_DEBUG(
"Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
503 static int settling = -1;
505 if (settling >= 0) settling--;
519 LOG_DEBUG(
"Mount Land mode set. Parking completed.");
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
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
TelescopeStatus TrackState
void SetAxis1Park(double value)
SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData....
void SetAxis1ParkDefault(double steps)
SetRAPark Set default RA/AZ parking position.
double GetAxis1Park() const
double GetAxis2Park() const
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
IGeographicCoordinates m_Location
bool InitPark()
InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking...
void SetAxis2Park(double steps)
SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData....
void setMountType(TelescopeMountType type)
setMountType Report the mount type in TELESCOPE_MOUNT_TYPE. Drivers call it when the type is fixed by...
void SetParkDataType(TelescopeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
void SetAxis2ParkDefault(double steps)
SetDEParkDefault Set default DEC/ALT parking position.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool Park() override
Park the telescope to its home position.
bool initProperties() override
Called to initialize basic properties required all the time.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
const char * getDefaultName() override
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
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 ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
ISwitchVectorProperty AlignmentSP
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
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.
INDI::PropertySwitch ParkSP
INDI::PropertyNumber EqNP
INDI::PropertyNumber LocationNP
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[].
Implementations for common driver routines.
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.
INumber * IUFindNumber(const INumberVectorProperty *nvp, const char *name)
Find an INumber member in a number text property.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
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.
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,...)
void IDMessage(const char *dev, const char *fmt,...)
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_DEBUG(fmt,...)
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
int setAlignmentMode(int fd, unsigned int alignMode)
int setMinElevationLimit(int fd, int min)
int setMaxSlewRate(int fd, int slewRate)
int setMaxElevationLimit(int fd, int max)
int setObjectRA(int fd, double ra, bool addSpace)
int selectSubCatalog(int fd, int catalog, int subCatalog)
int setObjectDEC(int fd, double dec, bool addSpace)
int selectCatalogObject(int fd, int catalog, int NNNN)
#define getObjectDEC(fd, x)
#define getObjectInfo(fd, x)
#define getLX200DEC(fd, x)
#define getLX200RA(fd, x)
#define getObjectRA(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.