5This library is free software;
6you can redistribute it and / or
7modify it under the terms of the GNU Lesser General Public
8License as published by the Free Software Foundation;
10version 2.1 of the License, or (at your option) any later version.
12This library is distributed in the hope that it will be useful,
13 but WITHOUT
ANY WARRANTY;
14without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16Lesser General Public License
for more details.
18You should have received
a copy of the GNU Lesser General Public
19License along with
this library;
20if not, write to the Free Software
21Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
23Version with experimental pulse guide support. GC 04.12.2015
31#include <libnova/transform.h>
48#define FINE_SLEW_RATE 0.1
51#define FINE_SLEW_LIMIT 0.5
53#define MOUNTINFO_TAB "Mount Info"
55static std::unique_ptr<CelestronGPS> telescope(
new CelestronGPS());
62 fwInfo.Version =
"Invalid";
63 fwInfo.controllerVersion = 0;
66 fwInfo.hasFocuser =
false;
81 focusTrueMin = 0xffffffff;
88bool CelestronGPS::checkMinVersion(
double minVersion,
const char *feature,
bool debug)
96 LOGF_DEBUG(
"Firmware v%3.2f does not support %s. Minimum required version is %3.2f",
99 LOGF_WARN(
"Firmware v%3.2f does not support %s. Minimum required version is %3.2f",
109 return "Celestron GPS";
198 IUFillSwitchVector(&DSTSettingSP, DSTSettingS, 1,
getDeviceName(),
"DST_STATE",
"DST",
SITE_TAB,
IP_RW,
ISR_NOFMANY, 60,
245 static bool configLoaded =
false;
254 if (configLoaded ==
false)
267 if (driver.get_firmware(&fwInfo))
274 canAuxGuide = (atof(fwInfo.RAFirmware.c_str()) >= 6.12 && atof(fwInfo.DEFirmware.c_str()) >= 6.12);
280 usePreciseCoords = (checkMinVersion(2.2,
"usePreciseCoords"));
286 fwInfo.Version =
"Invalid";
287 LOG_WARN(
"Failed to retrieve firmware information.");
293 if (checkMinVersion(2.3,
"park"))
296 if (checkMinVersion(4.1,
"sync"))
299 if (checkMinVersion(2.3,
"updating time and location settings"))
307 if (checkMinVersion(2.3,
"track on/off"))
310 LOG_WARN(
"Mount firmware does not support track on off.");
312 if (fwInfo.isGem && checkMinVersion(4.15,
"Pier Side",
true))
315 LOG_WARN(
"Mount firmware does not support getting pier side.");
319 if (checkMinVersion(2.3,
"track mode"))
324 driver.set_sim_track_mode(
CTM_OFF);
326 driver.set_sim_track_mode(
CTM_EQN);
328 if (driver.get_track_mode(&ctm))
332 fwInfo.celestronTrackMode = ctm;
369 if (fwInfo.Version !=
"Invalid")
410 GuideRateN[
AXIS_RA].value = std::min(std::max(
static_cast<double>(rate) / 255.0, 0.0), 1.0);
414 GuideRateN[
AXIS_DE].value = std::min(std::max(
static_cast<double>(rate) / 255.0, 0.0), 1.0);
420 LOG_DEBUG(
"Unable to get guide rates from mount.");
424 LOG_INFO(
"Mount supports guiding.");
427 LOG_INFO(
"Mount does not support guiding. Tracking mode must be set in handset to either EQ-North or EQ-South.");
435 if (checkMinVersion(2.3,
"date and time setting"))
438 int yy, dd, mm, hh, minute, ss;
441 bool precise = fwInfo.controllerVersion >= 5.28;
442 if (driver.get_utc_date_time(&utc_offset, &yy, &mm, &dd, &hh, &minute, &ss, &dst, precise))
444 char isoDateTime[32];
447 snprintf(isoDateTime, 32,
"%04d-%02d-%02dT%02d:%02d:%02d", yy, mm, dd, hh, minute, ss);
448 snprintf(utcOffset, 8,
"%4.2f", utc_offset);
456 LOGF_INFO(
"Mount UTC offset: %s. UTC time: %s. DST: %s", utcOffset, isoDateTime, dst ?
"On" :
"Off");
463 double longitude, latitude;
464 if (driver.get_location(&longitude, &latitude))
470 LOGF_DEBUG(
"Mount latitude %8.4f longitude %8.4f", latitude, longitude);
474 LOG_WARN(
"Mount does not support retrieval of date, time and location.");
479 if (fwInfo.hasHomeIndex)
498 if (fwInfo.hasFocuser)
503 if (focusReadLimits())
514 LOG_INFO(
"Auxiliary focuser is connected.");
516 if (!focuserIsCalibrated)
518 LOG_WARN(
"Focuser not calibrated, moves will not be allowed");
544 if (fwInfo.Version !=
"Invalid")
563 if (driver.slew_radec(targetRA + SlewOffsetRa, targetDEC, usePreciseCoords) ==
false)
565 LOG_ERROR(
"Failed to slew telescope in RA/DEC.");
571 char RAStr[32], DecStr[32];
572 fs_sexa(RAStr, targetRA, 2, 3600);
573 fs_sexa(DecStr, targetDEC, 2, 3600);
574 LOGF_INFO(
"Slewing to JNOW RA %s - DEC %s SlewOffsetRa %4.1f arcsec", RAStr, DecStr, SlewOffsetRa * 3600 * 15);
581 if (!checkMinVersion(4.1,
"sync"))
584 if (driver.sync(
ra,
dec, usePreciseCoords) ==
false)
593 char RAStr[32], DecStr[32];
594 fs_sexa(RAStr, targetRA, 2, 3600);
595 fs_sexa(DecStr, targetDEC, 2, 3600);
596 LOGF_INFO(
"Sync to %s, %s successful.", RAStr, DecStr);
664 if (driver.start_motion(move, rate) ==
false)
666 LOG_ERROR(
"Error setting N/S motion direction.");
674 if (driver.stop_motion(move) ==
false)
695 if (driver.start_motion(move, rate) ==
false)
697 LOG_ERROR(
"Error setting W/E motion direction.");
705 if (driver.stop_motion(move) ==
false)
725 if (driver.get_radec(¤tRA, ¤tDEC, usePreciseCoords) ==
false)
727 LOG_ERROR(
"Failed to read RA/DEC values.");
736 if (driver.get_pier_side(&sop))
743 if (fwInfo.controllerVersion <= 5.24 && fwInfo.controllerVariant !=
ISSTARSENSE)
764 if (currentDEC > 89.999 || currentDEC < -89.999)
771 LOGF_DEBUG(
"latitude %g, sop %c, PierSide %c",
781 if (!driver.indexreached(&atIndex))
793 if (!fwInfo.hasHomeIndex)
796 LOG_WARN(
"This mount does not have index switches, the alignment assumes it is at the index position.");
799 if (!driver.lastalign())
809 if (!driver.check_aligned(&isAligned))
830 if (driver.is_slewing(&slewing) && !slewing)
832 LOG_INFO(
"Slew complete, tracking...");
835 double raoffset = targetRA - currentRA + SlewOffsetRa;
836 if (raoffset > 0.0 || raoffset < 10.0 / 3600.0)
839 SlewOffsetRa = SlewOffsetRa > 0 ? (SlewOffsetRa + raoffset) / 2 : raoffset;
841 LOGF_DEBUG(
"raoffset %4.1f, SlewOffsetRa %4.1f arcsec", raoffset * 3600 * 15, SlewOffsetRa * 3600 * 15);
848 if (driver.is_slewing(&slewing) && !slewing)
850 if (driver.set_track_mode(
CTM_OFF))
860 if (driver.hibernate())
861 LOG_INFO(
"Mount hibernated. Please disconnect now and turn off your mount.");
882 static size_t lastPecIndex = 1000;
883 static size_t numRecordPoints;
889 numPecBins = driver.getPecNumBins();
892 size_t pecIndex = driver.pecIndex();
894 if (pecIndex != lastPecIndex)
896 LOGF_DEBUG(
"PEC state %s, index %d", driver.PecStateStr(), pecIndex);
899 lastPecIndex = pecIndex;
910 if (driver.updatePecState() != lastPecState)
913 LOGF_DEBUG(
"PEC last state %s, new State %s", driver.PecStateStr(lastPecState), driver.PecStateStr());
920 switch (lastPecState)
927 LOG_INFO(
"PEC index Seek completed.");
938 LOGF_DEBUG(
"PEC record stopped, %d records", numRecordPoints);
940 if (numRecordPoints >= numPecBins)
954 lastPecState = driver.pecState;
959 if (fwInfo.hasFocuser)
964 int absPos = focusTrue2Abs(driver.foc_position());
979 if (!driver.foc_moving())
981 if (focusBacklashMove)
983 focusBacklashMove =
false;
984 if (driver.foc_move(focusAbs2True(focusAbsPosition)))
985 LOGF_INFO(
"Focus final move %i", focusAbsPosition);
995 LOG_INFO(
"Focuser reached requested position.");
1040 return driver.abort();
1046 driver.set_port_fd(
PortFD);
1050 driver.set_simulation(
true);
1051 driver.set_sim_slew_rate(
SR_5);
1052 driver.set_sim_ra(0);
1053 driver.set_sim_dec(90);
1056 if (driver.check_connection() ==
false)
1058 LOG_ERROR(
"Failed to communicate with the mount, check the logs for details.");
1073 if (fwInfo.controllerVersion > 0)
1075 if (
UseHibernateS[0].s ==
ISS_ON && (checkMinVersion(4.22,
"hibernation",
true) ==
false))
1096 if (name && std::string(name) == LastAlignSP.name)
1098 if (!fwInfo.hasHomeIndex)
1101 LOG_WARN(
"This mount does not have index switches, make sure that it is at the index position.");
1105 if (!driver.startmovetoindex())
1127 LOG_DEBUG(
" stop PEC record or playback");
1131 if (playback ? driver.PecPlayback(
false) : driver.PecRecord(
false))
1142 LOG_WARN(
"Incorrect state to stop PEC Playback or Record");
1152 if (driver.PecPlayback(
true))
1165 LOG_WARN(
"Incorrect state to start PEC Playback");
1172 LOG_WARN(
"Mount must be Tracking to record PEC");
1177 if (driver.PecRecord(
true))
1190 LOG_WARN(
"Incorrect state to start PEC Recording");
1195 if (driver.isPecAtIndex(
true))
1197 LOG_INFO(
"PEC index already found");
1203 if (driver.PecSeekIndex())
1206 LOG_INFO(
"Seek PEC index started");
1221 if (strstr(name,
"FOCUS"))
1242 if (strcmp(name,
"GUIDE_RATE") == 0)
1247 uint8_t grRa =
static_cast<uint8_t
>(std::min(
GuideRateN[
AXIS_RA].value * 256.0, 255.0));
1248 uint8_t grDec =
static_cast<uint8_t
>(std::min(
GuideRateN[
AXIS_DE].value * 256.0, 255.0));
1254 LOG_WARN(
"Changing guide rates may require recalibration of guiding.");
1268 LOGF_DEBUG(
"ISNewText name %s, text %s, names %s, n %d", name, texts[0], names[0],
n);
1270 if (name && std::string(name) ==
"PEC_LOAD")
1287 if (!pecData.
Save(&driver))
1310 static struct timeval ltv;
1312 double dt, dx, da_ra = 0, da_dec = 0;
1316 gettimeofday(&tv,
nullptr);
1318 if (ltv.tv_sec == 0 && ltv.tv_usec == 0)
1321 dt = tv.tv_sec - ltv.tv_sec + (tv.tv_usec - ltv.tv_usec) / 1e6;
1324 if (fabs(targetRA - currentRA) * 15. >=
GOTO_LIMIT)
1326 else if (fabs(targetRA - currentRA) * 15. >=
SLEW_LIMIT)
1331 if (fabs(targetDEC - currentDEC) >=
GOTO_LIMIT)
1333 else if (fabs(targetDEC - currentDEC) >=
SLEW_LIMIT)
1369 currentDEC += da_dec;
1371 currentDEC -= da_dec;
1382 currentRA += da_ra / 15.;
1384 currentRA -= da_ra / 15.;
1391 driver.set_sim_ra(currentRA);
1392 driver.set_sim_dec(currentDEC);
1404 currentRA =
range24(currentRA);
1412 dx = targetRA - currentRA;
1418 if (fabs(dx) <= da_ra)
1420 currentRA = targetRA;
1424 currentRA += da_ra / 15.;
1426 currentRA -= da_ra / 15.;
1430 else if (currentRA > 24)
1433 dx = targetDEC - currentDEC;
1434 if (fabs(dx) <= da_dec)
1436 currentDEC = targetDEC;
1440 currentDEC += da_dec;
1442 currentDEC -= da_dec;
1446 driver.set_sim_slewing(
false);
1455 driver.set_sim_ra(currentRA);
1456 driver.set_sim_dec(currentDEC);
1461 driver.set_simulation(enable);
1473 LOG_DEBUG(
"updateLocation called before we are connected");
1477 if (!checkMinVersion(2.3,
"updating location"))
1481 if (!driver.check_aligned(&isAligned))
1483 LOG_INFO(
"Update location - check_aligned failed");
1489 LOG_INFO(
"Updating location is not necessary since mount is already aligned.");
1493 LOGF_DEBUG(
"Update location %8.3f, %8.3f, %4.0f", latitude, longitude, elevation);
1495 return driver.set_location(longitude, latitude);
1502 LOG_DEBUG(
"updateTime called before we are connected");
1506 if (!checkMinVersion(2.3,
"updating time"))
1511 if (!driver.check_aligned(&isAligned))
1513 LOG_INFO(
"UpdateTime - check_aligned failed");
1518 LOG_INFO(
"Updating time is not necessary since mount is already aligned.");
1523 bool precise = fwInfo.controllerVersion >= 5.28;
1525 bool dst = DSTSettingS[0].s ==
ISS_ON;
1527 LOGF_DEBUG(
"Update time: offset %f %s UTC %i-%02i-%02iT%02i:%02i:%02.0f", utc_offset, dst ?
"DST" :
"", utc->years,
1528 utc->months, utc->days,
1529 utc->hours, utc->minutes, utc->seconds);
1531 return (driver.set_datetime(utc, utc_offset, dst, precise));
1539 char AzStr[16], AltStr[16];
1540 fs_sexa(AzStr, parkAZ, 2, 3600);
1541 fs_sexa(AltStr, parkAlt, 2, 3600);
1544 if (fwInfo.controllerVersion >= 5.29 && !driver.unsync())
1547 LOGF_DEBUG(
"Parking to Az (%s) Alt (%s)...", AzStr, AltStr);
1549 if (driver.slew_azalt(parkAZ, parkAlt, usePreciseCoords))
1552 LOG_INFO(
"Parking is in progress...");
1570 if (!driver.wakeup())
1572 LOG_ERROR(
"Waking up mount failed! Make sure mount is powered and connected. "
1573 "Hibernate requires firmware version >= 5.21");
1604 if (driver.get_azalt(¤tAZ, ¤tALT, usePreciseCoords) ==
false)
1606 LOG_ERROR(
"Failed to read AZ/ALT values.");
1610 double parkAZ = currentAZ;
1611 double parkAlt = currentALT;
1613 char AzStr[16], AltStr[16];
1614 fs_sexa(AzStr, parkAZ, 2, 3600);
1615 fs_sexa(AltStr, parkAlt, 2, 3600);
1617 LOGF_DEBUG(
"Setting current parking position to coordinates Az (%s) Alt (%s)...", AzStr,
1746 LOGF_DEBUG(
"GUIDE CMD: %c %u ms, %s guide", dc, ms, canAuxGuide ?
"Aux" :
"Time");
1750 LOG_ERROR(
"Cannot guide while moving.");
1757 if (directionProperty.getState() ==
IPS_BUSY)
1760 driver.stop_motion(dirn);
1776 if (driver.send_pulse(dirn, rate,
static_cast<char>(std::min(255, *ticks))) == 0)
1783 ms = ms > 2550 ? 2550 : ms;
1787 directionProperty[index].setState(
ISS_ON);
1855 LOGF_DEBUG(
"guideTimer dir %c, ticks %i, rate %i",
"NSWE"[dirn], *ticks, rate);
1859 if (driver.get_pulse_status(dirn))
1868 int dt = (*ticks > 255) ? 255 : *ticks;
1869 driver.send_pulse(dirn, rate,
static_cast<uint8_t
>(dt));
1878 if (!driver.stop_motion(dirn))
1879 LOGF_ERROR(
"StopMotion failed dir %c",
"NSWE"[dirn]);
1905 LOGF_DEBUG(
"Guide %c finished",
"NSWE"[dirn]);
1935 switch (fwInfo.celestronTrackMode)
1960 return driver.set_track_rate(rate, fwInfo.celestronTrackMode);
1965 return setCelestronTrackMode(enabled ? fwInfo.celestronTrackMode :
CTM_OFF);
1969void CelestronGPS::checkAlignment()
1975 LOG_WARN(
"Mount is NOT aligned. You must align the mount first before you can use it. Disconnect, align the mount, and reconnect again.");
1978bool CelestronGPS::savePecData()
1983 char ts_date[32], ts_time[32];
1989 strftime(ts_date,
sizeof(ts_date),
"%Y-%m-%d", tp);
1990 strftime(ts_time,
sizeof(ts_time),
"%H:%M", tp);
1993 snprintf(dir,
MAXRBUF,
"%s/PEC_Data/%s", getenv(
"HOME"), ts_date);
2002 snprintf(pecFileBuf,
MAXRBUF,
"%s/pecData_%s.csv", dir, ts_time);
2011 if (!pecdata.
Load(&driver))
2013 LOG_DEBUG(
"Load PEC from mount failed");
2018 if (!pecdata.
Save(pecFileBuf))
2020 LOGF_DEBUG(
"Save PEC file %s failed", pecFileBuf);
2023 LOGF_INFO(
"PEC data saved to %s", pecFileBuf);
2030 uint32_t absPosition = targetTicks;
2032 if (!focuserIsCalibrated)
2034 LOG_ERROR(
"Move is not allowed because the focuser is not calibrated");
2039 int delta =
static_cast<int>(targetTicks -
FocusAbsPosNP[0].getValue());
2044 focusBacklashMove =
true;
2045 focusAbsPosition = absPosition;
2049 LOGF_INFO(
"Focus %s move %d", focusBacklashMove ?
"backlash" :
"direct", absPosition);
2051 if(!driver.foc_move(focusAbs2True(absPosition)))
2059 uint32_t newPosition = 0;
2062 newPosition =
static_cast<uint32_t
>(
FocusAbsPosNP[0].getValue()) - ticks;
2064 newPosition =
static_cast<uint32_t
>(
FocusAbsPosNP[0].getValue()) + ticks;
2067 newPosition = std::min(
static_cast<uint32_t
>(
FocusAbsPosNP[0].getMax()), newPosition);
2073 return driver.foc_abort();
2077bool CelestronGPS::focusReadLimits()
2079 int low = 0, high = 0;
2082 focusTrueMax = high;
2097 focuserIsCalibrated = valid;
2099 LOGF_INFO(
"Focus Limits: Maximum (%i) Minimum (%i) steps.", high, low);
@ PEC_SEEKING
The PEC index is being searched for, goes to PEC_INDEXED when found.
@ PEC_AVAILABLE
PEC is available but inactive, can seek index Seek index is only available command.
@ PEC_PLAYBACK
PEC is being played back, stays in this state until stopped equivalent to TelescopePECState PEC_ON.
@ PEC_RECORDING
PEC is being recorded, goes to PEC_INDEXED when completed.
@ PEC_INDEXED
the PEC index has been found, can go to Playback or Recording this is equivalent to TelescopePECState...
bool check_aligned(bool *isAligned)
bool foc_limits(int *low, int *high)
bool set_track_mode(CELESTRON_TRACK_MODE mode)
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
ITextVectorProperty PecFileNameTP
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute 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 bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
ISwitchVectorProperty PecControlSP
static void guideTimerHelperE(void *p)
static void guideTimerHelperS(void *p)
virtual bool UnPark() override
Unpark the telescope if already parked.
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.
ITextVectorProperty FirmwareTP
void guideTimer(CELESTRON_DIRECTION dirn)
static void guideTimerHelperW(void *p)
IPState Guide(CELESTRON_DIRECTION dirn, uint32_t ms)
void AddGuideTimer(CELESTRON_DIRECTION dirn, int ms)
bool AbortFocuser() override
AbortFocuser all focus motion.
IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
INumberVectorProperty GuideRateNP
virtual const char * getDefaultName() override
ITextVectorProperty PecInfoTP
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool SetFocuserBacklash(int32_t steps) override
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool Park() override
Park the telescope to its home position.
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
virtual void simulationTriggered(bool enable) override
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
ISwitchVectorProperty CelestronTrackModeSP
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
ISwitchVectorProperty UseHibernateSP
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
static void guideTimerHelperN(void *p)
ISwitch CelestronTrackModeS[4]
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool ISNewText(const char *dev, const char *name, char **texts, char **names, int n) override
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
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...
Class to provide general functionality of a GPS device.
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
void setDriverInterface(uint32_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
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
void syncDriverInfo()
syncDriverInfo sends the current driver information to the client.
void addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
uint32_t getDriverInterface() const
INDI::PropertyNumber FocusRelPosNP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
void initProperties(const char *groupName)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
INDI::PropertyNumber FocusMaxPosNP
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process focus switch properties.
INDI::PropertyNumber FocusBacklashNP
INDI::PropertyNumber FocusAbsPosNP
INDI::PropertyNumber GuideNSNP
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
INDI::PropertyNumber GuideWENP
void initProperties(const char *groupName)
Initialize guider properties. It is recommended to call this function within initProperties() of your...
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device....
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
int addDebugLevel(const char *debugLevelName, const char *LoggingLevelName)
Adds a new debugging level to the driver.
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.
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
double GetAxis1Park() const
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...
double GetAxis2Park() const
bool isParked()
isParked is mount currently parked?
virtual int AddTrackMode(const char *name, const char *label, bool isDefault=false)
AddTrackMode.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
const char * LoadParkData()
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
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...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
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...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
void SetParkDataType(TelescopeParkData type)
setParkDataType Sets the type of parking data stored in the park data file and presented to the user.
@ TELESCOPE_HAS_PIER_SIDE
@ TELESCOPE_CAN_CONTROL_TRACK
void SetAxis2ParkDefault(double steps)
SetDEParkDefault Set default DEC/ALT parking position.
bool Load(CelestronDriver *driver)
bool Save(const char *filename)
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.
const char * FOCUS_TAB
FOCUS_TAB Where all the properties for focuser are located.
const char * OPTIONS_TAB
OPTIONS_TAB Where all the driver's options are located. Those may include auxiliary controls,...
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.
TelescopePierSide currentPierSide
INDI::PropertySwitch MovementNSSP
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
INDI::PropertySwitch SlewRateSP
INDI::PropertyText TimeTP
INDI::PropertySwitch MovementWESP
INDI::PropertyNumber LocationNP
double range24(double r)
range24 Limits a number to be between 0-24 range.
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.
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.
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 IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector 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,...)
int IUGetConfigSwitch(const char *dev, const char *property, const char *member, ISState *value)
IUGetConfigSwitch Opens configuration file and reads single switch property.
INDI::FocuserInterface FI
*brief user defined string literal for JSON values *sa std::size_t n
#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 TRACKRATE_SIDEREAL
int mkpath(std::string s, mode_t mode)
*brief create JSON pointer *sa reference_tokens const string_t & a