21 #include <libnova/transform.h>
24 #include <libnova/utility.h>
45 bool FileExists(
const std::string &name)
49 return (stat (name.c_str(), &
buffer) == 0);
52 std::string GetLogTimestamp()
54 time_t Now = time(
nullptr);
59 TimeStruct = *localtime(&Now);
60 strftime(Buffer,
sizeof(Buffer),
"%Y%m%d %H:%M:%S", &TimeStruct);
63 std::chrono::system_clock::time_point NowClock = std::chrono::system_clock::now();
64 std::chrono::system_clock::duration TimePassed = NowClock.time_since_epoch();
66 TimePassed -= std::chrono::duration_cast<std::chrono::seconds>(TimePassed);
67 FinalStr +=
"." +
std::to_string(
static_cast<unsigned>(TimePassed / std::chrono::milliseconds(1)));
79 std::remove(TrackLogFileName.c_str());
85 LogMessage(
"MOVE ABORT");
112 if (!activeConnection->
name().compare(
"CONNECTION_TCP"))
128 RecoverAfterReconnection =
false;
129 DEBUGF(
DBG_SCOPE,
"SkywatcherAltAzSimple::Handshake - Result: %d", Result);
136 return "Skywatcher Alt-Az Wedge";
150 char RAStr[32], DecStr[32];
161 DEBUGF(
DBG_SCOPE,
"New Altitude %lf degrees %ld microsteps Azimuth %lf degrees %ld microsteps",
AltAz.altitude,
163 LogMessage(
"NEW GOTO TARGET: Ra %lf Dec %lf - Alt %lf Az %lf - microsteps %ld %ld",
ra,
dec,
AltAz.altitude,
171 long AltitudeOffsetMicrosteps =
173 long AzimuthOffsetMicrosteps =
176 DEBUGF(
DBG_SCOPE,
"Initial deltas Altitude %ld microsteps Azimuth %ld microsteps", AltitudeOffsetMicrosteps,
177 AzimuthOffsetMicrosteps);
202 DEBUGF(
DBG_SCOPE,
"Altitude offset %ld microsteps Azimuth offset %ld microsteps",
203 AltitudeOffsetMicrosteps, AzimuthOffsetMicrosteps);
223 IDLog(
"SkywatcherAltAzSimple::initProperties\n");
240 IUFillText(&BasicMountInfoT[MOTOR_CONTROL_FIRMWARE_VERSION],
"MOTOR_CONTROL_FIRMWARE_VERSION",
241 "Motor control firmware version",
"-");
242 IUFillText(&BasicMountInfoT[MOUNT_CODE],
"MOUNT_CODE",
"Mount code",
"-");
243 IUFillText(&BasicMountInfoT[MOUNT_NAME],
"MOUNT_NAME",
"Mount name",
"-");
244 IUFillText(&BasicMountInfoT[IS_DC_MOTOR],
"IS_DC_MOTOR",
"Is DC motor",
"-");
246 "Basic mount information", DetailedMountInfoPage,
IP_RO, 60,
IPS_IDLE);
248 IUFillNumber(&AxisOneInfoN[MICROSTEPS_PER_REVOLUTION],
"MICROSTEPS_PER_REVOLUTION",
"Microsteps per revolution",
249 "%.0f", 0, 0xFFFFFF, 1, 0);
250 IUFillNumber(&AxisOneInfoN[STEPPER_CLOCK_FREQUENCY],
"STEPPER_CLOCK_FREQUENCY",
"Stepper clock frequency",
"%.0f", 0,
252 IUFillNumber(&AxisOneInfoN[HIGH_SPEED_RATIO],
"HIGH_SPEED_RATIO",
"High speed ratio",
"%.0f", 0, 0xFFFFFF, 1, 0);
253 IUFillNumber(&AxisOneInfoN[MICROSTEPS_PER_WORM_REVOLUTION],
"MICROSTEPS_PER_WORM_REVOLUTION",
254 "Microsteps per worm revolution",
"%.0f", 0, 0xFFFFFF, 1, 0);
262 IUFillSwitch(&AxisOneStateS[SLEWING_FORWARD],
"SLEWING_FORWARD",
"SLEWING_FORWARD",
ISS_OFF);
264 IUFillSwitch(&AxisOneStateS[NOT_INITIALISED],
"NOT_INITIALISED",
"NOT_INITIALISED",
ISS_ON);
268 IUFillNumber(&AxisTwoInfoN[MICROSTEPS_PER_REVOLUTION],
"MICROSTEPS_PER_REVOLUTION",
"Microsteps per revolution",
269 "%.0f", 0, 0xFFFFFF, 1, 0);
270 IUFillNumber(&AxisTwoInfoN[STEPPER_CLOCK_FREQUENCY],
"STEPPER_CLOCK_FREQUENCY",
"Step timer frequency",
"%.0f", 0,
272 IUFillNumber(&AxisTwoInfoN[HIGH_SPEED_RATIO],
"HIGH_SPEED_RATIO",
"High speed ratio",
"%.0f", 0, 0xFFFFFF, 1, 0);
273 IUFillNumber(&AxisTwoInfoN[MICROSTEPS_PER_WORM_REVOLUTION],
"MICROSTEPS_PER_WORM_REVOLUTION",
274 "Microsteps per worm revolution",
"%.0f", 0, 0xFFFFFF, 1, 0);
282 IUFillSwitch(&AxisTwoStateS[SLEWING_FORWARD],
"SLEWING_FORWARD",
"SLEWING_FORWARD",
ISS_OFF);
284 IUFillSwitch(&AxisTwoStateS[NOT_INITIALISED],
"NOT_INITIALISED",
"NOT_INITIALISED",
ISS_ON);
288 IUFillNumber(&AxisOneEncoderValuesN[RAW_MICROSTEPS],
"RAW_MICROSTEPS",
"Raw Microsteps",
"%.0f", 0, 0xFFFFFF, 1, 0);
289 IUFillNumber(&AxisOneEncoderValuesN[MICROSTEPS_PER_ARCSEC],
"MICROSTEPS_PER_ARCSEC",
"Microsteps/arcsecond",
290 "%.4f", 0, 0xFFFFFF, 1, 0);
291 IUFillNumber(&AxisOneEncoderValuesN[OFFSET_FROM_INITIAL],
"OFFSET_FROM_INITIAL",
"Offset from initial",
"%.0f", 0,
293 IUFillNumber(&AxisOneEncoderValuesN[DEGREES_FROM_INITIAL],
"DEGREES_FROM_INITIAL",
"Degrees from initial",
"%.2f",
294 -1000.0, 1000.0, 1, 0);
297 "Axis 1 Encoder values", DetailedMountInfoPage,
IP_RO, 60,
IPS_IDLE);
299 IUFillNumber(&AxisTwoEncoderValuesN[RAW_MICROSTEPS],
"RAW_MICROSTEPS",
"Raw Microsteps",
"%.0f", 0, 0xFFFFFF, 1, 0);
300 IUFillNumber(&AxisTwoEncoderValuesN[MICROSTEPS_PER_ARCSEC],
"MICROSTEPS_PER_ARCSEC",
"Microsteps/arcsecond",
301 "%.4f", 0, 0xFFFFFF, 1, 0);
302 IUFillNumber(&AxisTwoEncoderValuesN[OFFSET_FROM_INITIAL],
"OFFSET_FROM_INITIAL",
"Offset from initial",
"%.0f", 0,
304 IUFillNumber(&AxisTwoEncoderValuesN[DEGREES_FROM_INITIAL],
"DEGREES_FROM_INITIAL",
"Degrees from initial",
"%.2f",
305 -1000.0, 1000.0, 1, 0);
308 "Axis 2 Encoder values", DetailedMountInfoPage,
IP_RO, 60,
IPS_IDLE);
325 IUFillSwitch(&TrackLogModeS[TRACKLOG_ENABLED],
"TRACKLOG_ENABLED",
"Enable logging",
ISS_OFF);
326 IUFillSwitch(&TrackLogModeS[TRACKLOG_DISABLED],
"TRACKLOG_DISABLED",
"Disabled",
ISS_ON);
331 IUFillNumber(&GuidingRatesN[0],
"GUIDERA_RATE",
"microsteps/seconds (RA)",
"%1.3f", 0.00001, 100000.0, 0.00001, 1.0);
332 IUFillNumber(&GuidingRatesN[1],
"GUIDEDEC_RATE",
"microsteps/seconds (Dec)",
"%1.3f", 0.00001, 100000.0, 0.00001, 1.0);
341 IUFillNumber(&TrackingValuesN[0],
"TRACKING_RATE_ALT",
"rate (Alt)",
"%1.3f", 0.001, 10.0, 0.000001, 0.64);
342 IUFillNumber(&TrackingValuesN[1],
"TRACKING_RATE_AZ",
"rate (Az)",
"%1.3f", 0.001, 10.0, 0.000001, 0.64);
343 IUFillNumber(&TrackingValuesN[2],
"TRACKING_TIMEOUT",
"msec (period)",
"%1.3f", 0.001, 10000.0, 0.000001, 1000.0);
378 IDLog(
"SkywatcherAltAzSimple::ISGetProperties\n");
384 UpdateDetailedMountInformation(
false);
410 char *formats[],
char *names[],
int n)
424 if (strcmp(name,
"GUIDE_RATES") == 0)
433 if (strcmp(name,
"TRACKING_VALUES") == 0)
442 if (strcmp(name,
"EQUATORIAL_EOD_COORD") == 0)
447 for (
int x = 0; x < n; x++)
459 if ((
ra >= 0) && (
ra <= 24) && (
dec >= -90) && (
dec <= 90))
482 LOGF_WARN(
"getSwitch failed for %s", name);
509 if (name && std::string(name) ==
"SCOPE_CONFIG_NAME")
511 UpdateScopeConfigSwitch();
517 void SkywatcherAltAzSimple::UpdateScopeConfigSwitch()
526 XMLEle *RootXmlNode =
nullptr;
527 XMLEle *CurrentXmlNode =
nullptr;
529 bool DeviceFound =
false;
532 RootXmlNode =
readXMLFile(FilePtr, XmlHandle, ErrMsg);
548 while (CurrentXmlNode)
571 XMLEle *XmlNode =
nullptr;
572 XMLEle *DeviceXmlNode = CurrentXmlNode;
573 std::string ConfigName;
575 for (
int i = 1; i < 7; ++i)
595 if (configSwitch !=
nullptr)
604 if (ConfigName.empty())
623 double Rate = *((
double *)Switch->aux);
693 DEBUGF(
DBG_SCOPE,
"GetParkDeltaAz: direction %d - position: %d", (
int)target_direction, (
int)target_position);
699 Result = -CurrentAltAz.
azimuth;
703 Result = 360 - CurrentAltAz.
azimuth;
712 Result = -270 - CurrentAltAz.
azimuth;
714 Result = -CurrentAltAz.
azimuth + 90;
719 Result = 90 - CurrentAltAz.
azimuth;
721 Result = 360 - CurrentAltAz.
azimuth + 90;
730 Result = -180 - CurrentAltAz.
azimuth;
732 Result = -CurrentAltAz.
azimuth + 180;
737 Result = 180 - CurrentAltAz.
azimuth;
739 Result = 360 - CurrentAltAz.
azimuth + 180;
748 Result = -90 - CurrentAltAz.
azimuth;
750 Result = -CurrentAltAz.
azimuth + 270;
755 Result = 270 - CurrentAltAz.
azimuth;
757 Result = 360 - CurrentAltAz.
azimuth + 270;
780 if (
IUFindSwitch(&ParkPositionSP,
"PARK_NORTH") !=
nullptr &&
785 if (
IUFindSwitch(&ParkPositionSP,
"PARK_EAST") !=
nullptr &&
790 if (
IUFindSwitch(&ParkPositionSP,
"PARK_SOUTH") !=
nullptr &&
795 if (
IUFindSwitch(&ParkPositionSP,
"PARK_WEST") !=
nullptr &&
801 if (
IUFindSwitch(&ParkMovementDirectionSP,
"PMD_COUNTERCLOCKWISE") !=
nullptr &&
806 if (
IUFindSwitch(&ParkMovementDirectionSP,
"PMD_CLOCKWISE") !=
nullptr &&
817 DEBUGF(
DBG_SCOPE,
"Parking: Delta altitude %1.2f - delta azimuth %1.2f", DeltaAlt, DeltaAz);
818 DEBUGF(
DBG_SCOPE,
"Parking: Altitude offset %ld microsteps Azimuth offset %ld microsteps",
819 AltitudeOffsetMicrosteps, AzimuthOffsetMicrosteps);
846 if (
IUFindSwitch(&UnparkPositionSP,
"UNPARK_NORTH") !=
nullptr &&
851 if (
IUFindSwitch(&UnparkPositionSP,
"UNPARK_EAST") !=
nullptr &&
856 if (
IUFindSwitch(&UnparkPositionSP,
"UNPARK_SOUTH") !=
nullptr &&
861 if (
IUFindSwitch(&UnparkPositionSP,
"UNPARK_WEST") !=
nullptr &&
868 if (
IUFindSwitch(&ParkMovementDirectionSP,
"PMD_COUNTERCLOCKWISE") !=
nullptr &&
873 if (
IUFindSwitch(&ParkMovementDirectionSP,
"PMD_CLOCKWISE") !=
nullptr &&
880 DeltaAlt = CurrentAltAz.
altitude - 3360;
886 DEBUGF(
DBG_SCOPE,
"Unparking: Delta altitude %1.2f - delta azimuth %1.2f", DeltaAlt, DeltaAz);
887 DEBUGF(
DBG_SCOPE,
"Unparking: Altitude offset %ld microsteps Azimuth offset %ld microsteps",
888 AltitudeOffsetMicrosteps, AzimuthOffsetMicrosteps);
925 if (UpdateCount % 5 == 0)
926 UpdateDetailedMountInformation(
true);
941 if (VerboseScopeStatus)
947 CurrentAltAz =
AltAz;
948 if (VerboseScopeStatus)
956 RaDec = GetRaDecPosition(
AltAz.altitude,
AltAz.azimuth);
957 if (VerboseScopeStatus)
959 DEBUGF(
DBG_SCOPE,
"New RA %lf (hours) DEC %lf (degrees)", RaDec.rightascension, RaDec.declination);
961 LogMessage(
"STATUS: Ra %lf Dec %lf - Alt %lf Az %lf - microsteps %ld %ld", RaDec.rightascension, RaDec.declination,
964 NewRaDec(RaDec.rightascension, RaDec.declination);
965 VerboseScopeStatus =
false;
1001 LogMessage(
"SYNC: Ra %lf Dec %lf",
ra,
dec);
1010 ResetTrackingSeconds =
true;
1019 UpdateDetailedMountInformation(
true);
1026 static bool Slewing =
false;
1027 static bool Tracking =
false;
1028 static int ElapsedTime = 0;
1036 LogMessage(
"SET TIMER: %d msec", TimeoutDuration);
1038 ElapsedTime += TimeoutDuration;
1039 if (ElapsedTime >= 5000)
1042 VerboseScopeStatus =
true;
1051 TrackingStartTimer = 0;
1057 TimeoutDuration = 400;
1060 GuidingPulses.clear();
1063 TrackingStartTimer += TimeoutDuration;
1064 if (TrackingStartTimer < 3000)
1088 TimeoutDuration = (int)
IUFindNumber(&TrackingValuesNP,
"TRACKING_TIMEOUT")->value;
1102 if (ResetTrackingSeconds)
1104 ResetTrackingSeconds =
false;
1110 TrackingMsecs += TimeoutDuration;
1111 if (TrackingMsecs % 60000 == 0)
1124 (
double)TimeoutDuration / 1000);
1134 for (
auto pulse : GuidingPulses)
1136 GuideDeltaAlt += pulse.DeltaAlt;
1137 GuideDeltaAz += pulse.DeltaAz;
1139 GuidingPulses.clear();
1148 AltitudeOffsetMicrosteps = (long)((
float)
IUFindNumber(&GuidingRatesNP,
"GUIDEDEC_RATE")->value * GuideDeltaAlt);
1149 AzimuthOffsetMicrosteps = (long)((
float)
IUFindNumber(&GuidingRatesNP,
"GUIDERA_RATE")->value * GuideDeltaAz);
1153 double DeltaAz = CurrentAltAz.
azimuth - FutureAltAz.azimuth;
1154 double DeltaAlt = CurrentAltAz.
altitude - FutureAltAz.altitude;
1183 AltitudeOffsetMicrosteps = (long)((
double)AltitudeOffsetMicrosteps *
IUFindNumber(&TrackingValuesNP,
1184 "TRACKING_RATE_ALT")->value);
1185 AzimuthOffsetMicrosteps = (long)((
double)AzimuthOffsetMicrosteps *
IUFindNumber(&TrackingValuesNP,
1186 "TRACKING_RATE_AZ")->value);
1188 LogMessage(
"TRACKING: now Alt %lf Az %lf - future Alt %lf Az %lf - microsteps_diff Alt %ld Az %ld",
1189 CurrentAltAz.
altitude, CurrentAltAz.
azimuth, FutureAltAz.altitude, FutureAltAz.azimuth,
1190 AltitudeOffsetMicrosteps, AzimuthOffsetMicrosteps);
1195 if (0 != AzimuthOffsetMicrosteps)
1205 if (0 != AltitudeOffsetMicrosteps)
1215 DEBUGF(
DBG_SCOPE,
"Tracking - AXIS1 error %d (offset: %ld) AXIS2 error %d (offset: %ld)",
1239 TimeoutDuration = 1000;
1242 GuidingPulses.clear();
1254 UpdateDetailedMountInformation(
false);
1311 LogMessage(
"GUIDE NORTH: %1.4f", ms);
1314 GuidingPulses.push_back(Pulse);
1322 LogMessage(
"GUIDE SOUTH: %1.4f", ms);
1325 GuidingPulses.push_back(Pulse);
1333 LogMessage(
"GUIDE WEST: %1.4f", ms);
1336 GuidingPulses.push_back(Pulse);
1344 LogMessage(
"GUIDE EAST: %1.4f", ms);
1347 GuidingPulses.push_back(Pulse);
1353 void SkywatcherAltAzSimple::ResetGuidePulses()
1355 GuidingPulses.clear();
1358 int SkywatcherAltAzSimple::recover_tty_reconnect()
1360 if (!RecoverAfterReconnection && !SerialPortName.empty() && !FileExists(SerialPortName))
1362 RecoverAfterReconnection =
true;
1365 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
1368 RecoverAfterReconnection =
true;
1369 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
1372 RecoverAfterReconnection =
false;
1378 RecoverAfterReconnection =
false;
1387 void SkywatcherAltAzSimple::UpdateDetailedMountInformation(
bool InformClient)
1389 bool BasicMountInfoHasChanged =
false;
1394 BasicMountInfoHasChanged =
true;
1399 BasicMountInfoHasChanged =
true;
1404 BasicMountInfoHasChanged =
true;
1406 if (BasicMountInfoHasChanged && InformClient)
1410 IUSaveText(&BasicMountInfoT[MOUNT_NAME],
"Merlin");
1412 IUSaveText(&BasicMountInfoT[MOUNT_NAME],
"Az Goto");
1414 IUSaveText(&BasicMountInfoT[MOUNT_NAME],
"Dob Goto");
1416 IUSaveText(&BasicMountInfoT[MOUNT_NAME],
"Virtuoso");
1418 IUSaveText(&BasicMountInfoT[MOUNT_NAME],
"AllView Goto");
1420 bool AxisOneInfoHasChanged =
false;
1425 AxisOneInfoHasChanged =
true;
1430 AxisOneInfoHasChanged =
true;
1435 AxisOneInfoHasChanged =
true;
1440 AxisOneInfoHasChanged =
true;
1442 if (AxisOneInfoHasChanged && InformClient)
1445 bool AxisOneStateHasChanged =
false;
1449 AxisOneStateHasChanged =
true;
1454 AxisOneStateHasChanged =
true;
1459 AxisOneStateHasChanged =
true;
1464 AxisOneStateHasChanged =
true;
1469 AxisOneStateHasChanged =
true;
1474 AxisOneStateHasChanged =
true;
1476 if (AxisOneStateHasChanged && InformClient)
1479 bool AxisTwoInfoHasChanged =
false;
1483 AxisTwoInfoHasChanged =
true;
1488 AxisTwoInfoHasChanged =
true;
1493 AxisTwoInfoHasChanged =
true;
1498 AxisTwoInfoHasChanged =
true;
1500 if (AxisTwoInfoHasChanged && InformClient)
1503 bool AxisTwoStateHasChanged =
false;
1507 AxisTwoStateHasChanged =
true;
1512 AxisTwoStateHasChanged =
true;
1517 AxisTwoStateHasChanged =
true;
1522 AxisTwoStateHasChanged =
true;
1527 AxisTwoStateHasChanged =
true;
1532 AxisTwoStateHasChanged =
true;
1534 if (AxisTwoStateHasChanged && InformClient)
1537 bool AxisOneEncoderValuesHasChanged =
false;
1544 AxisOneEncoderValuesN[DEGREES_FROM_INITIAL].value =
1546 AxisOneEncoderValuesHasChanged =
true;
1548 if (AxisOneEncoderValuesHasChanged && InformClient)
1551 bool AxisTwoEncoderValuesHasChanged =
false;
1558 AxisTwoEncoderValuesN[DEGREES_FROM_INITIAL].value =
1560 AxisTwoEncoderValuesHasChanged =
true;
1562 if (AxisTwoEncoderValuesHasChanged && InformClient)
1572 double JulianOffset = offset_in_sec / (24.0 * 60 * 60);
1580 Location.latitude = 90;
1581 Location.longitude = 0;
1585 Location.latitude = -90;
1586 Location.longitude = 0;
1607 Location.latitude = 90;
1608 Location.longitude = 0;
1612 Location.latitude = -90;
1613 Location.longitude = 0;
1622 void SkywatcherAltAzSimple::LogMessage(
const char* format, ...)
1628 va_start(Ap, format);
1631 std::ofstream LogFile;
1633 LogFile.open(TrackLogFileName.c_str(), std::ios::out | std::ios::app);
1634 if (!LogFile.is_open())
1638 vsnprintf(TempStr,
sizeof(TempStr), format, Ap);
1639 LogFile << GetLogTimestamp() <<
" | " << TempStr <<
"\n";
The Interface class is the base class for all INDI connection plugins.
virtual std::string name()=0
bool Refresh(bool silent=false)
virtual bool Disconnect() override
Disconnect Disconnect from device.
virtual bool Connect() override
Connect Connect to device via the implemented communication medium. Do not perform any handshakes.
virtual const char * port()
const char * getDeviceName() const
INDI::PropertySwitch getSwitch(const char *name) const
void addConfigurationControl()
Add Configuration control to the driver.
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Process the client newBLOB command.
void setDriverInterface(uint16_t value)
setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE....
Connection::Interface * getActiveConnection()
int SetTimer(uint32_t ms)
Set a timer to call the function TimerHit after ms milliseconds.
uint16_t getDriverInterface() const
void addDebugControl()
Add Debug control to the driver.
INumberVectorProperty GuideNSNP
void initGuiderProperties(const char *deviceName, const char *groupName)
Initilize guider properties. It is recommended to call this function within initProperties() of your ...
INumberVectorProperty GuideWENP
void processGuiderProperties(const char *name, double values[], char *names[], int n)
Call this function whenever client updates GuideNSNP or GuideWSP properties in the primary device....
TelescopeStatus TrackState
bool CheckFile(const std::string &file_name, bool writable) const
Check if a file exists and it is readable.
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.
const std::string ScopeConfigLabelApXmlNode
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
const std::string ScopeConfigDeviceXmlNode
ISwitchVectorProperty CoordSP
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...
ISwitchVectorProperty ScopeConfigsSP
bool isParked()
isParked is mount currently parked?
ISwitchVectorProperty SlewRateSP
Connection::Serial * serialConnection
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
const std::string ScopeConfigFileName
The telescope/guide scope configuration file name.
const std::string ScopeConfigRootXmlNode
virtual void SetParked(bool isparked)
SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData....
INumberVectorProperty EqNP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
const std::string ScopeConfigNameXmlNode
IGeographicCoordinates m_Location
void NewRaDec(double ra, double dec)
The child class calls this function when it has updates.
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.
bool IsMerlinMount() const
Check if the current mount is a Virtuoso (AltAz)
void SetSerialPort(int port)
Set the serail port to be usb for mount communication.
bool GetMotorBoardVersion(AXISID Axis)
static constexpr double LOW_SPEED_MARGIN
double MicrostepsToDegrees(AXISID Axis, long Microsteps)
Convert microsteps to angle in degrees.
void SlewTo(AXISID Axis, long OffsetInMicrosteps, bool verbose=true)
Slew to the given offset and stop.
long ZeroPositionEncoders[2]
Zero position encoder values (microsteps).
long CurrentEncoders[2]
Current encoder values (microsteps).
bool GetStatus(AXISID Axis)
long PolarisPositionEncoders[2]
Polaris position (initial) encoder values (microsteps).
bool GetEncoder(AXISID Axis)
Set the CurrentEncoders status variable to the current encoder value in microsteps for the specified ...
long MicrostepsPerWormRevolution[2]
double MicrostepsPerDegree[2]
long DegreesToMicrosteps(AXISID Axis, double AngleInDegrees)
Convert angle in degrees to microsteps.
bool SlowStop(AXISID Axis)
Bring the axis to slow stop in the distance specified by SetSlewModeDeccelerationRampLength.
bool InitMount()
Initialize the communication to the mount.
void Slew(AXISID Axis, double SpeedInRadiansPerSecond, bool IgnoreSilentMode=true)
Start the axis slewing at the given rate.
long MicrostepsPerRevolution[2]
bool IsInMotion(AXISID Axis)
Check if an axis is moving.
long StepperClockFrequency[2]
INDI::Telescope * pChildTelescope
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual const char * getDefaultName() override
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Process the client newBLOB command.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
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 Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool Park() override
Park the telescope to its home 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 GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
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 void TimerHit() override
Called when setTimer() time is up.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
double GetParkDeltaAz(ParkDirection_t target_direction, ParkPosition_t target_position)
const char * GUIDE_TAB
GUIDE_TAB Where all the properties for guiding are located.
const char * MOTION_TAB
MOTION_TAB Where all the motion control properties of the device are located.
void tty_set_generic_udp_format(int enabled)
void IDLog(const char *fmt,...)
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.
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.
ISwitch * IUFindOnSwitch(const ISwitchVectorProperty *svp)
Returns the first ON switch it finds in the vector switch 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.
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,...)
void IDMessage(const char *dev, const char *fmt,...)
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 DEBUG(priority, msg)
Macro to print log messages. Example of usage of the Logger: DEBUG(DBG_DEBUG, "hello " << "world");.
#define LOGF_WARN(fmt,...)
#define LOGF_DEBUG(fmt,...)
#define DEBUGF(priority, msg,...)
XMLAtt * findXMLAtt(XMLEle *ep, const char *name)
Find an XML attribute within an XML element.
LilXML * newLilXML()
Create a new lilxml parser.
char * pcdataXMLEle(XMLEle *ep)
Return the pcdata of an XML element.
char * tagXMLEle(XMLEle *ep)
Return the tag of an XML element.
XMLEle * readXMLFile(FILE *fp, LilXML *lp, char ynot[])
Handy wrapper to read one xml file.
XMLEle * nextXMLEle(XMLEle *ep, int init)
Iterate an XML element for a list of nesetd XML elements.
void delXMLEle(XMLEle *ep)
delXMLEle Delete XML element.
void delLilXML(LilXML *lp)
Delete a lilxml parser.
XMLEle * findXMLEle(XMLEle *ep, const char *tag)
Find an XML element within an XML element.
char * valuXMLAtt(XMLAtt *ap)
Return the value of an XML attribute.
std::vector< uint8_t > buffer
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.
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
#define MYDEBUGF(priority, msg,...)
double SlewSpeeds[SLEWMODES]
std::unique_ptr< SkywatcherAltAzSimple > SkywatcherAltAzSimplePtr(new SkywatcherAltAzSimple())
Switch vector property descriptor.