diff options
author | Your Name <you@example.com> | 2024-03-13 11:09:04 +0000 |
---|---|---|
committer | Your Name <you@example.com> | 2024-03-13 11:09:04 +0000 |
commit | 1a6f1680c086ae92c37934820adcb3f9d21dc8f5 (patch) | |
tree | dd45ad321937affcb531a3919cb4b38f9920d5f2 | |
parent | 6653683aad155316121f22c9bab46aee53a5d34d (diff) | |
download | indi_mount_driver-1a6f1680c086ae92c37934820adcb3f9d21dc8f5.tar.gz indi_mount_driver-1a6f1680c086ae92c37934820adcb3f9d21dc8f5.tar.bz2 indi_mount_driver-1a6f1680c086ae92c37934820adcb3f9d21dc8f5.zip |
fix guidance pulse on celestron, add reset to marks button
-rw-r--r-- | indi-celestronaux/celestronaux.cpp | 85 | ||||
-rw-r--r-- | indi-celestronaux/celestronaux.h | 9 |
2 files changed, 74 insertions, 20 deletions
diff --git a/indi-celestronaux/celestronaux.cpp b/indi-celestronaux/celestronaux.cpp index ccf15a0..4add9d2 100644 --- a/indi-celestronaux/celestronaux.cpp +++ b/indi-celestronaux/celestronaux.cpp @@ -382,6 +382,11 @@ bool CelestronAUX::initProperties() if (strstr(getDeviceName(), "WiFi")) setActiveConnection(tcpConnection); + + SetMarksSP[RESET_TO_MARKS].fill("RESET_TO_MARKS", "OK", ISS_OFF); + SetMarksSP.fill(getDeviceName(), "Reset to Marks", "Reset to Marks", MAIN_CONTROL_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE); + + return true; } @@ -412,6 +417,8 @@ bool CelestronAUX::updateProperties() defineProperty(&HorizontalCoordsNP); defineProperty(&HomeSP); + defineProperty(&SetMarksSP); + defineProperty(&TrackMethodSP); defineProperty(&DriverTrackMethodSP); @@ -490,6 +497,8 @@ bool CelestronAUX::updateProperties() deleteProperty(HorizontalCoordsNP.getName()); deleteProperty(HomeSP.getName()); + deleteProperty(SetMarksSP.getName()); + deleteProperty(DriverTrackMethodSP.getName()); deleteProperty(TrackMethodSP.getName()); @@ -793,18 +802,6 @@ bool CelestronAUX::ISNewSwitch(const char *dev, const char *name, ISState *state return true; } - // Tracking Method Emulation - if (DriverTrackMethodSP.isNameMatch(name)) - { - DriverTrackMethodSP.update(states, names, n); - DriverTrackMethodSP.setState(IPS_OK); - DriverTrackMethodSP.apply(); - - track_method_changed(); - return true; - } - - // GPS Emulation if (GPSEmuSP.isNameMatch(name)) { @@ -848,11 +845,32 @@ bool CelestronAUX::ISNewSwitch(const char *dev, const char *name, ISState *state HomeSP.apply(); return true; } + + // SetMarks + if (SetMarksSP.isNameMatch(name)) + { + SetMarksSP.update(states, names, n); + + SetTrackEnabled(false); + + setToMark(AXIS_AZ); + setToMark(AXIS_ALT); + + TrackState = SCOPE_IDLE; + ReadScopeStatus(); + + SetMarksSP.reset(); + SetMarksSP.setState(IPS_OK); + + SetMarksSP.apply(); + return true; + } + // Process alignment properties ProcessAlignmentSwitchProperties(this, name, states, names, n); } - + return INDI::Telescope::ISNewSwitch(dev, name, states, names, n); } @@ -1009,32 +1027,33 @@ bool CelestronAUX::MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) ///////////////////////////////////////////////////////////////////////////////////// /// ///////////////////////////////////////////////////////////////////////////////////// +//FISH IPState CelestronAUX::GuideNorth(uint32_t ms) { int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_ALT].getValue() * 100); guidePulse(AXIS_DE, ms, rate); - return IPS_BUSY; + return IPS_OK; // IPS_BUSY; // JMM - my mount doesn't reply } IPState CelestronAUX::GuideSouth(uint32_t ms) { int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_ALT].getValue() * 100); guidePulse(AXIS_DE, ms, -rate); - return IPS_BUSY; + return IPS_OK; // IPS_BUSY; // JMM - my mount doesn't reply } IPState CelestronAUX::GuideEast(uint32_t ms) { int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_AZ].getValue() * 100); guidePulse(AXIS_RA, ms, -rate); - return IPS_BUSY; + return IPS_OK; // IPS_BUSY; // JMM - my mount doesn't reply } IPState CelestronAUX::GuideWest(uint32_t ms) { int8_t rate = static_cast<int8_t>(GuideRateNP[AXIS_AZ].getValue() * 100); guidePulse(AXIS_RA, ms, rate); - return IPS_BUSY; + return IPS_OK; // IPS_BUSY; // JMM - my mount doesn't reply } bool CelestronAUX::guidePulse(INDI_EQ_AXIS axis, uint32_t ms, int8_t rate) @@ -1046,6 +1065,7 @@ bool CelestronAUX::guidePulse(INDI_EQ_AXIS axis, uint32_t ms, int8_t rate) AUXBuffer data(2); data[0] = rate; data[1] = ticks; + syslog_proxy("guide pulse for %s, %d ms at rate %d\n",(axis==AXIS_DE) ? "DEC":"RA", ms,rate); AUXCommand cmd(MC_AUX_GUIDE, APP, axis == AXIS_DE ? ALT : AZM, data); return sendAUXCommand(cmd); } @@ -1566,7 +1586,7 @@ void CelestronAUX::TimerHit() { INDI::Telescope::TimerHit(); - syslog_proxy("Timer hit state = %d",(int)TrackState); + syslog_proxy("Timer hit state = %d %d %d",(int)TrackState,GuideWENP.s,GuideNSNP.s); switch (TrackState) { @@ -1617,6 +1637,7 @@ void CelestronAUX::TimerHit() targetMountAxisCoordinates.azimuth += m_GuideOffset[AXIS_AZ]; targetMountAxisCoordinates.altitude += m_GuideOffset[AXIS_ALT]; + //FISH // If we had guiding pulses active, mark them as complete if (GuideWENP.s == IPS_BUSY) GuideComplete(AXIS_RA); @@ -1905,9 +1926,12 @@ void CelestronAUX::EncodersToRADE(INDI::IEquatorialCoordinates &coords, Telescop } } + double lst = get_local_sidereal_time(LocationN[LOCATION_LONGITUDE].value); double ra = range24(lst - ha); + syslog_proxy("HAE %.4f DEE %.4f -> RA %.4f HA %.4f DE %.4f\n", haEncoder,deEncoder, ra,ha,de); + coords.rightascension = ra; coords.declination = de; } @@ -2025,6 +2049,7 @@ bool CelestronAUX::isSlewing() return m_AxisStatus[AXIS_AZ] == SLEWING || m_AxisStatus[AXIS_ALT] == SLEWING; } + ///////////////////////////////////////////////////////////////////////////////////// /// ///////////////////////////////////////////////////////////////////////////////////// @@ -2079,6 +2104,18 @@ bool CelestronAUX::isHomingDone(INDI_HO_AXIS axis) ///////////////////////////////////////////////////////////////////////////////////// /// ///////////////////////////////////////////////////////////////////////////////////// +bool CelestronAUX::setToMark(INDI_HO_AXIS axis) +{ + AUXCommand command(MC_SET_POSITION, APP, axis == AXIS_AZ ? AZM : ALT); + command.setData(0x400000, 3); //90 + sendAUXCommand(command); + readAUXResponse(command); + return true; +} + +///////////////////////////////////////////////////////////////////////////////////// +/// +///////////////////////////////////////////////////////////////////////////////////// bool CelestronAUX::getVersion(AUXTargets target) { AUXCommand firmver(GET_VER, APP, target); @@ -2496,6 +2533,7 @@ bool CelestronAUX::processResponse(AUXCommand &m) switch (m.source()) { case ALT: + syslog_proxy("MC_GET_POSITION ALT, EncodeNP %.4f\n",(float) (m.getData())); EncoderNP[AXIS_ALT].setValue(m.getData()); break; case AZM: @@ -2558,15 +2596,22 @@ bool CelestronAUX::processResponse(AUXCommand &m) break; case MC_AUX_GUIDE_ACTIVE: + syslog_proxy("guide complete\n"); switch (m.source()) { case ALT: - if (m.getData() == 0x00) + if (m.getData() == 0x00){ + //FISH + syslog_proxy("ALT guide complete\n"); GuideComplete(AXIS_DE); + } break; case AZM: - if (m.getData() == 0x00) + if (m.getData() == 0x00) { + //FISH + syslog_proxy("AZM guide complete\n"); GuideComplete(AXIS_RA); + } break; default: break; diff --git a/indi-celestronaux/celestronaux.h b/indi-celestronaux/celestronaux.h index 7cd4bbf..7c5dc29 100644 --- a/indi-celestronaux/celestronaux.h +++ b/indi-celestronaux/celestronaux.h @@ -162,6 +162,8 @@ class CelestronAUX : bool isHomingDone(INDI_HO_AXIS axis); bool m_HomingProgress[2] = {false, false}; + bool setToMark(INDI_HO_AXIS axis); + ///////////////////////////////////////////////////////////////////////////////////// /// Tracking ///////////////////////////////////////////////////////////////////////////////////// @@ -417,6 +419,13 @@ class CelestronAUX : /// Static Const Private Variables /////////////////////////////////////////////////////////////////////////////// + INDI::PropertySwitch SetMarksSP {1}; + enum + { + RESET_TO_MARKS + }; + + private: // One definition rule (ODR) constants |