From 10ca0df007ac5a9da0ec6e7fc8d452a2e9c4989c Mon Sep 17 00:00:00 2001 From: Andy Galasso Date: Tue, 7 Jul 2020 20:07:07 -0400 Subject: [PATCH 1/2] de-select guide star if scope starts slewing while looping --- guider.cpp | 14 ++++++++++++++ guider.h | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/guider.cpp b/guider.cpp index a5e6dee2d..618034c88 100644 --- a/guider.cpp +++ b/guider.cpp @@ -1209,6 +1209,19 @@ void Guider::DisplayImage(usImage *img) UpdateImageDisplay(); } +static void LoopingCheckSlewing(Guider *guider) +{ + if (guider->CurrentPosition().IsValid() && + pPointingSource && + pPointingSource->IsConnected() && + pPointingSource->CanCheckSlewing() && + pPointingSource->Slewing()) + { + Debug.Write(wxS("scope started slewing while looping, deselect\n")); + guider->InvalidateCurrentPosition(true); + } +} + /************* A new image is ready ************************/ void Guider::UpdateGuideState(usImage *pImage, bool bStopping) @@ -1243,6 +1256,7 @@ void Guider::UpdateGuideState(usImage *pImage, bool bStopping) case STATE_SELECTING: case STATE_SELECTED: EvtServer.NotifyLooping(pImage->FrameNum); + LoopingCheckSlewing(this); break; case STATE_CALIBRATING_PRIMARY: case STATE_CALIBRATING_SECONDARY: diff --git a/guider.h b/guider.h index 61c330e54..a166d95e4 100644 --- a/guider.h +++ b/guider.h @@ -274,14 +274,15 @@ class Guider : public wxWindow // their operation private: virtual void InvalidateLockPosition(); + public: virtual void LoadProfileSettings(); // pure virtual functions -- these MUST be overridden by a subclass -public: virtual bool IsValidLockPosition(const PHD_Point& pt) = 0; -private: virtual void InvalidateCurrentPosition(bool fullReset = false) = 0; + +private: virtual bool UpdateCurrentPosition(const usImage *pImage, GuiderOffset *ofs, FrameDroppedInfo *errorInfo) = 0; virtual bool SetCurrentPosition(const usImage *pImage, const PHD_Point& position) = 0; From 801606f78bf7b9243ddd0f4740d6dc950a3eb506 Mon Sep 17 00:00:00 2001 From: Andy Galasso Date: Wed, 8 Jul 2020 01:09:14 -0400 Subject: [PATCH 2/2] only deselect when looping and scope slews if 'stop guiding when slew detected' is enabled --- gear_dialog.cpp | 6 ++++++ guider.cpp | 1 + scope.cpp | 7 ------- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gear_dialog.cpp b/gear_dialog.cpp index c84715fb7..094fac217 100644 --- a/gear_dialog.cpp +++ b/gear_dialog.cpp @@ -1308,6 +1308,9 @@ void GearDialog::OnChoiceScope(wxCommandEvent& event) throw THROW_INFO("OnChoiceScope: m_pScope == NULL"); } + m_pScope->EnableStopGuidingWhenSlewing(pConfig->Profile.GetBoolean("/scope/StopGuidingWhenSlewing", + m_pScope->CanCheckSlewing())); + m_ascomScopeSelected = choice.Contains("ASCOM"); } catch (const wxString& Msg) @@ -1344,6 +1347,9 @@ void GearDialog::OnChoiceAuxScope(wxCommandEvent& event) { throw THROW_INFO("OnAuxChoiceScope: m_pAuxScope == NULL"); } + + m_pAuxScope->EnableStopGuidingWhenSlewing(pConfig->Profile.GetBoolean("/scope/StopGuidingWhenSlewingAux", + m_pAuxScope->CanCheckSlewing())); } catch (const wxString& Msg) { diff --git a/guider.cpp b/guider.cpp index 618034c88..caf74915c 100644 --- a/guider.cpp +++ b/guider.cpp @@ -1214,6 +1214,7 @@ static void LoopingCheckSlewing(Guider *guider) if (guider->CurrentPosition().IsValid() && pPointingSource && pPointingSource->IsConnected() && + pPointingSource->IsStopGuidingWhenSlewingEnabled() && pPointingSource->CanCheckSlewing() && pPointingSource->Slewing()) { diff --git a/scope.cpp b/scope.cpp index 49c96ff0f..58e36eb54 100644 --- a/scope.cpp +++ b/scope.cpp @@ -457,13 +457,6 @@ Scope *Scope::Factory(const wxString& choice) { throw ERROR_INFO("ScopeFactory: Unknown Scope choice"); } - - if (pReturn) - { - // virtual function call means we cannot do this in the Scope constructor - pReturn->EnableStopGuidingWhenSlewing(pConfig->Profile.GetBoolean("/scope/StopGuidingWhenSlewing", - pReturn->CanCheckSlewing())); - } } catch (const wxString& Msg) {