summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@lxd650.localnet>2023-01-26 02:59:52 +0000
committerroot <root@lxd650.localnet>2023-01-26 02:59:52 +0000
commitf9632319b80c620c27e9db2786971fe19f24cd26 (patch)
tree7b3b496d9dcb0332d9dae0b1f5b6a8d73ec489ee
parent8e32f5d0a57e982f67e685ba7ec4101d26728350 (diff)
downloadindi_mount_driver-f9632319b80c620c27e9db2786971fe19f24cd26.tar.gz
indi_mount_driver-f9632319b80c620c27e9db2786971fe19f24cd26.tar.bz2
indi_mount_driver-f9632319b80c620c27e9db2786971fe19f24cd26.zip
working motion and guiding
-rw-r--r--indi-lxd650/lxd650.cpp95
-rw-r--r--indi-lxd650/lxd650.h7
2 files changed, 97 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;
+}
/**************************************************************************************
**
diff --git a/indi-lxd650/lxd650.h b/indi-lxd650/lxd650.h
index 7a6fc96..0e24976 100644
--- a/indi-lxd650/lxd650.h
+++ b/indi-lxd650/lxd650.h
@@ -53,6 +53,7 @@ class LXD650 : public INDI::Telescope,
static void GuideWestProxy(void *context);
static void GuideEastProxy(void *context);
+
protected:
virtual bool Abort() override;
virtual bool Goto(double, double) override;
@@ -63,6 +64,9 @@ class LXD650 : public INDI::Telescope,
void getBasicData();
+ virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
+ virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
+
virtual IPState GuideNorth(uint32_t ms) override;
virtual IPState GuideSouth(uint32_t ms) override;
virtual IPState GuideEast(uint32_t ms) override;
@@ -102,6 +106,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);
};