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);
159 if (!strcmp(name, ObjectNoNP.
name))
161 char object_name[256] = {0};
166 IDSetNumber(&ObjectNoNP,
"Failed to select catalog object.");
188 if (!strcmp(name, MaxSlewRateNP.
name))
193 IDSetNumber(&MaxSlewRateNP,
"Error setting maximum slew rate.");
198 MaxSlewRateNP.
np[0].
value = values[0];
203 if (!strcmp(name, ElevationLimitNP.
name))
206 double minAlt = 0, maxAlt = 0;
209 for (nset = i = 0; i < n; i++)
212 if (altp == &ElevationLimitN[0])
215 nset += minAlt >= -90.0 && minAlt <= 90.0;
217 else if (altp == &ElevationLimitN[1])
220 nset += maxAlt >= -90.0 && maxAlt <= 90.0;
228 IDSetNumber(&ElevationLimitNP,
"Error setting elevation limit.");
233 ElevationLimitNP.
np[0].
value = minAlt;
234 ElevationLimitNP.
np[1].
value = maxAlt;
242 IDSetNumber(&ElevationLimitNP,
"elevation limit missing or invalid.");
258 if (!strcmp(name, StarCatalogSP.
name))
268 currentSubCatalog = index;
276 IDSetSwitch(&StarCatalogSP,
"Catalog unavailable.");
282 if (!strcmp(name, DeepSkyCatalogSP.
name))
290 currentCatalog = index;
299 currentSubCatalog = index;
306 IDSetSwitch(&DeepSkyCatalogSP,
"Catalog unavailable");
314 if (!strcmp(name, SolarSP.
name))
351 if (!strcmp(name, UnparkAlignmentSP.
name))
383 char AzStr[16], AltStr[16];
384 fs_sexa(AzStr, parkAz, 2, 3600);
385 fs_sexa(AltStr, parkAlt, 2, 3600);
386 LOGF_DEBUG(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
396 UnparkAlignmentS[curAlignment].s =
ISS_ON;
401 if (!
Goto(equatorialCoords.rightascension, equatorialCoords.declination))
411 LOG_INFO(
"Parking is in progress...");
436 char AzStr[16], AltStr[16];
437 fs_sexa(AzStr, parkAz, 2, 3600);
438 fs_sexa(AltStr, parkAlt, 2, 3600);
439 LOGF_DEBUG(
"Syncing to parked coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
442 double parkDEC = 0.0;
457 LOG_ERROR(
"Error setting Unpark RA/Dec.");
461 char syncString[256];
479 char AzStr[16], AltStr[16];
480 fs_sexa(AzStr, horizontalCoords.azimuth, 2, 3600);
481 fs_sexa(AltStr, horizontalCoords.altitude, 2, 3600);
482 LOGF_DEBUG(
"Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
504 static int settling = -1;
506 if (settling >= 0) settling--;
520 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
void setState(IPState state)
void apply(const char *format,...) const ATTRIBUTE_FORMAT_PRINTF(2
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 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::PropertySwitch MountTypeSP
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,...)
#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.