summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames McKenzie <root@ka-ata-killa.panaceas.james.local>2023-01-25 00:04:46 +0000
committerJames McKenzie <root@ka-ata-killa.panaceas.james.local>2023-01-25 00:04:46 +0000
commite3cd87273b69753df1f6c72f8d58efa80ff9a7f7 (patch)
tree320f4ba63e6969fc9bdd6299d9b94160e2c9ec29
parent2a55c9cfd18d4898f81cdae9477b998814d5d9c3 (diff)
downloadindi_mount_driver-e3cd87273b69753df1f6c72f8d58efa80ff9a7f7.tar.gz
indi_mount_driver-e3cd87273b69753df1f6c72f8d58efa80ff9a7f7.tar.bz2
indi_mount_driver-e3cd87273b69753df1f6c72f8d58efa80ff9a7f7.zip
initial platesolving for lxd650 mount
-rw-r--r--indi-lxd650/lxd650.cpp210
-rw-r--r--indi-lxd650/lxd650.h24
2 files changed, 231 insertions, 3 deletions
diff --git a/indi-lxd650/lxd650.cpp b/indi-lxd650/lxd650.cpp
index 1e0c4a4..3b62fa4 100644
--- a/indi-lxd650/lxd650.cpp
+++ b/indi-lxd650/lxd650.cpp
@@ -95,6 +95,19 @@ bool LXD650::initProperties()
currentRA = get_local_sidereal_time(LocationN[LOCATION_LONGITUDE].value);
currentDEC = LocationN[LOCATION_LATITUDE].value > 0 ? 90 : -90;
+ InitAlignmentProperties(this);
+
+ getSwitch("ALIGNMENT_SUBSYSTEM_ACTIVE")->sp[0].s = ISS_ON;
+
+
+ initGuiderProperties(getDeviceName(), GUIDE_TAB);
+ // Rate rate
+ GuideRateNP[AXIS_AZ].fill("GUIDE_RATE_WE", "W/E Rate", "%.f", 0, 1, .1, 0.5);
+ GuideRateNP[AXIS_ALT].fill("GUIDE_RATE_NS", "N/S Rate", "%.f", 0, 1, .1, 0.5);
+ GuideRateNP.fill(getDeviceName(), "GUIDE_RATE", "Guiding Rate", GUIDE_TAB, IP_RW, 0, IPS_IDLE);
+
+ setDriverInterface(getDriverInterface() | GUIDER_INTERFACE);
+
return true;
}
@@ -152,6 +165,7 @@ bool LXD650::isSlewComplete()
***************************************************************************************/
bool LXD650::ReadScopeStatus()
{
+
if (!isConnected())
return false;
@@ -178,7 +192,16 @@ bool LXD650::ReadScopeStatus()
}
}
- NewRaDec(currentRA, currentDEC);
+ INDI::IEquatorialCoordinates MountRADE { currentRA, currentDEC };
+ TelescopeDirectionVector TDV = TelescopeDirectionVectorFromEquatorialCoordinates(MountRADE);
+
+ double sky_RA, sky_DEC;
+ if (!TransformTelescopeToCelestial(TDV, sky_RA, sky_DEC)) {
+ sky_RA=currentRA;
+ sky_DEC=currentDEC;
+ }
+
+ NewRaDec(sky_RA, sky_DEC);
return true;
}
@@ -188,6 +211,20 @@ bool LXD650::ReadScopeStatus()
***************************************************************************************/
bool LXD650::Goto(double r, double d)
{
+#if 1
+
+ TelescopeDirectionVector TDV;
+ INDI::IEquatorialCoordinates MountRADE { r, d };
+
+ if (TransformCelestialToTelescope(r, d, 0.0, TDV)) {
+ EquatorialCoordinatesFromTelescopeDirectionVector(TDV, MountRADE);
+ } // Conversion failed, use values as is
+
+ r=MountRADE.rightascension;
+ d=MountRADE.declination;
+
+#endif
+
targetRA = r;
targetDEC = d;
char RAStr[64] = {0}, DecStr[64] = {0};
@@ -245,6 +282,7 @@ bool LXD650::Goto(double r, double d)
/**************************************************************************************
**
***************************************************************************************/
+#if 0
bool LXD650::Sync(double ra, double dec)
{
char syncString[256] = {0};
@@ -274,6 +312,88 @@ bool LXD650::Sync(double ra, double dec)
return true;
}
+#else
+bool LXD650::Sync(double ra, double dec)
+{
+ getBasicData();
+
+ AlignmentDatabaseEntry NewEntry;
+ NewEntry.ObservationJulianDate = ln_get_julian_from_sys();
+ NewEntry.RightAscension = ra;
+ NewEntry.Declination = dec;
+
+ INDI::IEquatorialCoordinates MountRADE {currentRA, currentDEC};
+ NewEntry.TelescopeDirection = TelescopeDirectionVectorFromEquatorialCoordinates(MountRADE);
+
+ NewEntry.PrivateDataSize = 0;
+
+ DEBUGF(INDI::AlignmentSubsystem::DBG_ALIGNMENT, "New sync point Date %lf RA %lf DEC %lf TDV(x %lf y %lf z %lf)",
+ NewEntry.ObservationJulianDate, NewEntry.RightAscension, NewEntry.Declination, NewEntry.TelescopeDirection.x,
+ NewEntry.TelescopeDirection.y, NewEntry.TelescopeDirection.z);
+
+ if (!CheckForDuplicateSyncPoint(NewEntry))
+ {
+ GetAlignmentDatabase().push_back(NewEntry);
+
+ // Tell the client about size change
+ UpdateSize();
+
+ // Tell the math plugin to reinitialise
+ Initialise(this);
+
+ // Force read before restarting
+ ReadScopeStatus();
+
+#if 0
+ // Sync cord wrap
+ syncCoordWrapPosition();
+#endif
+
+#if 0
+ // The tracking seconds should be reset to restart the drift compensation
+ resetTracking();
+#endif
+
+ return true;
+ }
+ return false;
+}
+#endif
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+bool LXD650::ISSnoopDevice(XMLEle *root)
+{
+#if 0
+ const char *propName = findXMLAttValu(root, "name");
+
+ // update cordwrap position at each init of the alignment subsystem
+ if (!strcmp(propName, "ALIGNMENT_SUBSYSTEM_MATH_PLUGIN_INITIALISE") && telescope_caux->isConnected())
+ telescope_caux->syncCoordWrapPosition();
+#endif
+
+ return Telescope::ISSnoopDevice(root);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+bool LXD650::ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
+ char *formats[], char *names[], int n)
+{
+ if (strcmp(dev, getDeviceName()) == 0)
+ {
+ // Process alignment properties
+ ProcessAlignmentBLOBProperties(this, name, sizes, blobsizes, blobs, formats, names, n);
+ }
+ // Pass it up the chain
+ return INDI::Telescope::ISNewBLOB(dev, name, sizes, blobsizes, blobs, formats, names, n);
+}
+
/**************************************************************************************
**
@@ -295,11 +415,97 @@ bool LXD650::ISNewNumber(const char *dev, const char *name, double values[], cha
IDSetNumber(&SlewAccuracyNP, nullptr);
return true;
}
- }
+
+
+ // Guide Rate
+ if (GuideRateNP.isNameMatch(name))
+ {
+ GuideRateNP.update(values, names, n);
+ GuideRateNP.setState(IPS_OK);
+ GuideRateNP.apply();
+ return true;
+ }
+
+ // Process Guide Properties
+ processGuiderProperties(name, values, names, n);
+
+ // Process Alignment Properties
+ ProcessAlignmentNumberProperties(this, name, values, names, n);
+ }
return INDI::Telescope::ISNewNumber(dev, name, values, names, n);
}
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+bool LXD650::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
+{
+ if (strcmp(dev, getDeviceName()) == 0)
+ {
+ // Process alignment properties
+ ProcessAlignmentSwitchProperties(this, name, states, names, n);
+ }
+
+ return INDI::Telescope::ISNewSwitch(dev, name, states, names, n);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+bool LXD650::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
+{
+ if (!strcmp(dev, getDeviceName()))
+ ProcessAlignmentTextProperties(this, name, texts, names, n);
+
+ return INDI::Telescope::ISNewText(dev, name, texts, names, n);
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////////////////
+IPState LXD650::GuideNorth(uint32_t ms)
+{
+ int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_ALT].getValue() * 100);
+ guidePulse(AXIS_DE, ms, rate);
+ return IPS_BUSY;
+}
+
+IPState LXD650::GuideSouth(uint32_t ms)
+{
+ int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_ALT].getValue() * 100);
+ guidePulse(AXIS_DE, ms, -rate);
+ return IPS_BUSY;
+}
+
+IPState LXD650::GuideEast(uint32_t ms)
+{
+ int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_AZ].getValue() * 100);
+ guidePulse(AXIS_RA, ms, -rate);
+ return IPS_BUSY;
+}
+
+IPState LXD650::GuideWest(uint32_t ms)
+{
+ int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_AZ].getValue() * 100);
+ guidePulse(AXIS_RA, ms, rate);
+ return IPS_BUSY;
+}
+
+bool LXD650::guidePulse(INDI_EQ_AXIS axis, uint32_t ms, int8_t rate)
+{
+ // FIXME
+ //
+ //
+ (void) axis;
+ (void) ms;
+ (void) rate;
+ return true;
+}
+
+
/**************************************************************************************
**
***************************************************************************************/
diff --git a/indi-lxd650/lxd650.h b/indi-lxd650/lxd650.h
index ea6b144..6333fd2 100644
--- a/indi-lxd650/lxd650.h
+++ b/indi-lxd650/lxd650.h
@@ -21,8 +21,16 @@
#pragma once
#include "inditelescope.h"
+#include <indiguiderinterface.h>
+#include <alignment/AlignmentSubsystemForDrivers.h>
+#include <indipropertyswitch.h>
+#include <indipropertynumber.h>
+#include <indipropertytext.h>
-class LXD650 : public INDI::Telescope
+
+class LXD650 : public INDI::Telescope,
+ public INDI::GuiderInterface,
+ public INDI::AlignmentSubsystem::AlignmentSubsystemForDrivers
{
public:
LXD650();
@@ -33,7 +41,12 @@ class LXD650 : public INDI::Telescope
virtual bool ReadScopeStatus() override;
virtual bool initProperties() override;
virtual bool updateProperties() override;
+ virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
+ char *formats[], char *names[], int n) override;
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
+ virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
+ virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
+ virtual bool ISSnoopDevice(XMLEle *root) override;
protected:
virtual bool Abort() override;
@@ -45,6 +58,11 @@ class LXD650 : public INDI::Telescope
void getBasicData();
+ virtual IPState GuideNorth(uint32_t ms) override;
+ virtual IPState GuideSouth(uint32_t ms) override;
+ virtual IPState GuideEast(uint32_t ms) override;
+ virtual IPState GuideWest(uint32_t ms) override;
+
protected:
bool isSlewComplete();
void slewError(int slewCode);
@@ -56,4 +74,8 @@ class LXD650 : public INDI::Telescope
double targetRA = 0, targetDEC = 0;
double currentRA = 0, currentDEC = 0;
uint32_t DBG_SCOPE = 0;
+
+ private:
+ INDI::PropertyNumber GuideRateNP {2};
+ bool guidePulse(INDI_EQ_AXIS axis, uint32_t ms, int8_t rate);
};