diff options
author | Your Name <you@example.com> | 2023-01-28 18:37:44 +0000 |
---|---|---|
committer | Your Name <you@example.com> | 2023-01-28 18:37:44 +0000 |
commit | 62ab8c22bec268b2e0687ace63ce7148825fb428 (patch) | |
tree | a3ce415a3cbb18440d353b5a292a22625c8961fb /indi-lxd650 | |
parent | 5c0ead2447835109417269372bf365873b358e35 (diff) | |
download | indi_mount_driver-62ab8c22bec268b2e0687ace63ce7148825fb428.tar.gz indi_mount_driver-62ab8c22bec268b2e0687ace63ce7148825fb428.tar.bz2 indi_mount_driver-62ab8c22bec268b2e0687ace63ce7148825fb428.zip |
add tracking rate control to lxd650, make tracking on celestron configurable
Diffstat (limited to 'indi-lxd650')
-rw-r--r-- | indi-lxd650/lxd650.cpp | 136 | ||||
-rw-r--r-- | indi-lxd650/lxd650.h | 32 |
2 files changed, 127 insertions, 41 deletions
diff --git a/indi-lxd650/lxd650.cpp b/indi-lxd650/lxd650.cpp index 7a67d61..9dfe8a0 100644 --- a/indi-lxd650/lxd650.cpp +++ b/indi-lxd650/lxd650.cpp @@ -54,7 +54,13 @@ LXD650::LXD650() DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE"); - SetTelescopeCapability(TELESCOPE_CAN_SYNC | TELESCOPE_CAN_GOTO | TELESCOPE_CAN_ABORT | TELESCOPE_HAS_LOCATION | TELESCOPE_HAS_TIME , 4); + SetTelescopeCapability(TELESCOPE_CAN_SYNC | + TELESCOPE_CAN_GOTO | + TELESCOPE_CAN_ABORT | + TELESCOPE_HAS_LOCATION | + TELESCOPE_HAS_TIME, + 4); + LOG_DEBUG("Initializing from LX200 Basic device..."); @@ -92,6 +98,19 @@ bool LXD650::initProperties() IUFillNumberVector(&SlewAccuracyNP, SlewAccuracyN, NARRAY(SlewAccuracyN), getDeviceName(), "Slew Accuracy", "", OPTIONS_TAB, IP_RW, 0, IPS_IDLE); + LXDTrackModeSP[LXD_TRACK_SIDEREAL].fill("TRACK_SIDEREAL", "Sidereal", ISS_ON); + LXDTrackModeSP[LXD_TRACK_SOLAR].fill("TRACK_SOLAR", "Solar", ISS_OFF); + LXDTrackModeSP[LXD_TRACK_LUNAR].fill("TRACK_LUNAR", "Lunar", ISS_OFF); + LXDTrackModeSP[LXD_TRACK_CUSTOM].fill("TRACK_CUSTOM", "Custom", ISS_OFF); + LXDTrackModeSP.fill(getDeviceName(), "LXD_TRACK_MODE", "Track Mode", MAIN_CONTROL_TAB, IP_RW, ISR_1OFMANY, 60, IPS_IDLE); + + IUFillNumber(&LXDTrackRateN, "LXD_TRACK_RATE_RA", "RA (arcsecs/s)", "%.6f", -16384.0, 16384.0, 0.000001, + TRACKRATE_SIDEREAL); + IUFillNumberVector(&LXDTrackRateNP, &LXDTrackRateN, 1, getDeviceName(), "LXD_TRACK_RATE", "Track Rates", MAIN_CONTROL_TAB, + IP_RW, 60, IPS_IDLE); + + + addAuxControls(); currentRA = get_local_sidereal_time(LocationN[LOCATION_LONGITUDE].value); @@ -124,24 +143,22 @@ bool LXD650::updateProperties() if (isConnected()) { defineProperty(&SlewAccuracyNP); + defineProperty(&LXDTrackModeSP); + defineProperty(&LXDTrackRateNP); defineProperty(&GuideNSNP); defineProperty(&GuideWENP); defineProperty(&GuideRateNP); -#if 0 - // We don't support NSWE controls (yet) - deleteProperty(MovementNSSP.name); - deleteProperty(MovementWESP.name); -#endif - getBasicData(); } else { - deleteProperty(GuideNSNP.name); - deleteProperty(GuideWENP.name); deleteProperty(GuideRateNP.getName()); + deleteProperty(GuideWENP.name); + deleteProperty(GuideNSNP.name); + deleteProperty(LXDTrackRateNP.name); + deleteProperty(LXDTrackModeSP.getName()); deleteProperty(SlewAccuracyNP.name); } @@ -216,6 +233,17 @@ bool LXD650::ReadScopeStatus() return false; } + int mode = IUFindOnSwitchIndex(&LXDTrackModeSP); + + if (mode != LXD_TRACK_CUSTOM) { + double rate; + if (!getTrackFreq(PortFD, &rate)) { + LXDTrackRateN.value = rate * (TRACKRATE_SOLAR / 60.); + IDSetNumber(&LXDTrackRateNP, nullptr); + } + } + + if (TrackState == SCOPE_SLEWING) { // Check if LX200 is done slewing @@ -232,8 +260,8 @@ bool LXD650::ReadScopeStatus() double sky_RA, sky_DEC; if (!TelescopeEquatorialToSky(currentRA, currentDEC, sky_RA, sky_DEC)) { - sky_RA = currentRA; - sky_DEC = currentDEC; + sky_RA = currentRA; + sky_DEC = currentDEC; } NewRaDec(sky_RA, sky_DEC); @@ -257,8 +285,8 @@ bool LXD650::Goto(double r, double d) double mount_r, mount_d; if (!SkyToTelescopeEquatorial(r, d, mount_r, mount_d)) { - mount_r = r; - mount_d = d; + mount_r = r; + mount_d = d; } show_alignment("Sky->Mount", r, d, mount_r, mount_d); @@ -566,6 +594,18 @@ bool LXD650::ISNewNumber(const char *dev, const char *name, double values[], cha return true; } + // Guide Rate + if (!strcmp(name, LXDTrackRateNP.name)) + { + if (IUUpdateNumber(&LXDTrackRateNP, values, names, n) < 0) + return false; + + LXDTrackRateNP.s = IPS_OK; + + IDSetNumber(&LXDTrackRateNP, nullptr); + + return LXDSetTrackRate(LXDTrackRateN.value); + } // Guide Rate if (GuideRateNP.isNameMatch(name)) @@ -595,12 +635,20 @@ bool LXD650::ISNewSwitch(const char *dev, const char *name, ISState *states, cha { // Process alignment properties ProcessAlignmentSwitchProperties(this, name, states, names, n); - } + if (LXDTrackModeSP.isNameMatch(name)) + { + LXDTrackModeSP.update(states, names, n); + LXDTrackModeSP.setState(IPS_OK); + LXDTrackModeSP.apply(); + + return LXDSetTrackMode(IUFindOnSwitchIndex(&LXDTrackModeSP)); + } + } return INDI::Telescope::ISNewSwitch(dev, name, states, names, n); } -///////////////////////////////////////////////////////////////////////////////////// + /// ///////////////////////////////////////////////////////////////////////////////////// bool LXD650::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) @@ -612,6 +660,34 @@ bool LXD650::ISNewText(const char *dev, const char *name, char *texts[], char *n } +bool LXD650::LXDSetTrackRate(double rate) +{ + rate *= 60. / TRACKRATE_SOLAR; + + selectTrackingMode(PortFD, LX200_TRACK_SIDEREAL); //not sideral but "Quartz" + + if (setTrackFreq(PortFD, rate)) + return false; + + return true; +} + +bool LXD650::LXDSetTrackMode(uint8_t mode) +{ + double rate = TRACKRATE_SIDEREAL; + + if (mode == LXD_TRACK_SOLAR) + rate = TRACKRATE_SOLAR; + else if (mode == LXD_TRACK_LUNAR) + rate = TRACKRATE_LUNAR; + else if (mode == LXD_TRACK_CUSTOM) + rate = TrackRateN[AXIS_RA].value; + + return LXDSetTrackRate(rate); +} + + + ///////////////////////////////////////////////////////////////////////////////////// /// @@ -790,7 +866,7 @@ void LXD650::set_slew_rate_from_property(void) enum TSlew rates[]={LX200_SLEW_GUIDE,LX200_SLEW_FIND,LX200_SLEW_CENTER,LX200_SLEW_GUIDE}; if (rate>=(sizeof(rates)/sizeof(rates[0]))) - return; + return; setSlewMode(PortFD, rates[rate]); } @@ -801,19 +877,19 @@ void LXD650::set_slew_rate_from_property(void) bool LXD650::MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) { if (command == MOTION_START) { - set_slew_rate_from_property(); + set_slew_rate_from_property(); - if (dir == DIRECTION_NORTH) { + if (dir == DIRECTION_NORTH) { MoveTo(PortFD, LX200_NORTH); - } else { + } else { MoveTo(PortFD, LX200_SOUTH); - } + } } else { - if (dir == DIRECTION_NORTH) { + if (dir == DIRECTION_NORTH) { HaltMovement(PortFD, LX200_NORTH); - } else { + } else { HaltMovement(PortFD, LX200_SOUTH); - } + } } return true; @@ -825,19 +901,19 @@ bool LXD650::MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) bool LXD650::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) { if (command == MOTION_START) { - set_slew_rate_from_property(); + set_slew_rate_from_property(); - if (dir == DIRECTION_WEST) { + if (dir == DIRECTION_WEST) { MoveTo(PortFD, LX200_WEST); - } else { + } else { MoveTo(PortFD, LX200_EAST); - } + } } else { - if (dir == DIRECTION_WEST) { + if (dir == DIRECTION_WEST) { HaltMovement(PortFD, LX200_WEST); - } else { + } else { HaltMovement(PortFD, LX200_EAST); - } + } } return true; diff --git a/indi-lxd650/lxd650.h b/indi-lxd650/lxd650.h index 0e24976..65f1341 100644 --- a/indi-lxd650/lxd650.h +++ b/indi-lxd650/lxd650.h @@ -48,10 +48,10 @@ class LXD650 : public INDI::Telescope, virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override; virtual bool ISSnoopDevice(XMLEle *root) override; - static void GuideNorthProxy(void *context); - static void GuideSouthProxy(void *context); - static void GuideWestProxy(void *context); - static void GuideEastProxy(void *context); + static void GuideNorthProxy(void *context); + static void GuideSouthProxy(void *context); + static void GuideWestProxy(void *context); + static void GuideEastProxy(void *context); protected: @@ -76,6 +76,7 @@ class LXD650 : public INDI::Telescope, virtual bool updateLocation(double latitude, double longitude, double elevation) override; + protected: bool isSlewComplete(); void slewError(int slewCode); @@ -89,14 +90,23 @@ class LXD650 : public INDI::Telescope, uint32_t DBG_SCOPE = 0; private: + bool LXDSetTrackMode(uint8_t mode); + bool LXDSetTrackRate(double rate); + + INumber LXDTrackRateN; + INumberVectorProperty LXDTrackRateNP; + + INDI::PropertySwitch LXDTrackModeSP {4}; + enum { LXD_TRACK_SIDEREAL, LXD_TRACK_SOLAR, LXD_TRACK_LUNAR, LXD_TRACK_CUSTOM }; + INDI::PropertyNumber GuideRateNP {2}; bool guidePulse(INDI_EQ_AXIS axis, uint32_t ms, int8_t rate); void show_alignment(const char *wot, double ra1,double dec1, double ra2,double dec2); - int GuideNorth_TID {0}; - int GuideSouth_TID {0}; - int GuideWest_TID {0}; - int GuideEast_TID {0}; + int GuideNorth_TID {0}; + int GuideSouth_TID {0}; + int GuideWest_TID {0}; + int GuideEast_TID {0}; void GuideNorthCB(void); void GuideSouthCB(void); @@ -106,9 +116,9 @@ class LXD650 : public INDI::Telescope, virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years); virtual bool setLocalTime24(uint8_t hour, uint8_t minute, uint8_t second); virtual bool setUTCOffset(double offset); - - void set_slew_rate_from_property(void); - void show_guide (const char *dir, int ms); + + void set_slew_rate_from_property(void); + void show_guide (const char *dir, int ms); }; |