summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames McKenzie <root@ka-ata-killa.panaceas.james.local>2023-01-25 10:40:55 +0000
committerJames McKenzie <root@ka-ata-killa.panaceas.james.local>2023-01-25 10:40:55 +0000
commita6c654a55d287f8988c72afb49bb9883bd91b7e4 (patch)
treea2b4d511067fabe37f4e8f8dfe9a4a13e956b207
parent0a0eb5a4e52a282169ecd75335cae25b5b5a8403 (diff)
downloadindi_mount_driver-a6c654a55d287f8988c72afb49bb9883bd91b7e4.tar.gz
indi_mount_driver-a6c654a55d287f8988c72afb49bb9883bd91b7e4.tar.bz2
indi_mount_driver-a6c654a55d287f8988c72afb49bb9883bd91b7e4.zip
add timer based guiding
-rw-r--r--indi-lxd650/lxd650.cpp148
-rw-r--r--indi-lxd650/lxd650.h16
2 files changed, 146 insertions, 18 deletions
diff --git a/indi-lxd650/lxd650.cpp b/indi-lxd650/lxd650.cpp
index 8126ac9..813f6bd 100644
--- a/indi-lxd650/lxd650.cpp
+++ b/indi-lxd650/lxd650.cpp
@@ -495,47 +495,159 @@ bool LXD650::ISNewText(const char *dev, const char *name, char *texts[], char *n
/////////////////////////////////////////////////////////////////////////////////////
///
+//
+//
+//
+//void
/////////////////////////////////////////////////////////////////////////////////////
+//
+
+
+void LXD650::GuideNorthCB(void)
+{
+ GuideNorth_TID = 0;
+ HaltMovement(PortFD, LX200_NORTH);
+}
+
+
+void LXD650::GuideNorthProxy(void *context)
+{
+ static_cast<LXD650 *>(context)->GuideNorthCB();
+}
+
+
IPState LXD650::GuideNorth(uint32_t ms)
{
- int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_ALT].getValue() * 100);
- guidePulse(AXIS_DE, ms, rate);
+ double rate = GuideRateNP[AXIS_ALT].getValue();
+
+ ms = (uint32_t) (rate * (double) ms);
+
+ setSlewMode(PortFD, LX200_SLEW_GUIDE);
+
+ if (GuideNorth_TID)
+ {
+ IERmTimer(GuideNorth_TID);
+ GuideNorth_TID = 0;
+ }
+
+
+ MoveTo(PortFD, LX200_NORTH);
+
+ GuideNorth_TID = IEAddTimer(ms, GuideNorthProxy, this);
+
return IPS_BUSY;
}
+
+void LXD650::GuideSouthCB(void)
+{
+ GuideSouth_TID = 0;
+ HaltMovement(PortFD, LX200_SOUTH);
+}
+
+
+void LXD650::GuideSouthProxy(void *context)
+{
+ static_cast<LXD650 *>(context)->GuideSouthCB();
+}
+
+
IPState LXD650::GuideSouth(uint32_t ms)
{
- int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_ALT].getValue() * 100);
- guidePulse(AXIS_DE, ms, -rate);
+ double rate = GuideRateNP[AXIS_ALT].getValue();
+
+ ms = (uint32_t) (rate * (double) ms);
+
+ setSlewMode(PortFD, LX200_SLEW_GUIDE);
+
+ if (GuideSouth_TID)
+ {
+ IERmTimer(GuideSouth_TID);
+ GuideSouth_TID = 0;
+ }
+
+
+ MoveTo(PortFD, LX200_SOUTH);
+
+ GuideSouth_TID = IEAddTimer(ms, GuideSouthProxy, this);
+
return IPS_BUSY;
}
-IPState LXD650::GuideEast(uint32_t ms)
+
+void LXD650::GuideWestCB(void)
{
- int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_AZ].getValue() * 100);
- guidePulse(AXIS_RA, ms, -rate);
- return IPS_BUSY;
+ GuideWest_TID = 0;
+ HaltMovement(PortFD, LX200_WEST);
+}
+
+
+void LXD650::GuideWestProxy(void *context)
+{
+ static_cast<LXD650 *>(context)->GuideWestCB();
}
+
IPState LXD650::GuideWest(uint32_t ms)
{
- int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_AZ].getValue() * 100);
- guidePulse(AXIS_RA, ms, rate);
+ double rate = GuideRateNP[AXIS_ALT].getValue();
+
+ ms = (uint32_t) (rate * (double) ms);
+
+ setSlewMode(PortFD, LX200_SLEW_GUIDE);
+
+ if (GuideWest_TID)
+ {
+ IERmTimer(GuideWest_TID);
+ GuideWest_TID = 0;
+ }
+
+
+ MoveTo(PortFD, LX200_WEST);
+
+ GuideWest_TID = IEAddTimer(ms, GuideWestProxy, this);
+
return IPS_BUSY;
}
-bool LXD650::guidePulse(INDI_EQ_AXIS axis, uint32_t ms, int8_t rate)
+
+void LXD650::GuideEastCB(void)
{
- // FIXME
- //
- //
- (void) axis;
- (void) ms;
- (void) rate;
- return true;
+ GuideEast_TID = 0;
+ HaltMovement(PortFD, LX200_EAST);
+}
+
+
+void LXD650::GuideEastProxy(void *context)
+{
+ static_cast<LXD650 *>(context)->GuideEastCB();
}
+IPState LXD650::GuideEast(uint32_t ms)
+{
+ double rate = GuideRateNP[AXIS_ALT].getValue();
+
+ ms = (uint32_t) (rate * (double) ms);
+
+ setSlewMode(PortFD, LX200_SLEW_GUIDE);
+
+ if (GuideEast_TID)
+ {
+ IERmTimer(GuideEast_TID);
+ GuideEast_TID = 0;
+ }
+
+
+ MoveTo(PortFD, LX200_EAST);
+
+ GuideEast_TID = IEAddTimer(ms, GuideEastProxy, this);
+
+ return IPS_BUSY;
+}
+
+
+
/**************************************************************************************
**
***************************************************************************************/
diff --git a/indi-lxd650/lxd650.h b/indi-lxd650/lxd650.h
index 731c9e4..0c912c1 100644
--- a/indi-lxd650/lxd650.h
+++ b/indi-lxd650/lxd650.h
@@ -48,6 +48,11 @@ 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);
+
protected:
virtual bool Abort() override;
virtual bool Goto(double, double) override;
@@ -79,4 +84,15 @@ class LXD650 : public INDI::Telescope,
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};
+
+ void GuideNorthCB(void);
+ void GuideSouthCB(void);
+ void GuideWestCB(void);
+ void GuideEastCB(void);
+
};