Instrument Neutral Distributed Interface INDI 2.2.5
pmc8.cpp
Go to the documentation of this file.
1/*
2 INDI Explore Scientific PMC8 driver
3
4 Copyright (C) 2017 Michael Fulbright
5
6 Additional contributors:
7 Thomas Olson, Copyright (C) 2019
8 Karl Rees, Copyright (C) 2019-2023
9 Martin Ruiz, Copyright (C) 2023
10 Daniel Karnaukh, Copyright (C) 2026
11
12 Based on IEQPro driver.
13
14 This library is free software; you can redistribute it and/or
15 modify it under the terms of the GNU Lesser General Public
16 License as published by the Free Software Foundation; either
17 version 2.1 of the License, or (at your option) any later version.
18
19 This library is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
23
24 You should have received a copy of the GNU Lesser General Public
25 License along with this library; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27*/
28/* Experimental Mount selector switch G11 vs EXOS2 by Thomas Olson
29 *
30 */
31
32#include "pmc8.h"
33
34#include <indicom.h>
37
38#include <libnova/sidereal_time.h>
39
40#include <memory>
41
42#include <math.h>
43#include <string.h>
44
45/* Simulation Parameters */
46#define SLEWRATE 3 /* slew rate, degrees/s */
47
48#define MOUNTINFO_TAB "Mount Info"
49
50#define PMC8_DEFAULT_PORT 54372
51#define PMC8_DEFAULT_IP_ADDRESS "192.168.47.1"
52#define PMC8_TRACKING_AUTODETECT_INTERVAL 10
53#define PMC8_VERSION_MAJOR 0
54#define PMC8_VERSION_MINOR 5
55
56static std::unique_ptr<PMC8> scope(new PMC8());
57
58/* Constructor */
59PMC8::PMC8() : GI(this)
60{
61 currentRA = ln_get_apparent_sidereal_time(ln_get_julian_from_sys());
62 if (LocationNP[LOCATION_LATITUDE].getValue() < 0)
63 currentDEC = -90;
64 else
65 currentDEC = 90;
66
67 DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE");
68
72 9);
73
75}
76
78{
79}
80
82{
83 return "PMC8";
84}
85
87{
89
90 // Serial Cable Connection Type
91 // Letting them choose standard cable can speed up connection time significantly
92 IUFillSwitch(&SerialCableTypeS[0], "SERIAL_CABLE_AUTO", "Auto", ISS_ON);
93 IUFillSwitch(&SerialCableTypeS[1], "SERIAL_CABLE_INVERTED", "Inverted", ISS_OFF);
94 IUFillSwitch(&SerialCableTypeS[2], "SERIAL_CABLE_STANDARD", "Standard", ISS_OFF);
95 IUFillSwitchVector(&SerialCableTypeSP, SerialCableTypeS, 3, getDeviceName(), "SERIAL_CABLE_TYPE", "Serial Cable",
97
98 // Mount Model
99 IUFillSwitch(&MountModelS[MOUNT_G11], "MOUNT_G11", "G11", ISS_OFF);
100 IUFillSwitch(&MountModelS[MOUNT_EXOS2], "MOUNT_EXOS2", "EXOS2", ISS_OFF);
101 IUFillSwitch(&MountModelS[MOUNT_iEXOS100], "MOUNT_iEXOS100", "iEXOS100", ISS_OFF);
102 IUFillSwitchVector(&MountModelSP, MountModelS, 3, getDeviceName(), "MOUNT_TYPE", "Mount Model", CONNECTION_TAB, IP_RW,
104
105
106 /* Tracking Mode */
107 // order is important, since driver assumes solar = 1, lunar = 2
108 AddTrackMode("TRACK_SIDEREAL", "Sidereal", true);
109 AddTrackMode("TRACK_SOLAR", "Solar");
110 AddTrackMode("TRACK_LUNAR", "Lunar");
111 //AddTrackMode("TRACK_KING", "King"); // King appears to be effectively the same as Solar, at least for EXOS-2, and a bit of pain to implement with auto-detection
112 AddTrackMode("TRACK_CUSTOM", "Custom");
113
114 // Set TrackRate limits
115 /*TrackRateN[AXIS_RA].min = -PMC8_MAX_TRACK_RATE;
116 TrackRateN[AXIS_RA].max = PMC8_MAX_TRACK_RATE;
117 TrackRateN[AXIS_DE].min = -0.01;
118 TrackRateN[AXIS_DE].max = 0.01;*/
119
120 // what to do after goto operation
121 IUFillSwitch(&PostGotoS[0], "GOTO_START_TRACKING", "Start / Resume Tracking", ISS_ON);
122 IUFillSwitch(&PostGotoS[1], "GOTO_RESUME_PREVIOUS", "Previous State", ISS_OFF);
123 IUFillSwitch(&PostGotoS[2], "GOTO_STOP_TRACKING", "No Tracking", ISS_OFF);
124 IUFillSwitchVector(&PostGotoSP, PostGotoS, 3, getDeviceName(), "POST_GOTO_SETTINGS", "Post Goto", MOTION_TAB, IP_RW,
126
127 // relabel move speeds
128 SlewRateSP[0].setLabel("4x");
129 SlewRateSP[1].setLabel("8x");
130 SlewRateSP[2].setLabel("16x");
131 SlewRateSP[3].setLabel("32x");
132 SlewRateSP[4].setLabel("64x");
133 SlewRateSP[5].setLabel("128x");
134 SlewRateSP[6].setLabel("256x");
135 SlewRateSP[7].setLabel("512x");
136 SlewRateSP[8].setLabel("833x");
137
138 // settings for ramping up/down when moving
139 IUFillNumber(&RampN[0], "RAMP_INTERVAL", "Interval (ms)", "%g", 20, 1000, 5, 200);
140 IUFillNumber(&RampN[1], "RAMP_BASESTEP", "Base Step", "%g", 1, 256, 1, 4);
141 IUFillNumber(&RampN[2], "RAMP_FACTOR", "Factor", "%g", 1.0, 2.0, 0.1, 1.4);
142 IUFillNumberVector(&RampNP, RampN, 3, getDeviceName(), "RAMP_SETTINGS", "Move Ramp", MOTION_TAB, IP_RW, 0, IPS_IDLE);
143
144 /* How fast do we guide compared to sidereal rate */
145 IUFillNumber(&GuideRateN[0], "GUIDE_RATE_RA", "RA (x Sidereal)", "%g", 0.1, 1.0, 0.1, 0.4);
146 IUFillNumber(&GuideRateN[1], "GUIDE_RATE_DE", "DEC (x Sidereal)", "%g", 0.1, 1.0, 0.1, 0.4);
147 IUFillNumberVector(&GuideRateNP, GuideRateN, 2, getDeviceName(), "GUIDE_RATE", "Guide Rate", GUIDE_TAB, IP_RW, 0, IPS_IDLE);
148 IUFillNumber(&LegacyGuideRateN[0], "LEGACY_GUIDE_RATE", "x Sidereal", "%g", 0.1, 1.0, 0.1, 0.4);
149 IUFillNumberVector(&LegacyGuideRateNP, LegacyGuideRateN, 1, getDeviceName(), "LEGACY_GUIDE_RATE", "Guide Rate", GUIDE_TAB,
150 IP_RW, 0, IPS_IDLE);
151
153
155
156 // Driver does not support custom parking yet.
158
160
162
163 IUFillText(&FirmwareT[0], "Version", "Version", "");
164 IUFillTextVector(&FirmwareTP, FirmwareT, 1, getDeviceName(), "Firmware", "Firmware", MAIN_CONTROL_TAB, IP_RO, 0, IPS_IDLE);
165
167
168 return true;
169}
170
172{
174
175 if (isConnected())
176 {
177 getStartupData();
178
179 defineProperty(&PostGotoSP);
180 loadConfig(true, PostGotoSP.name);
181
182 defineProperty(&RampNP);
183 loadConfig(true, RampNP.name);
184
185 if (firmwareInfo.IsRev2Compliant)
186 {
187 defineProperty(&GuideRateNP);
188 }
189 else
190 {
191 defineProperty(&LegacyGuideRateNP);
192 }
193
194 defineProperty(&FirmwareTP);
195
196 // do not support park position
199 }
200 else
201 {
202 deleteProperty(PostGotoSP.name);
203
204 if (firmwareInfo.IsRev2Compliant)
205 {
206 deleteProperty(GuideRateNP.name);
207 }
208 else
209 {
210 deleteProperty(LegacyGuideRateNP.name);
211 }
212
213 deleteProperty(FirmwareTP.name);
214
215 deleteProperty(RampNP.name);
216 }
217
219
220 return true;
221}
222
223void PMC8::getStartupData()
224{
225 LOG_DEBUG("Getting firmware data...");
226 if (get_pmc8_firmware(PortFD, &firmwareInfo))
227 {
228 const char *c;
229
230 FirmwareTP.s = IPS_OK;
231 c = firmwareInfo.MainBoardFirmware.c_str();
232 LOGF_INFO("firmware = %s.", c);
233
234 // not sure if there's really a point to the mount switch anymore if we know the mount from the firmware - perhaps remove as newer firmware becomes standard?
235 // populate mount type switch in interface from firmware if possible
236 IUResetSwitch(&MountModelSP);
237 if (firmwareInfo.MountType == MOUNT_EXOS2)
238 {
239 MountModelS[MOUNT_EXOS2].s = ISS_ON;
240 LOG_INFO("Detected mount type as Exos2.");
241 }
242 else if (firmwareInfo.MountType == MOUNT_G11)
243 {
244 MountModelS[MOUNT_G11].s = ISS_ON;
245 LOG_INFO("Detected mount type as G11.");
246 }
247 else if (firmwareInfo.MountType == MOUNT_iEXOS100)
248 {
249 MountModelS[MOUNT_iEXOS100].s = ISS_ON;
250 LOG_INFO("Detected mount type as iExos100.");
251 }
252 else
253 {
254 LOG_INFO("Cannot detect mount type--perhaps this is older firmware?");
255 if (strstr(getDeviceName(), "EXOS2"))
256 {
257 MountModelS[MOUNT_EXOS2].s = ISS_ON;
258 LOG_INFO("Guessing mount is EXOS2 from device name.");
259 }
260 else if (strstr(getDeviceName(), "iEXOS100"))
261 {
262 MountModelS[MOUNT_iEXOS100].s = ISS_ON;
263 LOG_INFO("Guessing mount is iEXOS100 from device name.");
264 }
265 else
266 {
267 MountModelS[MOUNT_G11].s = ISS_ON;
268 LOG_INFO("Guessing mount is G11.");
269 }
270 }
271 MountModelSP.s = IPS_OK;
272 IDSetSwitch(&MountModelSP, nullptr);
273
274 IUSaveText(&FirmwareT[0], c);
275 IDSetText(&FirmwareTP, nullptr);
276 }
277
278 // get SRF values
279 if (firmwareInfo.IsRev2Compliant)
280 {
281 double rate = 0.4;
283 {
284 GuideRateN[0].value = rate;
285 GuideRateNP.s = IPS_OK;
286 IDSetNumber(&GuideRateNP, nullptr);
287 }
289 {
290 GuideRateN[1].value = rate;
291 GuideRateNP.s = IPS_OK;
292 IDSetNumber(&GuideRateNP, nullptr);
293 }
294 }
295
296 // PMC8 doesn't store location permanently so read from config and set
297 // Convert to INDI standard longitude (0 to 360 Eastward)
298 double longitude = LocationNP[LOCATION_LONGITUDE].getValue();
299 double latitude = LocationNP[LOCATION_LATITUDE].getValue();
300 if (latitude < 0)
301 currentDEC = -90;
302 else
303 currentDEC = 90;
304
305
306 // must also keep "low level" aware of position to convert motor counts to RA/DEC
307 set_pmc8_location(latitude, longitude);
308
309 // seems like best place to put a warning that will be seen in log window of EKOS/etc
310 LOG_INFO("The PMC-Eight driver is in BETA development currently.");
311 LOG_INFO("Be prepared to intervene if something unexpected occurs.");
312
313#if 0
314 // Park position initialization
315 // Southern Hemisphere support: Use get_pmc8_east_dir() to determine proper DEC park position
316 // In northern hemisphere, park at DEC +90; in southern hemisphere, park at DEC -90
317 double HA = ln_get_apparent_sidereal_time(ln_get_julian_from_sys());
318 double DEC = get_pmc8_east_dir() ? 90.0 : -90.0; // +90 for north, -90 for south
319
320 // currently only park at motor position (0, 0)
321 if (InitPark())
322 {
323 // If loading parking data is successful, we just set the default parking values.
326 }
327 else
328 {
329 // Otherwise, we set all parking data to default in case no parking data is found.
330 SetAxis1Park(HA);
331 SetAxis2Park(DEC);
334 }
335#endif
336
337#if 0
338 // FIXME - Need to implement simulation functionality
339 if (isSimulation())
340 {
341 if (isParked())
343 else
345 }
346#endif
347}
348
349bool PMC8::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
350{
351 // Check guider interface
352 if (GI::processNumber(dev, name, values, names, n))
353 return true;
354
355 if (!strcmp(dev, getDeviceName()))
356 {
357 // Guiding Rate
358 if (!strcmp(name, RampNP.name))
359 {
360 IUUpdateNumber(&RampNP, values, names, n);
361 RampNP.s = IPS_OK;
362 IDSetNumber(&RampNP, nullptr);
363
364 return true;
365 }
366 if (!strcmp(name, LegacyGuideRateNP.name))
367 {
368 IUUpdateNumber(&GuideRateNP, values, names, n);
369
370 if (set_pmc8_guide_rate(PortFD, PMC8_AXIS_RA, LegacyGuideRateN[0].value))
371 LegacyGuideRateNP.s = IPS_OK;
372 else
373 LegacyGuideRateNP.s = IPS_ALERT;
374
375 IDSetNumber(&LegacyGuideRateNP, nullptr);
376
377 return true;
378 }
379 if (!strcmp(name, GuideRateNP.name))
380 {
381 IUUpdateNumber(&GuideRateNP, values, names, n);
382
383 if (set_pmc8_guide_rate(PortFD, PMC8_AXIS_RA, GuideRateN[0].value) &&
384 set_pmc8_guide_rate(PortFD, PMC8_AXIS_DEC, GuideRateN[1].value))
385 GuideRateNP.s = IPS_OK;
386 else
387 GuideRateNP.s = IPS_ALERT;
388
389 IDSetNumber(&GuideRateNP, nullptr);
390
391 return true;
392 }
393 }
394
395 return INDI::Telescope::ISNewNumber(dev, name, values, names, n);
396}
397
398void PMC8::ISGetProperties(const char *dev)
399{
401 defineProperty(&MountModelSP);
402 defineProperty(&SerialCableTypeSP);
403 loadConfig(true, SerialCableTypeSP.name);
404
405 // set default connection parameters
406 // unfortunately, the only way I've found to set these is after calling ISGetProperties on base class
408 tcpConnection->setDefaultHost(PMC8_DEFAULT_IP_ADDRESS);
409 tcpConnection->setDefaultPort(PMC8_DEFAULT_PORT);
410
411 // reload config here, even though it was already loaded in call to base class
412 // since defaults may have overridden saved properties
413 loadConfig(false, nullptr);
414}
415
416bool PMC8::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
417{
418 if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
419 {
420 if (strcmp(name, MountModelSP.name) == 0)
421 {
422 IUUpdateSwitch(&MountModelSP, states, names, n);
423 int currentMountIndex = IUFindOnSwitchIndex(&MountModelSP);
424 LOGF_INFO("Selected mount is %s", MountModelS[currentMountIndex].label);
425
426 //right now, this lets the user override the parameters for the detected mount. Perhaps we should prevent the user from doing so?
427 set_pmc8_mountParameters(currentMountIndex);
428 MountModelSP.s = IPS_OK;
429 IDSetSwitch(&MountModelSP, nullptr);
430 return true;
431 }
432 if (strcmp(name, SerialCableTypeSP.name) == 0)
433 {
434 IUUpdateSwitch(&SerialCableTypeSP, states, names, n);
435 SerialCableTypeSP.s = IPS_OK;
436 IDSetSwitch(&SerialCableTypeSP, nullptr);
437 return true;
438 }
439 if (strcmp(name, PostGotoSP.name) == 0)
440 {
441 IUUpdateSwitch(&PostGotoSP, states, names, n);
442 // for v2 firmware, if halt after goto is selected, tell driver to use ESPt2
443 set_pmc8_goto_resume(!((IUFindOnSwitchIndex(&PostGotoSP) == 2) && firmwareInfo.IsRev2Compliant));
444 PostGotoSP.s = IPS_OK;
445 IDSetSwitch(&PostGotoSP, nullptr);
446 return true;
447 }
448 }
449
450 return INDI::Telescope::ISNewSwitch(dev, name, states, names, n);
451}
452
454{
455 bool rc = false;
456
457 // try to disconnect and reconnect if reconnect flag is set
458
460 {
461 int rc = Disconnect();
462 if (rc) setConnected(false);
463 rc = Connect();
464 if (rc) setConnected(true, IPS_OK);
465 return false;
466 }
467
468 if (isSimulation())
469 mountSim();
470
471 // avoid unnecessary status calls to mount while pulse guiding so we don't lock up the mount for 40+ ms right when it needs to start/stop
472 if (isPulsingNS || isPulsingWE) return true;
473
474 bool slewing = false;
475
476 switch (TrackState)
477 {
478 case SCOPE_SLEWING:
479 // are we done?
480 // check slew state
481 rc = get_pmc8_is_scope_slewing(PortFD, slewing);
482 if (!rc)
483 {
484 LOG_ERROR("PMC8::ReadScopeStatus() - unable to check slew state");
485 }
486 else
487 {
488 if (slewing == false)
489 {
490 if ((IUFindOnSwitchIndex(&PostGotoSP) == 0) ||
491 ((IUFindOnSwitchIndex(&PostGotoSP) == 1) && (RememberTrackState == SCOPE_TRACKING)))
492 {
493 LOG_INFO("Slew complete, tracking...");
495 TrackStateSP.setState(IPS_IDLE);
496
497 // Don't want to restart tracking after goto with v2 firmware, since mount does automatically
498 // and we might detect that slewing has stopped before it fully settles
499 if (!firmwareInfo.IsRev2Compliant)
500 {
501 if (!SetTrackEnabled(true))
502 {
503 LOG_ERROR("slew complete - unable to enable tracking");
504 return false;
505 }
506 }
507 }
508 else
509 {
510 LOG_INFO("Slew complete.");
512 }
513 }
514 }
515
516 break;
517
518 case SCOPE_PARKING:
519 // are we done?
520 // check slew state
521 rc = get_pmc8_is_scope_slewing(PortFD, slewing);
522 if (!rc)
523 {
524 LOG_ERROR("PMC8::ReadScopeStatus() - unable to check slew state");
525 }
526 else
527 {
528 if (slewing == false)
529 {
531 LOG_DEBUG("Mount tracking is off.");
532
533 SetParked(true);
534
535 saveConfig(true);
536 }
537 }
538 break;
539
540 case SCOPE_IDLE:
541 //periodically check to see if we've entered tracking state (e.g. at startup or from other client)
542 if (!trackingPollCounter--)
543 {
544
545 trackingPollCounter = PMC8_TRACKING_AUTODETECT_INTERVAL;
546
547 // make sure we aren't moving manually to avoid false positives
548 if (moveInfoDEC.state == PMC8_MOVE_INACTIVE && moveInfoRA.state == PMC8_MOVE_INACTIVE)
549 {
550
551 double track_rate;
552 uint8_t track_mode;
553
554 rc = get_pmc8_tracking_data(PortFD, track_rate, track_mode);
555
556 // N.B. PMC8 rates are arcseconds per sidereal second
557 // INDI uses arcseconds per solar second
558 track_rate *= SOLAR_SECOND;
559
560 if (rc && ((int)track_rate > 0) && ((int)track_rate <= PMC8_MAX_TRACK_RATE))
561 {
562 TrackModeSP.reset();
563 TrackModeSP[convertFromPMC8TrackMode(track_mode)].setState(ISS_ON);
564 TrackModeSP.setState(IPS_OK);
565 TrackModeSP.apply();
567 LOGF_INFO("Mount has started tracking at %f arcsec / sec", track_rate);
568 TrackRateNP.setState(IPS_IDLE);
569 TrackRateNP[AXIS_RA].setValue(track_rate);
570 TrackRateNP.apply();
571 }
572 }
573 }
574 break;
575
576 case SCOPE_TRACKING:
577 //periodically check to see if we've stopped tracking or changed speed (e.g. from other client)
578 if (!trackingPollCounter--)
579 {
580 trackingPollCounter = PMC8_TRACKING_AUTODETECT_INTERVAL;
581
582 // make sure we aren't moving manually to avoid false positives
583 if (moveInfoDEC.state == PMC8_MOVE_INACTIVE && moveInfoRA.state == PMC8_MOVE_INACTIVE)
584 {
585
586 double track_rate;
587 uint8_t track_mode;
588
589 rc = get_pmc8_tracking_data(PortFD, track_rate, track_mode);
590
591 // N.B. PMC8 rates are arcseconds per sidereal second
592 // INDI uses arcseconds per solar second
593 track_rate *= SOLAR_SECOND;
594
595 if (rc && ((int)track_rate == 0))
596 {
597 LOG_INFO("Mount appears to have stopped tracking");
599 }
600 else if (rc && ((int)track_rate <= PMC8_MAX_TRACK_RATE))
601 {
602 if (TrackModeSP[convertFromPMC8TrackMode(track_mode)].getState() != ISS_ON)
603 {
604 TrackModeSP.reset();
605 TrackModeSP[convertFromPMC8TrackMode(track_mode)].setState(ISS_ON);
606 TrackModeSP.apply();
607 }
608 if (TrackRateNP[AXIS_RA].getValue() != track_rate)
609 {
611 TrackRateNP.setState(IPS_IDLE);
612 TrackRateNP[AXIS_RA].setValue(track_rate);
613 TrackRateNP.apply();
614 LOGF_INFO("Mount now tracking at %f arcsec / sec", track_rate);
615 }
616 }
617 }
618 }
619
620 default:
621 break;
622 }
623
625 rc = get_pmc8_coords(PortFD, currentRA, currentDEC, sop);
626
627 if (rc)
628 {
629 NewRaDec(currentRA, currentDEC);
630 setPierSide(sop);
631 }
632
633 return rc;
634}
635
636bool PMC8::Goto(double r, double d)
637{
638 if (isPulsingNS ||
639 isPulsingWE ||
640 moveInfoDEC.state != PMC8_MOVE_INACTIVE ||
641 moveInfoRA.state != PMC8_MOVE_INACTIVE ||
642 (TrackState == SCOPE_SLEWING && !firmwareInfo.IsRev2Compliant))
643 {
644 LOG_ERROR("Cannot slew while moving or guiding. Please stop moving or guiding first");
645 return false;
646 }
647 else if (TrackState == SCOPE_SLEWING)
648 {
649 targetRA = r;
650 targetDEC = d;
652 //Supposedly the goto should abort in 2s, but we'll give it a little bit more time just in case
654 LOG_INFO("Goto called while already slewing. Stopping slew and will try goto again in 2.5 seconds");
655 return true;
656 }
657
658 // start tracking if we're idle, so mount will track at correct rate post-goto
660 if ((TrackState != SCOPE_TRACKING) && (IUFindOnSwitchIndex(&PostGotoSP) == 0) && firmwareInfo.IsRev2Compliant)
661 {
662 SetTrackEnabled(true);
663 }
664 else if (IUFindOnSwitchIndex(&PostGotoSP) == 2)
665 {
667 }
668
669 char RAStr[64] = {0}, DecStr[64] = {0};
670
671 targetRA = r;
672 targetDEC = d;
673
674 fs_sexa(RAStr, targetRA, 2, 3600);
675 fs_sexa(DecStr, targetDEC, 2, 3600);
676
677 LOGF_DEBUG("Slewing to RA: %s - DEC: %s", RAStr, DecStr);
678
679 if (slew_pmc8(PortFD, r, d) == false)
680 {
681 LOG_ERROR("Failed to slew.");
682 return false;
683 }
684
686
687 return true;
688}
689
690bool PMC8::Sync(double ra, double dec)
691{
692
693 targetRA = ra;
694 targetDEC = dec;
695 char RAStr[64] = {0}, DecStr[64] = {0};
696
697 fs_sexa(RAStr, targetRA, 2, 3600);
698 fs_sexa(DecStr, targetDEC, 2, 3600);
699
700 LOGF_DEBUG("Syncing to RA: %s - DEC: %s", RAStr, DecStr);
701
702 if (sync_pmc8(PortFD, ra, dec) == false)
703 {
704 LOG_ERROR("Failed to sync.");
705 }
706
707 EqNP.setState(IPS_OK);
708
709 currentRA = ra;
710 currentDEC = dec;
711
712 NewRaDec(currentRA, currentDEC);
713
714 return true;
715}
716
718{
719 //static_cast<PMC8*>(p)->TrackState = static_cast<PMC8*>(p)->RememberTrackState;
720 static_cast<PMC8*>(p)->Goto(static_cast<PMC8*>(p)->targetRA, static_cast<PMC8*>(p)->targetDEC);
721}
722
724{
725 //GUIDE Abort guide operations.
726 if (GuideNSNP.getState() == IPS_BUSY || GuideWENP.getState() == IPS_BUSY)
727 {
728 GuideNSNP.setState(IPS_IDLE);
729 GuideWENP.setState(IPS_IDLE);
730 GuideNSNP[0].setValue(0);
731 GuideNSNP[1].setValue(0);
732 GuideWENP[0].setValue(0);
733 GuideWENP[1].setValue(0);
734
735 if (GuideNSTID)
736 {
738 GuideNSTID = 0;
739 }
740
741 if (GuideWETID)
742 {
744 GuideNSTID = 0;
745 }
746
747 LOG_INFO("Guide aborted.");
748 GuideNSNP.apply();
749 GuideWENP.apply();
750 return true;
751 }
752
753
754 //GOTO Abort slew operations.
756 {
758 //It will take about 2s to abort; we'll rely on ReadScopeStatus to detect when that occurs
759 LOG_INFO("Goto aborted.");
760 return true;
761 }
762
763 //MOVE Abort move operations.
764 if ((moveInfoDEC.state == PMC8_MOVE_ACTIVE) || (moveInfoRA.state == PMC8_MOVE_ACTIVE))
765 {
766 if (moveInfoDEC.state == PMC8_MOVE_ACTIVE)
767 {
768 MoveNS((INDI_DIR_NS)moveInfoDEC.moveDir, MOTION_STOP);
769 }
770 if (moveInfoRA.state == PMC8_MOVE_ACTIVE)
771 {
772 MoveWE((INDI_DIR_WE)moveInfoRA.moveDir, MOTION_STOP);
773 }
774 LOG_INFO("Move aborted.");
775 return true;
776 }
777
778 LOG_INFO("Abort called--stopping all motion.");
779 if (abort_pmc8(PortFD))
780 {
782 return true;
783 }
784 else return false;
785}
786
788{
789#if 0
790 // FIXME - Currently only support parking at motor position (0, 0)
791 targetRA = GetAxis1Park();
792 targetDEC = GetAxis2Park();
793 if (set_pmc8_radec(PortFD, r, d) == false)
794 {
795 LOG_ERROR("Error setting RA/DEC.");
796 return false;
797 }
798#endif
799
800 //if we're already parking, no need to do anything
802 {
803 return true;
804 }
805
806 if (park_pmc8(PortFD))
807 {
809 LOG_INFO("Telescope parking in progress to motor position (0, 0)");
810 return true;
811 }
812 else
813 {
814 return false;
815 }
816}
817
819{
820 if (unpark_pmc8(PortFD))
821 {
822 SetParked(false);
824 return true;
825 }
826 else
827 {
828 return false;
829 }
830}
831
833{
834 if (isSimulation())
835 {
838 set_pmc8_sim_move_rate(64 * 15);
839 // set_pmc8_sim_hemisphere(HEMI_NORTH);
840 }
841
844 {
845 if (IUFindOnSwitchIndex(&SerialCableTypeSP) == 1) conn = PMC8_SERIAL_INVERTED;
846 if (IUFindOnSwitchIndex(&SerialCableTypeSP) == 2) conn = PMC8_SERIAL_STANDARD;
847 }
848 else
849 {
850 conn = PMC8_ETHERNET;
851 }
852
853 return check_pmc8_connection(PortFD, conn);
854}
855
856bool PMC8::updateTime(ln_date *utc, double utc_offset)
857{
858 // mark unused
859 INDI_UNUSED(utc);
860 INDI_UNUSED(utc_offset);
861
862 LOG_ERROR("PMC8::updateTime() not implemented!");
863 return false;
864
865}
866
867bool PMC8::updateLocation(double latitude, double longitude, double elevation)
868{
869 INDI_UNUSED(elevation);
870
871 if (longitude > 180)
872 longitude -= 360;
873
874 // Southern Hemisphere support
875 // As of 2024, southern hemisphere is now supported with proper coordinate
876 // transformations and motor direction handling via pmc8_east_dir variable.
877 // The low-level driver (pmc8driver.cpp) handles the coordinate math.
878 if (latitude < 0)
879 {
880 LOG_INFO("Southern Hemisphere detected - using inverted coordinate system.");
881 }
882
883 // must also keep "low level" aware of position to convert motor counts to RA/DEC
884 set_pmc8_location(latitude, longitude);
885
886 char l[32] = {0}, L[32] = {0};
887 fs_sexa(l, latitude, 3, 3600);
888 fs_sexa(L, longitude, 4, 3600);
889
890 LOGF_INFO("Site location updated to Lat %.32s - Long %.32s", l, L);
891
892 return true;
893}
894
895void PMC8::debugTriggered(bool enable)
896{
897 set_pmc8_debug(enable);
898}
899
901{
902 set_pmc8_simulation(enable);
903}
904
906{
907 int mode = SlewRateSP.findOnSwitchIndex();
908 if (mode >= 8) return PMC8_MAX_MOVE_RATE;
909 return 4 * pow(2, mode) * 15;
910}
911
912
914{
915
916 PMC8MoveInfo *moveInfo = ((dir == PMC8_N) | (dir == PMC8_S)) ? &moveInfoDEC : &moveInfoRA;
917
918 if (moveInfo->state != PMC8_MOVE_RAMPING)
919 {
920 return false; //shouldn't be here
921 LOG_ERROR("Ramp function called while not in ramp state");
922 }
923
924 int newrate = moveInfo->rampLastStep;
925
926 if (moveInfo->rampDir == PMC8_RAMP_UP)
927 {
928 newrate += RampN[1].value * pow(RampN[2].value, moveInfo->rampIteration++) * 15;
929 }
930 else
931 {
932 newrate -= RampN[1].value * pow(RampN[2].value, --moveInfo->rampIteration) * 15;
933 }
934
935 int adjrate = newrate;
936
937 //check to see if we're done
938 if (newrate >= moveInfo->targetRate)
939 {
940 adjrate = moveInfo->targetRate;
941 moveInfo->state = PMC8_MOVE_ACTIVE;
942 }
943 else if (newrate <= 0)
944 {
945 adjrate = 0;
946 moveInfo->state = PMC8_MOVE_INACTIVE;
947 //restore tracking if we're at 0
948 if ((dir == PMC8_E) || (dir == PMC8_W))
949 {
951 {
952 if (!SetTrackEnabled(true))
953 {
954 LOG_ERROR("slew complete - unable to enable tracking");
955 return false;
956 }
957 }
958
959 return true;
960 }
961 }
962
963 //adjust for current tracking rate
964 if (dir == PMC8_E) adjrate += round(TrackRateNP[AXIS_RA].getValue());
965 else if (dir == PMC8_W) adjrate -= round(TrackRateNP[AXIS_RA].getValue());
966
967 // Solar second to Sideral second conversion
968 adjrate /= SOLAR_SECOND;
969
970 LOGF_EXTRA3("Ramping: mount dir %d, ramping dir %d, iteration %d, step to %d", dir, moveInfo->rampDir,
971 moveInfo->rampIteration, adjrate);
972
973 if (!set_pmc8_move_rate_axis(PortFD, dir, adjrate))
974 {
975 LOGF_ERROR("Error ramping move rate: mount dir %d, ramping dir %d, iteration %d, step to %d", dir, moveInfo->rampDir,
976 moveInfo->rampIteration, adjrate);
977 moveInfo->state = PMC8_MOVE_INACTIVE;
978 return false;
979 }
980
981 moveInfo->rampLastStep = newrate;
982
983 return true;
984}
985
986//MOVE The timer helper functions.
988{
989 PMC8* pmc8 = static_cast<PMC8*>(p);
990 if (pmc8->ramp_movement(PMC8_N) && (pmc8->moveInfoDEC.state == PMC8_MOVE_RAMPING))
991 pmc8->moveInfoDEC.timer = IEAddTimer(pmc8->RampN[0].value, rampTimeoutHelperN, p);
992}
994{
995 PMC8* pmc8 = static_cast<PMC8*>(p);
996 if (pmc8->ramp_movement(PMC8_S) && (pmc8->moveInfoDEC.state == PMC8_MOVE_RAMPING))
997 pmc8->moveInfoDEC.timer = IEAddTimer(pmc8->RampN[0].value, rampTimeoutHelperS, p);
998}
1000{
1001 PMC8* pmc8 = static_cast<PMC8*>(p);
1002 if (pmc8->ramp_movement(PMC8_W) && (pmc8->moveInfoRA.state == PMC8_MOVE_RAMPING))
1003 pmc8->moveInfoRA.timer = IEAddTimer(pmc8->RampN[0].value, rampTimeoutHelperW, p);
1004}
1006{
1007 PMC8* pmc8 = static_cast<PMC8*>(p);
1008 if (pmc8->ramp_movement(PMC8_E) && (pmc8->moveInfoRA.state == PMC8_MOVE_RAMPING))
1009 pmc8->moveInfoRA.timer = IEAddTimer(pmc8->RampN[0].value, rampTimeoutHelperE, p);
1010}
1011
1012
1014{
1015 if (TrackState == SCOPE_PARKED)
1016 {
1017 LOG_ERROR("Please unpark the mount before issuing any motion commands.");
1018 return false;
1019 }
1021 {
1022 LOG_ERROR("Mount is slewing. Wait to issue move command until goto completes.");
1023 return false;
1024 }
1025 if ((moveInfoDEC.state == PMC8_MOVE_ACTIVE) && (moveInfoDEC.moveDir != dir))
1026 {
1027 LOG_ERROR("Mount received command to move in opposite direction before stopping. This shouldn't happen.");
1028 return false;
1029 }
1030
1031 // read desired move rate
1032 int currentIndex = SlewRateSP.findOnSwitchIndex();
1033 LOGF_DEBUG("MoveNS at slew index %d", currentIndex);
1034
1035 switch (command)
1036 {
1037 case MOTION_START:
1038 moveInfoDEC.rampDir = PMC8_RAMP_UP;
1039 moveInfoDEC.targetRate = getSlewRate();
1040 // if we're still ramping down, we can bypass resetting the state and adding a timer
1041 // but we do need to make sure it's the same direction first (if not, kill our previous timer)
1042 if (moveInfoDEC.state == PMC8_MOVE_RAMPING)
1043 {
1044 if (moveInfoDEC.moveDir == dir) return true;
1045 IERmTimer(moveInfoDEC.timer);
1046 LOG_WARN("Started moving other direction before ramp down completed. This *may* cause mechanical problems with mount. It is adviseable to wait for axis movement to settle before switching directions.");
1047 }
1048 moveInfoDEC.moveDir = dir;
1049 moveInfoDEC.state = PMC8_MOVE_RAMPING;
1050 moveInfoDEC.rampIteration = 0;
1051 moveInfoDEC.rampLastStep = 0;
1052
1053 LOGF_INFO("Moving toward %s.", (dir == DIRECTION_NORTH) ? "North" : "South");
1054
1055 break;
1056
1057 case MOTION_STOP:
1058 // if we've already started moving other direction, no need to stop
1059 if (moveInfoDEC.moveDir != dir)
1060 {
1061 LOGF_DEBUG("Stop command issued for direction %d, but we're not moving that way", dir);
1062 return false;
1063 }
1064
1065 moveInfoDEC.rampDir = PMC8_RAMP_DOWN;
1066 // if we're still ramping up, we can bypass adding a timer
1067 if (moveInfoDEC.state == PMC8_MOVE_RAMPING) return true;
1068 moveInfoDEC.state = PMC8_MOVE_RAMPING;
1069
1070 LOGF_INFO("%s motion stopping.", (dir == DIRECTION_NORTH) ? "North" : "South");
1071
1072 break;
1073 }
1074
1075 if (dir == DIRECTION_NORTH)
1076 rampTimeoutHelperN(this);
1077 else
1078 rampTimeoutHelperS(this);
1079
1080 return true;
1081}
1082
1083
1085{
1086 if (TrackState == SCOPE_PARKED)
1087 {
1088 LOG_ERROR("Please unpark the mount before issuing any motion commands.");
1089 return false;
1090 }
1092 {
1093 LOG_ERROR("Mount is already slewing. Wait to issue move command until done slewing.");
1094 return false;
1095 }
1096 if ((moveInfoRA.state == PMC8_MOVE_ACTIVE) && (moveInfoRA.moveDir != dir))
1097 {
1098 LOG_ERROR("Mount received command to move in opposite direction before stopping. This shouldn't happen.");
1099 return false;
1100 }
1101
1102 // read desired move rate
1103 int currentIndex = SlewRateSP.findOnSwitchIndex();
1104 LOGF_DEBUG("MoveWE at slew index %d", currentIndex);
1105
1106 switch (command)
1107 {
1108 case MOTION_START:
1109 moveInfoRA.rampDir = PMC8_RAMP_UP;
1110 moveInfoRA.targetRate = getSlewRate();
1111 // if we're still ramping down, we can bypass resetting the state and adding a timer
1112 // but we do need to make sure it's the same direction first (if not, kill our previous timer)
1113 if (moveInfoRA.state == PMC8_MOVE_RAMPING)
1114 {
1115 if (moveInfoRA.moveDir == dir) return true;
1116 IERmTimer(moveInfoRA.timer);
1117 LOG_WARN("Started moving other direction before ramp down completed. This *may* cause mechanical problems with mount. It is adviseable to wait for axis movement to settle before switching directions.");
1118 }
1119 moveInfoRA.moveDir = dir;
1120 moveInfoRA.state = PMC8_MOVE_RAMPING;
1121 moveInfoRA.rampIteration = 0;
1122 moveInfoRA.rampLastStep = 0;
1123
1124 LOGF_INFO("Moving toward %s.", (dir == DIRECTION_WEST) ? "West" : "East");
1125
1126 break;
1127
1128 case MOTION_STOP:
1129 // if we've already started moving other direction, no need to stop
1130 if (moveInfoRA.moveDir != dir)
1131 {
1132 LOGF_DEBUG("Stop command issued for direction %d, but we're not moving that way", dir);
1133 return false;
1134 }
1135
1136 moveInfoRA.rampDir = PMC8_RAMP_DOWN;
1137 // if we're still ramping up, we can bypass adding a timer
1138 if (moveInfoRA.state == PMC8_MOVE_RAMPING) return true;
1139 moveInfoRA.state = PMC8_MOVE_RAMPING;
1140
1141 LOGF_INFO("%s motion stopping.", (dir == DIRECTION_WEST) ? "West" : "East");
1142
1143 break;
1144 }
1145
1146 if (dir == DIRECTION_EAST)
1147 rampTimeoutHelperE(this);
1148 else
1149 rampTimeoutHelperW(this);
1150
1151 return true;
1152}
1153
1155{
1156 IPState ret = IPS_IDLE;
1157 long timetaken_us = 0;
1158 int timeremain_ms = 0;
1159
1160 //only guide if tracking
1162 {
1163
1164 // If already moving, then stop movement
1165 if (MovementNSSP.getState() == IPS_BUSY)
1166 {
1167 int dir = MovementNSSP.findOnSwitchIndex();
1169 }
1170
1171 if (GuideNSTID)
1172 {
1174 GuideNSTID = 0;
1175 }
1176
1177 isPulsingNS = true;
1178 start_pmc8_guide(PortFD, PMC8_N, (int)ms, timetaken_us, 0);
1179
1180 timeremain_ms = (int)(ms - ((float)timetaken_us) / 1000.0);
1181
1182 if (timeremain_ms < 0)
1183 timeremain_ms = 0;
1184
1185 ret = IPS_BUSY;
1186 }
1187 else
1188 {
1189 LOG_INFO("Mount not tracking--cannot guide.");
1190 }
1191 GuideNSTID = IEAddTimer(timeremain_ms, guideTimeoutHelperN, this);
1192 return ret;
1193}
1194
1196{
1197 IPState ret = IPS_IDLE;
1198 long timetaken_us = 0;
1199 int timeremain_ms = 0;
1200
1201 //only guide if tracking
1203 {
1204
1205 // If already moving, then stop movement
1206 if (MovementNSSP.getState() == IPS_BUSY)
1207 {
1208 int dir = MovementNSSP.findOnSwitchIndex();
1210 }
1211
1212 if (GuideNSTID)
1213 {
1215 GuideNSTID = 0;
1216 }
1217
1218 isPulsingNS = true;
1219 start_pmc8_guide(PortFD, PMC8_S, (int)ms, timetaken_us, 0);
1220
1221 timeremain_ms = (int)(ms - ((float)timetaken_us) / 1000.0);
1222
1223 if (timeremain_ms < 0)
1224 timeremain_ms = 0;
1225
1226 ret = IPS_BUSY;
1227 }
1228 else
1229 {
1230 LOG_INFO("Mount not tracking--cannot guide.");
1231 }
1232 GuideNSTID = IEAddTimer(timeremain_ms, guideTimeoutHelperS, this);
1233 return ret;
1234}
1235
1237{
1238 IPState ret = IPS_IDLE;
1239 long timetaken_us = 0;
1240 int timeremain_ms = 0;
1241
1242 //only guide if tracking
1244 {
1245
1246 // If already moving (no pulse command), then stop movement
1247 if (MovementWESP.getState() == IPS_BUSY)
1248 {
1249 int dir = MovementWESP.findOnSwitchIndex();
1251 }
1252
1253 if (GuideWETID)
1254 {
1256 GuideWETID = 0;
1257 }
1258
1259 isPulsingWE = true;
1260
1261 start_pmc8_guide(PortFD, PMC8_E, (int)ms, timetaken_us, TrackRateNP[AXIS_RA].getValue() / SOLAR_SECOND);
1262
1263 timeremain_ms = (int)(ms - ((float)timetaken_us) / 1000.0);
1264
1265 if (timeremain_ms < 0)
1266 timeremain_ms = 0;
1267
1268 ret = IPS_BUSY;
1269 }
1270 else
1271 {
1272 LOG_INFO("Mount not tracking--cannot guide.");
1273 }
1274 GuideWETID = IEAddTimer(timeremain_ms, guideTimeoutHelperE, this);
1275 return ret;
1276}
1277
1279{
1280 IPState ret = IPS_IDLE;
1281 long timetaken_us = 0;
1282 int timeremain_ms = 0;
1283
1284 //only guide if tracking
1286 {
1287
1288 // If already moving (no pulse command), then stop movement
1289 if (MovementWESP.getState() == IPS_BUSY)
1290 {
1291 int dir = MovementWESP.findOnSwitchIndex();
1293 }
1294
1295 if (GuideWETID)
1296 {
1298 GuideWETID = 0;
1299 }
1300
1301 isPulsingWE = true;
1302 start_pmc8_guide(PortFD, PMC8_W, (int)ms, timetaken_us, TrackRateNP[AXIS_RA].getValue() / SOLAR_SECOND);
1303
1304 timeremain_ms = (int)(ms - ((float)timetaken_us) / 1000.0);
1305
1306 if (timeremain_ms < 0)
1307 timeremain_ms = 0;
1308
1309 ret = IPS_BUSY;
1310 }
1311 else
1312 {
1313 LOG_INFO("Mount not tracking--cannot guide.");
1314 }
1315 GuideWETID = IEAddTimer(timeremain_ms, guideTimeoutHelperW, this);
1316 return ret;
1317}
1318
1320{
1321 // end previous pulse command
1322 stop_pmc8_guide(PortFD, calldir);
1323
1324 if (calldir == PMC8_N || calldir == PMC8_S)
1325 {
1326 isPulsingNS = false;
1327 GuideNSNP[0].setValue(0);
1328 GuideNSNP[1].setValue(0);
1329 GuideNSNP.setState(IPS_IDLE);
1330 GuideNSTID = 0;
1331 GuideNSNP.apply();
1332 }
1333 if (calldir == PMC8_W || calldir == PMC8_E)
1334 {
1335 isPulsingWE = false;
1336 GuideWENP[0].setValue(0);
1337 GuideWENP[1].setValue(0);
1338 GuideWENP.setState(IPS_IDLE);
1339 GuideWETID = 0;
1340 GuideWENP.apply();
1341 }
1342
1343 LOG_DEBUG("GUIDE CMD COMPLETED");
1344}
1345
1346//GUIDE The timer helper functions.
1348{
1349 static_cast<PMC8*>(p)->guideTimeout(PMC8_N);
1350}
1352{
1353 static_cast<PMC8*>(p)->guideTimeout(PMC8_S);
1354}
1356{
1357 static_cast<PMC8*>(p)->guideTimeout(PMC8_W);
1358}
1360{
1361 static_cast<PMC8*>(p)->guideTimeout(PMC8_E);
1362}
1363
1364bool PMC8::SetSlewRate(int index)
1365{
1366
1367 INDI_UNUSED(index);
1368
1369 // slew rate is rate for MoveEW/MOVENE commands - not for GOTOs!!!
1370
1371 // just return true - we will check SlewRateSP when we do actually moves
1372 return true;
1373}
1374
1376{
1378
1379 IUSaveConfigSwitch(fp, &SerialCableTypeSP);
1380 IUSaveConfigSwitch(fp, &MountModelSP);
1381 IUSaveConfigNumber(fp, &RampNP);
1382 IUSaveConfigNumber(fp, &LegacyGuideRateNP);
1383 IUSaveConfigSwitch(fp, &PostGotoSP);
1384
1385 return true;
1386}
1387
1389{
1390 static struct timeval ltv;
1391 struct timeval tv;
1392 double dt, da, dx;
1393 int nlocked;
1394
1395 /* update elapsed time since last poll, don't presume exactly POLLMS */
1396 gettimeofday(&tv, nullptr);
1397
1398 if (ltv.tv_sec == 0 && ltv.tv_usec == 0)
1399 ltv = tv;
1400
1401 dt = tv.tv_sec - ltv.tv_sec + (tv.tv_usec - ltv.tv_usec) / 1e6;
1402 ltv = tv;
1403 da = SLEWRATE * dt;
1404
1405 /* Process per current state. We check the state of EQUATORIAL_COORDS and act accordingly */
1406 switch (TrackState)
1407 {
1408 case SCOPE_IDLE:
1409 currentRA += (TrackRateNP[AXIS_RA].getValue() / 3600.0 * dt) / 15.0;
1410 currentRA = range24(currentRA);
1411 break;
1412
1413 case SCOPE_TRACKING:
1414 if (TrackModeSP[1].getState() == ISS_ON)
1415 {
1416 currentRA += ( ((TRACKRATE_SIDEREAL / 3600.0) - (TrackRateNP[AXIS_RA].getValue() / 3600.0)) * dt) / 15.0;
1417 currentDEC += ( (TrackRateNP[AXIS_DE].getValue() / 3600.0) * dt);
1418 }
1419 break;
1420
1421 case SCOPE_SLEWING:
1422 case SCOPE_PARKING:
1423 /* slewing - nail it when both within one pulse @ SLEWRATE */
1424 nlocked = 0;
1425
1426 dx = targetRA - currentRA;
1427
1428 // Take shortest path
1429 if (fabs(dx) > 12)
1430 dx *= -1;
1431
1432 if (fabs(dx) <= da)
1433 {
1434 currentRA = targetRA;
1435 nlocked++;
1436 }
1437 else if (dx > 0)
1438 currentRA += da / 15.;
1439 else
1440 currentRA -= da / 15.;
1441
1442 if (currentRA < 0)
1443 currentRA += 24;
1444 else if (currentRA > 24)
1445 currentRA -= 24;
1446
1447 dx = targetDEC - currentDEC;
1448 if (fabs(dx) <= da)
1449 {
1450 currentDEC = targetDEC;
1451 nlocked++;
1452 }
1453 else if (dx > 0)
1454 currentDEC += da;
1455 else
1456 currentDEC -= da;
1457
1458 if (nlocked == 2)
1459 {
1462 else
1464 }
1465
1466 break;
1467
1468 case SCOPE_PARKED:
1469 TelescopePierSide unused;
1470 // setting system status to parked will automatically
1471 // set the simulated RA/DEC to park position so reread
1473 get_pmc8_coords(PortFD, currentRA, currentDEC, unused);
1474
1475 break;
1476
1477 default:
1478 break;
1479 }
1480
1481 set_pmc8_sim_ra(currentRA);
1482 set_pmc8_sim_dec(currentDEC);
1483}
1484
1485// PMC8 parks to motor position (0, 0) which corresponds to HA=6h, DEC=+/-90
1486// Southern Hemisphere support: Use get_pmc8_east_dir() to determine proper DEC park position
1488{
1489 SetAxis1Park(currentRA);
1490 SetAxis2Park(currentDEC);
1491
1492 return true;
1493}
1494
1496{
1497 // By default set RA to HA (Hour Angle)
1498 SetAxis1Park(ln_get_apparent_sidereal_time(ln_get_julian_from_sys()));
1499
1500 // Set DEC to 90 or -90 depending on the hemisphere
1501 // get_pmc8_east_dir() returns 1 for northern hemisphere, 0 for southern
1502 // In northern hemisphere, park pointing at north celestial pole (DEC +90)
1503 // In southern hemisphere, park pointing at south celestial pole (DEC -90)
1504 SetAxis2Park(get_pmc8_east_dir() ? 90.0 : -90.0);
1505
1506 return true;
1507}
1508
1509uint8_t PMC8::convertToPMC8TrackMode(uint8_t mode)
1510{
1511 switch (mode)
1512 {
1513 case TRACK_SIDEREAL:
1514 return PMC8_TRACK_SIDEREAL;
1515 break;
1516 case TRACK_LUNAR:
1517 return PMC8_TRACK_LUNAR;
1518 break;
1519 case TRACK_SOLAR:
1520 return PMC8_TRACK_SOLAR;
1521 break;
1522 case TRACK_CUSTOM:
1523 return PMC8_TRACK_CUSTOM;
1524 break;
1525 default:
1526 return PMC8_TRACK_UNDEFINED;
1527 }
1528}
1529
1530uint8_t PMC8::convertFromPMC8TrackMode(uint8_t mode)
1531{
1532 switch (mode)
1533 {
1535 return TRACK_SIDEREAL;
1536 break;
1537 case PMC8_TRACK_LUNAR:
1538 return TRACK_LUNAR;
1539 break;
1540 case PMC8_TRACK_SOLAR:
1541 return TRACK_SOLAR;
1542 break;
1543 default:
1544 return TRACK_CUSTOM;
1545 }
1546}
1547
1548bool PMC8::SetTrackMode(uint8_t mode)
1549{
1550 uint8_t pmc8_mode;
1551
1552 LOGF_DEBUG("PMC8::SetTrackMode called mode=%d", mode);
1553
1554 pmc8_mode = convertToPMC8TrackMode(mode);
1555
1556 if (pmc8_mode == PMC8_TRACK_UNDEFINED)
1557 {
1558 LOGF_ERROR("PMC8::SetTrackMode mode=%d not supported!", mode);
1559 return false;
1560 }
1561
1562 if (pmc8_mode == PMC8_TRACK_CUSTOM)
1563 {
1565 {
1566 return true;
1567 }
1568 }
1569 else
1570 {
1571 if (set_pmc8_track_mode(PortFD, pmc8_mode))
1572 return true;
1573 }
1574
1575 return false;
1576}
1577
1578bool PMC8::SetTrackRate(double raRate, double deRate)
1579{
1580 static bool deRateWarning = true;
1581 double pmc8RARate;
1582
1583 LOGF_INFO("Custom tracking rate set: raRate=%f deRate=%f", raRate, deRate);
1584
1585 // for now just send rate
1586 pmc8RARate = raRate / SOLAR_SECOND;
1587
1588 if (deRate != 0 && deRateWarning)
1589 {
1590 // Only send warning once per session
1591 deRateWarning = false;
1592 LOG_WARN("Custom Declination tracking rate is not implemented yet.");
1593 }
1594
1595 if (set_pmc8_ra_tracking(PortFD, pmc8RARate))
1596 return true;
1597
1598 LOG_ERROR("PMC8::SetTrackRate not implemented!");
1599 return false;
1600}
1601
1602bool PMC8::SetTrackEnabled(bool enabled)
1603{
1604
1605 LOGF_DEBUG("PMC8::SetTrackEnabled called enabled=%d", enabled);
1606
1607 // need to determine current tracking mode and start tracking
1608 if (enabled)
1609 {
1610 if (!SetTrackMode(TrackModeSP.findOnSwitchIndex()))
1611 {
1612 LOG_ERROR("PMC8::SetTrackEnabled - unable to enable tracking");
1613 return false;
1614 }
1615 }
1616 else
1617 {
1618 bool rc;
1619
1621 if (!rc)
1622 {
1623 LOG_ERROR("PMC8::SetTrackEnabled - unable to set RA track rate to 0");
1624 return false;
1625 }
1626
1627 // currently only support tracking rate in RA
1628 // rc=set_pmc8_custom_dec_track_rate(PortFD, 0);
1629 // if (!rc)
1630 // {
1631 // LOG_ERROR("PMC8::SetTrackREnabled - unable to set DEC track rate to 0");
1632 // return false;
1633 // }
1634 }
1635
1636 return true;
1637}
1638
bool isConnected() const
virtual bool saveConfig(bool silent=false, const char *property=nullptr)
Save the current properties in a configuration file.
virtual bool Disconnect()
Disconnect from device.
virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg=nullptr)
Set connection switch status in the client.
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 addAuxControls()
Add Debug, Simulation, and Configuration options to the driver.
uint32_t getDriverInterface() const
Connection::Interface * getActiveConnection()
virtual bool Connect()
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
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.
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.
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.
Connection::Serial * serialConnection
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....
Connection::TCP * tcpConnection
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...
TelescopeStatus RememberTrackState
RememberTrackState Remember last state of Track State to fall back to in case of errors or aborts.
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....
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.
void SetAxis2ParkDefault(double steps)
SetDEParkDefault Set default DEC/ALT parking position.
Definition pmc8.h:52
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition pmc8.cpp:349
static void guideTimeoutHelperE(void *p)
Definition pmc8.cpp:1359
virtual void simulationTriggered(bool enable) override
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
Definition pmc8.cpp:900
virtual bool SetSlewRate(int index) override
SetSlewRate Set desired slew rate index.
Definition pmc8.cpp:1364
bool ramp_movement(PMC8_DIRECTION calldir)
Definition pmc8.cpp:913
virtual bool Handshake() override
perform handshake with device to check communication
Definition pmc8.cpp:832
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
Definition pmc8.cpp:1495
PMC8()
Definition pmc8.cpp:59
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition pmc8.cpp:1375
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
Definition pmc8.cpp:1013
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
Definition pmc8.cpp:171
static void rampTimeoutHelperN(void *p)
Definition pmc8.cpp:987
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
Definition pmc8.cpp:690
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...
Definition pmc8.cpp:398
~PMC8() override
Definition pmc8.cpp:77
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
Definition pmc8.cpp:856
static void AbortGotoTimeoutHelper(void *p)
Definition pmc8.cpp:717
virtual const char * getDefaultName() override
Definition pmc8.cpp:81
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
Definition pmc8.cpp:1602
static void rampTimeoutHelperS(void *p)
Definition pmc8.cpp:993
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
Definition pmc8.cpp:1154
virtual bool ReadScopeStatus() override
Read telescope status.
Definition pmc8.cpp:453
int GuideNSTID
Definition pmc8.h:127
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
Definition pmc8.cpp:1084
static void rampTimeoutHelperE(void *p)
Definition pmc8.cpp:1005
virtual bool Park() override
Park the telescope to its home position.
Definition pmc8.cpp:787
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
Definition pmc8.cpp:1487
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
Definition pmc8.cpp:895
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
Definition pmc8.cpp:1578
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
Definition pmc8.cpp:1278
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
Definition pmc8.cpp:867
void mountSim()
Definition pmc8.cpp:1388
static void guideTimeoutHelperS(void *p)
Definition pmc8.cpp:1351
static void guideTimeoutHelperW(void *p)
Definition pmc8.cpp:1355
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition pmc8.cpp:86
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition pmc8.cpp:416
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
Definition pmc8.cpp:1236
static void guideTimeoutHelperN(void *p)
Definition pmc8.cpp:1347
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
Definition pmc8.cpp:723
void guideTimeout(PMC8_DIRECTION calldir)
Definition pmc8.cpp:1319
virtual bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
Definition pmc8.cpp:636
virtual bool UnPark() override
Unpark the telescope if already parked.
Definition pmc8.cpp:818
static void rampTimeoutHelperW(void *p)
Definition pmc8.cpp:999
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
Definition pmc8.cpp:1195
int GuideWETID
Definition pmc8.h:128
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
Definition pmc8.cpp:1548
int getSlewRate()
Definition pmc8.cpp:905
const char * GUIDE_TAB
GUIDE_TAB Where all the properties for guiding are located.
const char * CONNECTION_TAB
CONNECTION_TAB Where all device connection settings (serial, usb, ethernet) are defined and controlle...
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.
void IERmTimer(int timerid)
Remove the timer with the given timerid, as returned from IEAddTimer() or IEAddPeriodicTimer().
Definition eventloop.c:606
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.
Definition eventloop.c:586
INDI::PropertyNumber TrackRateNP
INDI::PropertySwitch MovementNSSP
INDI::PropertyNumber EqNP
INDI::PropertySwitch TrackStateSP
INDI::PropertySwitch SlewRateSP
INDI::PropertySwitch TrackModeSP
INDI::PropertySwitch MovementWESP
INDI::PropertySwitch ParkOptionSP
INDI::PropertyNumber LocationNP
INDI::PropertyNumber ParkPositionNP
#define SLEWRATE
Definition ieqpro.cpp:35
double ra
void set_sim_system_status(IEQ_SYSTEM_STATUS value)
double dec
@ ST_STOPPED
@ ST_PARKED
ISState
Switch state.
Definition indiapi.h:148
@ ISS_OFF
Definition indiapi.h:149
@ ISS_ON
Definition indiapi.h:150
@ IP_RW
Definition indiapi.h:184
@ IP_RO
Definition indiapi.h:182
IPState
Property state.
Definition indiapi.h:158
@ IPS_BUSY
Definition indiapi.h:161
@ IPS_ALERT
Definition indiapi.h:162
@ IPS_IDLE
Definition indiapi.h:159
@ IPS_OK
Definition indiapi.h:160
@ ISR_1OFMANY
Definition indiapi.h:171
@ AXIS_DE
@ AXIS_RA
INDI_DIR_WE
@ DIRECTION_EAST
@ DIRECTION_WEST
INDI_DIR_NS
@ DIRECTION_SOUTH
@ DIRECTION_NORTH
double range24(double r)
range24 Limits a number to be between 0-24 range.
Definition indicom.c:1311
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[].
Definition indicom.c:130
Implementations for common driver routines.
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
Definition indidevapi.c:33
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.
Definition indidevapi.c:490
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
Definition indidevapi.c:337
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
Definition indidevapi.c:366
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.
Definition indidevapi.c:509
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Definition indidevapi.c:44
void IUSaveConfigNumber(FILE *fp, const INumberVectorProperty *nvp)
Add a number vector property value to the configuration file.
Definition indidevapi.c:23
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.
Definition indidevapi.c:376
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.
Definition indidevapi.c:416
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.
Definition indidevapi.c:398
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.
Definition indidevapi.c:453
#define INDI_UNUSED(x)
Definition indidevapi.h:132
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 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,...)
INDI::GuiderInterface GI
*brief user defined string literal for JSON values *sa std::size_t n
#define LOGF_INFO(fmt,...)
Definition indilogger.h:82
#define LOG_DEBUG(txt)
Definition indilogger.h:75
#define LOGF_EXTRA3(fmt,...)
Definition indilogger.h:86
#define LOG_WARN(txt)
Definition indilogger.h:73
#define LOGF_DEBUG(fmt,...)
Definition indilogger.h:83
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
Definition indilogger.h:72
#define LOGF_ERROR(fmt,...)
Definition indilogger.h:80
#define LOG_INFO(txt)
Definition indilogger.h:74
#define TRACKRATE_SIDEREAL
Definition indimacros.h:39
#define getDeviceName
#define PMC8_TRACKING_AUTODETECT_INTERVAL
Definition pmc8.cpp:52
#define PMC8_DEFAULT_IP_ADDRESS
Definition pmc8.cpp:51
#define PMC8_VERSION_MINOR
Definition pmc8.cpp:54
#define PMC8_DEFAULT_PORT
Definition pmc8.cpp:50
#define PMC8_VERSION_MAJOR
Definition pmc8.cpp:53
@ PMC8_MOVE_INACTIVE
Definition pmc8.h:33
@ PMC8_MOVE_RAMPING
Definition pmc8.h:33
@ PMC8_MOVE_ACTIVE
Definition pmc8.h:33
#define SOLAR_SECOND
Definition pmc8.h:37
@ PMC8_RAMP_UP
Definition pmc8.h:34
@ PMC8_RAMP_DOWN
Definition pmc8.h:34
bool get_pmc8_guide_rate(int fd, PMC8_AXIS axis, double &rate)
void set_pmc8_location(double latitude, double longitude)
bool set_pmc8_custom_ra_track_rate(int fd, double rate)
bool start_pmc8_guide(int fd, PMC8_DIRECTION gdir, int ms, long &timetaken_us, double ratehint)
void set_pmc8_sim_system_status(PMC8_SYSTEM_STATUS value)
void set_pmc8_device(const char *name)
bool park_pmc8(int fd)
bool stop_pmc8_guide(int fd, PMC8_DIRECTION gdir)
void set_pmc8_debug(bool enable)
bool sync_pmc8(int fd, double ra, double dec)
bool abort_pmc8_goto(int fd)
bool slew_pmc8(int fd, double ra, double dec)
bool get_pmc8_is_scope_slewing(int fd, bool &isslew)
bool set_pmc8_track_mode(int fd, uint8_t mode)
bool set_pmc8_radec(int fd, double ra, double dec)
void set_pmc8_mountParameters(int index)
bool set_pmc8_guide_rate(int fd, PMC8_AXIS axis, double rate)
void set_pmc8_simulation(bool enable)
bool get_pmc8_coords(int fd, double &ra, double &dec, INDI::Telescope::TelescopePierSide &sop)
void set_pmc8_goto_resume(bool resume)
bool get_pmc8_firmware(int fd, FirmwareInfo *info)
bool abort_pmc8(int fd)
bool get_pmc8_reconnect_flag()
bool get_pmc8_tracking_data(int fd, double &rate, uint8_t &mode)
bool check_pmc8_connection(int fd, PMC8_CONNECTION_TYPE connection)
bool unpark_pmc8(int fd)
int get_pmc8_east_dir()
void set_pmc8_sim_move_rate(int value)
bool stop_pmc8_tracking_motion(int fd)
void set_pmc8_sim_track_rate(PMC8_TRACK_RATE value)
void set_pmc8_sim_ra(double ra)
bool set_pmc8_ra_tracking(int fd, double rate)
void set_pmc8_sim_dec(double dec)
bool set_pmc8_move_rate_axis(int fd, PMC8_DIRECTION dir, int reqrate)
PMC8_CONNECTION_TYPE
Definition pmc8driver.h:68
@ PMC8_SERIAL_AUTO
Definition pmc8driver.h:68
@ PMC8_ETHERNET
Definition pmc8driver.h:68
@ PMC8_SERIAL_STANDARD
Definition pmc8driver.h:68
@ PMC8_SERIAL_INVERTED
Definition pmc8driver.h:68
#define PMC8_MAX_MOVE_RATE
Definition pmc8driver.h:41
@ MOUNT_G11
Definition pmc8driver.h:66
@ MOUNT_iEXOS100
Definition pmc8driver.h:66
@ MOUNT_EXOS2
Definition pmc8driver.h:66
@ PMC8_TRACK_CUSTOM
Definition pmc8driver.h:59
@ PMC8_TRACK_SIDEREAL
Definition pmc8driver.h:59
@ PMC8_TRACK_LUNAR
Definition pmc8driver.h:59
@ PMC8_TRACK_SOLAR
Definition pmc8driver.h:59
@ PMC8_TRACK_UNDEFINED
Definition pmc8driver.h:59
@ ST_TRACKING
Definition pmc8driver.h:49
@ PMC8_AXIS_DEC
Definition pmc8driver.h:63
@ PMC8_AXIS_RA
Definition pmc8driver.h:63
PMC8_DIRECTION
Definition pmc8driver.h:64
@ PMC8_N
Definition pmc8driver.h:64
@ PMC8_W
Definition pmc8driver.h:64
@ PMC8_S
Definition pmc8driver.h:64
@ PMC8_E
Definition pmc8driver.h:64
#define PMC8_MAX_TRACK_RATE
Definition pmc8driver.h:38
PMC8_MOUNT_TYPES MountType
Definition pmc8driver.h:81
std::string MainBoardFirmware
PMC8_RAMP_DIRECTION rampDir
Definition pmc8.h:46
int targetRate
Definition pmc8.h:43
int rampLastStep
Definition pmc8.h:45
int timer
Definition pmc8.h:47
PMC8_MOVE_STATE state
Definition pmc8.h:41
int rampIteration
Definition pmc8.h:44
double round(double value, int decimal_places)