diff options
Diffstat (limited to 'indi-lxd650/lxd650.cpp')
-rw-r--r-- | indi-lxd650/lxd650.cpp | 95 |
1 files changed, 90 insertions, 5 deletions
diff --git a/indi-lxd650/lxd650.cpp b/indi-lxd650/lxd650.cpp index 995145d..c47b29a 100644 --- a/indi-lxd650/lxd650.cpp +++ b/indi-lxd650/lxd650.cpp @@ -54,7 +54,7 @@ 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..."); @@ -84,6 +84,7 @@ bool LXD650::initProperties() { /* Make sure to init parent properties first */ INDI::Telescope::initProperties(); + setDriverInterface(getDriverInterface() | GUIDER_INTERFACE); // Slew threshold IUFillNumber(&SlewAccuracyN[0], "SlewRA", "RA (arcmin)", "%10.6m", 0., 60., 1., 3.0); @@ -108,6 +109,7 @@ bool LXD650::initProperties() GuideRateNP.fill(getDeviceName(), "GUIDE_RATE", "Guiding Rate", GUIDE_TAB, IP_RW, 0, IPS_IDLE); setDriverInterface(getDriverInterface() | GUIDER_INTERFACE); +// SetTelescopeCapability(GetTelescopeCapability() | TELESCOPE_HAS_PIER_SIDE, 4); return true; } @@ -123,14 +125,23 @@ bool LXD650::updateProperties() { defineProperty(&SlewAccuracyNP); - // We don't support NSWE controls + 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(SlewAccuracyNP.name); } @@ -230,6 +241,9 @@ bool LXD650::ReadScopeStatus() show_alignment("Mount->Sky", currentRA, currentDEC, sky_RA, sky_DEC); #endif +// setPierSide(PIER_UNKNOWN); +// setPierSide(PIER_WEST); + return true; } @@ -604,9 +618,14 @@ bool LXD650::ISNewText(const char *dev, const char *name, char *texts[], char *n // // // -//void +// ///////////////////////////////////////////////////////////////////////////////////// -// + +void LXD650::show_guide (const char *dir, int ms) +{ + LOGF_INFO ("Guiding %s for %d ms", dir, ms); +} + void LXD650::GuideNorthCB(void) @@ -637,8 +656,9 @@ IPState LXD650::GuideNorth(uint32_t ms) } - MoveTo(PortFD, LX200_NORTH); + show_guide("N", ms); + MoveTo(PortFD, LX200_NORTH); GuideNorth_TID = IEAddTimer(ms, GuideNorthProxy, this); return IPS_BUSY; @@ -672,6 +692,7 @@ IPState LXD650::GuideSouth(uint32_t ms) GuideSouth_TID = 0; } + show_guide("S", ms); MoveTo(PortFD, LX200_SOUTH); @@ -708,6 +729,7 @@ IPState LXD650::GuideWest(uint32_t ms) GuideWest_TID = 0; } + show_guide("W", ms); MoveTo(PortFD, LX200_WEST); @@ -744,6 +766,7 @@ IPState LXD650::GuideEast(uint32_t ms) GuideEast_TID = 0; } + show_guide("E", ms); MoveTo(PortFD, LX200_EAST); @@ -753,6 +776,68 @@ IPState LXD650::GuideEast(uint32_t ms) } +///////////////////////////////////////////////////////////////////////////////////// +/// +///////////////////////////////////////////////////////////////////////////////////// +void LXD650::set_slew_rate_from_property(void) +{ + unsigned rate = IUFindOnSwitchIndex(&SlewRateSP); + + enum TSlew rates[]={LX200_SLEW_GUIDE,LX200_SLEW_FIND,LX200_SLEW_CENTER,LX200_SLEW_GUIDE}; + + if (rate>=(sizeof(rates)/sizeof(rates[0]))) + return; + + setSlewMode(PortFD, rates[rate]); +} + +///////////////////////////////////////////////////////////////////////////////////// +/// +///////////////////////////////////////////////////////////////////////////////////// +bool LXD650::MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) +{ + if (command == MOTION_START) { + set_slew_rate_from_property(); + + if (dir == DIRECTION_NORTH) { + MoveTo(PortFD, LX200_NORTH); + } else { + MoveTo(PortFD, LX200_SOUTH); + } + } else { + if (dir == DIRECTION_NORTH) { + HaltMovement(PortFD, LX200_NORTH); + } else { + HaltMovement(PortFD, LX200_SOUTH); + } + } + + return true; +} + +///////////////////////////////////////////////////////////////////////////////////// +/// +///////////////////////////////////////////////////////////////////////////////////// +bool LXD650::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) +{ + if (command == MOTION_START) { + set_slew_rate_from_property(); + + if (dir == DIRECTION_WEST) { + MoveTo(PortFD, LX200_WEST); + } else { + MoveTo(PortFD, LX200_EAST); + } + } else { + if (dir == DIRECTION_WEST) { + HaltMovement(PortFD, LX200_WEST); + } else { + HaltMovement(PortFD, LX200_EAST); + } + } + + return true; +} /************************************************************************************** ** |