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);
156 if (!strcmp(name, ObjectNoNP.
name))
158 char object_name[256] = {0};
163 IDSetNumber(&ObjectNoNP,
"Failed to select catalog object.");
185 if (!strcmp(name, MaxSlewRateNP.
name))
190 IDSetNumber(&MaxSlewRateNP,
"Error setting maximum slew rate.");
195 MaxSlewRateNP.
np[0].value = values[0];
200 if (!strcmp(name, ElevationLimitNP.
name))
203 double minAlt = 0, maxAlt = 0;
206 for (nset = i = 0; i < n; i++)
209 if (altp == &ElevationLimitN[0])
212 nset += minAlt >= -90.0 && minAlt <= 90.0;
214 else if (altp == &ElevationLimitN[1])
217 nset += maxAlt >= -90.0 && maxAlt <= 90.0;
225 IDSetNumber(&ElevationLimitNP,
"Error setting elevation limit.");
230 ElevationLimitNP.
np[0].value = minAlt;
231 ElevationLimitNP.
np[1].value = maxAlt;
239 IDSetNumber(&ElevationLimitNP,
"elevation limit missing or invalid.");
255 if (!strcmp(name, StarCatalogSP.
name))
265 currentSubCatalog = index;
273 IDSetSwitch(&StarCatalogSP,
"Catalog unavailable.");
279 if (!strcmp(name, DeepSkyCatalogSP.
name))
287 currentCatalog = index;
296 currentSubCatalog = index;
303 IDSetSwitch(&DeepSkyCatalogSP,
"Catalog unavailable");
311 if (!strcmp(name, SolarSP.
name))
348 if (!strcmp(name, UnparkAlignmentSP.
name))
380 char AzStr[16], AltStr[16];
381 fs_sexa(AzStr, parkAz, 2, 3600);
382 fs_sexa(AltStr, parkAlt, 2, 3600);
383 LOGF_DEBUG(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
393 UnparkAlignmentS[curAlignment].s =
ISS_ON;
398 if (!
Goto(equatorialCoords.rightascension, equatorialCoords.declination))
407 LOG_INFO(
"Parking is in progress...");
432 char AzStr[16], AltStr[16];
433 fs_sexa(AzStr, parkAz, 2, 3600);
434 fs_sexa(AltStr, parkAlt, 2, 3600);
435 LOGF_DEBUG(
"Syncing to parked coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
438 double parkDEC = 0.0;
453 LOG_ERROR(
"Error setting Unpark RA/Dec.");
457 char syncString[256];
475 char AzStr[16], AltStr[16];
476 fs_sexa(AzStr, horizontalCoords.azimuth, 2, 3600);
477 fs_sexa(AltStr, horizontalCoords.altitude, 2, 3600);
478 LOGF_DEBUG(
"Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr, AltStr);
500 static int settling = -1;
502 if (settling >= 0) settling--;
516 LOG_DEBUG(
"Mount Land mode set. Parking completed.");
const char * getDeviceName() const
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....
INumberVectorProperty EqNP
ISwitchVectorProperty ParkSP
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.
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.
INumber * IUFindNumber(const INumberVectorProperty *nvp, const char *name)
Find an INumber member in a number text property.
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 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.