Skip to content

Commit 5f3226f

Browse files
committed
Commit of changes following version "d" field testing
1 parent 300874d commit 5f3226f

6 files changed

Lines changed: 68 additions & 49 deletions

File tree

src/gear_simulator.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ double SimCamParams::seeing_scale; // simulated seeing scale factor
116116
double SimCamParams::cam_angle; // simulated camera angle (degrees)
117117
double SimCamParams::guide_rate; // guide rate, pixels per second
118118
PierSide SimCamParams::pier_side; // side of pier
119-
bool SimCamParams::reverse_dec_pulse_on_west_side; // reverse dec pulse on west side of pier, like ASCOM pulse guided equatorial
120-
// mounts
119+
bool SimCamParams::reverse_dec_pulse_on_west_side; // reverse dec pulse on west side of pier, like some ASCOM pulse guided
120+
// equatorial mounts
121121
unsigned int SimCamParams::clouds_inten = 50; // seed brightness for cloud contribution
122122
double SimCamParams::clouds_opacity;
123123
double SimCamParams::image_scale; // arc-sec per pixel
@@ -1639,11 +1639,11 @@ bool CameraSimulator::Capture(usImage& img, const CaptureParams& captureParams)
16391639
HasBayer = false;
16401640
}
16411641

1642-
//// Save full frame size
1642+
// Save full frame size
16431643
FrameSize.x = image.size().width;
16441644
FrameSize.y = image.size().height;
16451645

1646-
// Simulate scope motion
1646+
// Simulate motion from tracking errors and seeing
16471647
double deltaX, deltaY;
16481648
sim.GetSimDisplacements(&deltaX, &deltaY, nullptr, true);
16491649

@@ -2421,7 +2421,13 @@ void SimCamDialog::OnFileTextChange(wxCommandEvent& event)
24212421
simcam->sim.CloseDir();
24222422
}
24232423

2424-
void SimCamDialog::OnRecenterButton(wxCommandEvent& event) { }
2424+
void SimCamDialog::OnRecenterButton(wxCommandEvent& event)
2425+
{
2426+
pFrame->pGuider->StopGuiding();
2427+
CameraSimulator *simcam = static_cast<CameraSimulator *>(pCamera);
2428+
simcam->sim.ra_ofs = 0;
2429+
simcam->sim.dec_ofs = 0;
2430+
}
24252431

24262432
void SimCamDialog::UpdatePierSideLabel()
24272433
{

src/guider_solarsys.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,6 @@ bool GuiderSolarSys::AutoSelect(const wxRect& roi)
138138
throw ERROR_INFO("No Current Image");
139139
}
140140

141-
// If mount is not calibrated, we need to choose a star a bit farther
142-
// from the egde to allow for the motion of the star during
143-
// calibration
144-
//
145-
int edgeAllowance = 0;
146-
if (pMount && pMount->IsConnected() && !pMount->IsCalibrated())
147-
edgeAllowance = wxMax(edgeAllowance, pMount->CalibrationTotDistance());
148-
if (pSecondaryMount && pSecondaryMount->IsConnected() && !pSecondaryMount->IsCalibrated())
149-
edgeAllowance = wxMax(edgeAllowance, pSecondaryMount->CalibrationTotDistance());
150-
151141
Star newDisk;
152142

153143
if (!m_SolarSystemObject->FindDisk(image, false, &newDisk))
@@ -197,11 +187,6 @@ bool GuiderSolarSys::AutoSelect(const wxRect& roi)
197187
return error;
198188
}
199189

200-
inline static wxRect SubframeRect(const PHD_Point& pos, int halfwidth)
201-
{
202-
return wxRect(ROUND(pos.X) - halfwidth, ROUND(pos.Y) - halfwidth, 2 * halfwidth + 1, 2 * halfwidth + 1);
203-
}
204-
205190
wxRect GuiderSolarSys::GetBoundingBox() const
206191
{
207192
enum
@@ -276,11 +261,9 @@ bool GuiderSolarSys::UpdateCurrentPosition(const usImage *pImage, GuiderOffset *
276261
else
277262
distance = 0.;
278263

279-
// double tolerance = m_tolerateJumpsEnabled ? m_tolerateJumpsThreshold : 9e99;
280-
281264
ImageLogger::LogImage(pImage, distance);
282265

283-
// update the star position, mass, etc.
266+
// update the disk position, mass, etc.
284267
m_primaryStar = newDisk;
285268

286269
if (lockPos.IsValid())

src/myframe_events.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ void MyFrame::SetSolarSystemMode(bool Enable)
947947
{
948948
pFrame->pGuider->StopGuiding();
949949
m_solarSystemMode = true;
950-
m_mgr.GetPane(_T("GuiderSolarSys")).Show().Float();
951950
m_mgr.GetPane(_T("Guider")).Hide();
952951
m_mgr.Update();
953952
pFrame->pGuider = pFrame->m_pGuiderSolarSys;
@@ -956,13 +955,19 @@ void MyFrame::SetSolarSystemMode(bool Enable)
956955
{
957956
pSolarSysTool = SsgTool::CreateSolarSysToolWindow();
958957
}
958+
bool dockIt = pConfig->Profile.GetBoolean("/guider/SSG/wasDocked", false);
959+
if (dockIt)
960+
m_mgr.GetPane(_T("GuiderSolarSys")).Show().Dock();
961+
else
962+
m_mgr.GetPane(_("GuiderSolarSys")).Show().Float();
959963
pSolarSysTool->Show();
960964
}
961965
else
962966
{
963967
m_solarSystemMode = false;
964968
m_mgr.GetPane(_T("GuiderSolarSys")).Hide();
965969
m_mgr.GetPane(_T("Guider")).Show().Bottom().Left().Position(0).MinSize(-1, 400);
970+
pConfig->Profile.SetBoolean("/guider/SSG/wasDocked", m_mgr.GetPane(_("GuiderSolarSys")).IsDocked());
966971
m_mgr.Update();
967972
pFrame->StopCapturing();
968973
pFrame->pGuider = pFrame->m_pGuiderMultiStar;

src/phd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979

8080
#define APPNAME _T("PHD2 Guiding")
8181
#define PHDVERSION _T("2.6.14")
82-
#define PHDSUBVER _T(" SolSys_c")
82+
#define PHDSUBVER _T(" SolSys_d")
8383
#define FULLVER PHDVERSION PHDSUBVER
8484

8585
#if defined(__WINDOWS__)

src/solarsys.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ bool SolarSystemObject::RetryBlobDetection(Mat img8, int roiX, int roiY, Centroi
944944
{
945945
Debug.Write(wxString::Format("SSG:: Retry detection found object at (%.1f, %.1f) with MinBlobDiameter of %d \n",
946946
m_center_x, m_center_x, (int) m_paramMinBlobDiameter));
947-
if (retryCount > 0 && pFrame->pGuider->IsGuiding())
947+
if (retryCount > 0)
948948
{
949949
wxString msg;
950950
GetDetectionStatus(msg);
@@ -967,6 +967,8 @@ bool SolarSystemObject::RetryBlobDetection(Mat img8, int roiX, int roiY, Centroi
967967
else
968968
{
969969
Debug.Write("SSG: Retry detection, no target found, retries exhausted\n");
970+
SsgTool::UpdateToolStatus(_("Object not found. Make sure your MaxBlobDiameter is larger "
971+
"than the apparent diameter of the target."));
970972
done = true;
971973
}
972974
}

src/solarsys_tool.cpp

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ struct SolarSysToolWin : public wxDialog
8787
wxString m_trackingRateName;
8888
wxChoice *m_mountTrackingRate;
8989
wxCheckBox *m_restoreSidereal;
90+
bool m_trackingRateNeedsConfirmation;
91+
wxDateTime m_ConfirmationPeriodStart;
9092

9193
wxCheckBox *m_RoiCheckBox;
9294
wxCheckBox *m_PauseCheckBox;
@@ -155,6 +157,7 @@ struct SolarSysToolWin : public wxDialog
155157
void OnResetDetectionStats(wxCommandEvent& evnt);
156158
void HandleWarningMsgs(int selection);
157159
void ShowStatus(const wxString& msg, bool appending = false);
160+
void ConfirmMountTrackingRate();
158161
};
159162

160163
static wxString TITLE = wxTRANSLATE("Solar System Guiding");
@@ -193,7 +196,7 @@ static wxSpinCtrlDouble *NewSpinner(wxWindow *parent, wxString formatstr, double
193196
SolarSysToolWin::SolarSysToolWin()
194197
: wxDialog(pFrame, wxID_ANY, wxGetTranslation(TITLE), wxDefaultPosition, wxDefaultSize,
195198
wxCAPTION | wxCLOSE_BOX | wxMINIMIZE_BOX),
196-
m_lastDiameter(0), m_autoAdjustingActive(false)
199+
m_lastDiameter(0), m_autoAdjustingActive(false), m_trackingRateNeedsConfirmation(false)
197200

198201
{
199202
SetSizeHints(wxDefaultSize, wxDefaultSize);
@@ -865,6 +868,7 @@ void SolarSysToolWin::OnAutoAdjustButton(wxCommandEvent& event)
865868
m_maxBlobDiameter->SetValue(DefaultMaxBlobSize());
866869
wxSpinDoubleEvent evt;
867870
OnSpinCtrl_maxBlobDiameter(evt);
871+
// Setting the MinBlobDiameter this large will invariably trigger retries
868872
m_solarSystemObj->SetMinBlobDiameter(0.8 * m_maxBlobDiameter->GetValue());
869873

870874
if (!pFrame->pGuider->IsGuiding())
@@ -969,6 +973,31 @@ void SolarSysToolWin::InitializeTrackingRates(wxString trackingRateName)
969973
}
970974
}
971975

976+
void SolarSysToolWin::ConfirmMountTrackingRate()
977+
{
978+
// Need to see if the change "stuck" - can be over-written by mount s/w using customized tracking
979+
Scope::TrackingRateInfo rateInfo;
980+
wxStopWatch timer;
981+
982+
if (!pPointingSource->GetTrackingRate(rateInfo))
983+
{
984+
if (rateInfo.name != m_trackingRateName)
985+
{
986+
int inx = m_mountTrackingRate->FindString(rateInfo.name);
987+
m_mountTrackingRate->SetSelection(inx);
988+
ShowStatus(_("Mount tracking rate reset by another application"));
989+
}
990+
else
991+
ShowStatus(_("Mount tracking rate confirmed"));
992+
}
993+
else
994+
{
995+
int inx = m_mountTrackingRate->FindString("Sidereal");
996+
m_mountTrackingRate->SetSelection(inx);
997+
ShowStatus(_("Mount driver can't set/return tracking rates correctly"));
998+
}
999+
}
1000+
9721001
void SolarSysToolWin::OnMountTrackingRateClick(wxCommandEvent& event)
9731002
{
9741003
if (pPointingSource && pPointingSource->IsConnected())
@@ -982,30 +1011,11 @@ void SolarSysToolWin::OnMountTrackingRateClick(wxCommandEvent& event)
9821011
int *pRate = (int *) m_mountTrackingRate->GetClientData(sel);
9831012
pPointingSource->SetTrackingRate((TrackingRates) *pRate);
9841013
Debug.Write(wxString::Format("SSG: requesting mount tracking rate of %s\n", m_trackingRateName));
1014+
ShowStatus(wxString::Format(_("Requested mount tracking rate change to %s\n"), m_trackingRateName));
9851015
pFrame->NotifyGuidingParam("SSG: mount tracking rate", m_trackingRateName);
9861016
// Need to see if the change "stuck" - can be over-written by mount s/w using customized tracking
987-
Scope::TrackingRateInfo rateInfo;
988-
wxStopWatch timer;
989-
timer.Start();
990-
while (timer.Time() < 3000)
991-
wxMilliSleep(100);
992-
if (!pPointingSource->GetTrackingRate(rateInfo))
993-
{
994-
if (rateInfo.name != m_trackingRateName)
995-
{
996-
int inx = m_mountTrackingRate->FindString(rateInfo.name);
997-
m_mountTrackingRate->SetSelection(inx);
998-
ShowStatus(_("Mount tracking rate reset by another application"));
999-
}
1000-
else
1001-
ShowStatus(_("Mount tracking rate confirmed"));
1002-
}
1003-
else
1004-
{
1005-
int inx = m_mountTrackingRate->FindString("Sidereal");
1006-
m_mountTrackingRate->SetSelection(inx);
1007-
ShowStatus(_("Mount driver can't set/return tracking rates correctly"));
1008-
}
1017+
m_ConfirmationPeriodStart = wxDateTime::Now(); // Check it after 3 seconds
1018+
m_trackingRateNeedsConfirmation = true;
10091019
}
10101020
}
10111021

@@ -1205,6 +1215,17 @@ void SolarSysToolWin::UpdateCentroidInfo(float xLoc, float yLoc, float radius)
12051215
m_statsGrid->SetCellValue(1, 1, locStr);
12061216
m_statsGrid->SetCellValue(4, 1, wxString::Format("%0.2f", radius * 2.0));
12071217
m_lastDiameter = 2 * radius;
1218+
// Just take advantage of a periodic function to handle a one-time, little-used verification
1219+
if (m_trackingRateNeedsConfirmation)
1220+
{
1221+
wxDateTime now = wxDateTime::Now();
1222+
wxTimeSpan interval = now - m_ConfirmationPeriodStart;
1223+
if (interval.GetSeconds() >= 3)
1224+
{
1225+
ConfirmMountTrackingRate();
1226+
m_trackingRateNeedsConfirmation = false;
1227+
}
1228+
}
12081229
}
12091230

12101231
void SolarSysToolWin::UpdateDetectionStats(int rsmpCount, int rsmpReductions, int lostEvents, int totalEvents)
@@ -1304,10 +1325,12 @@ void SolarSysToolWin::NotifyMountConnectionChange(bool Connected)
13041325
m_mountTrackingRate->Enable(false);
13051326
}
13061327

1328+
// This is used by SolarSys.cpp for auto-adjusting min blob size
13071329
void SolarSysToolWin::ChangeMinBlobDiameter(int val)
13081330
{
13091331
m_minBlobDiameter->SetValue(val);
13101332
ShowAngularSize(val, m_minBlobDiameterAngle);
1333+
pFrame->NotifyGuidingParam("SolarSys: Blob min diam", val);
13111334
}
13121335

13131336
// Restores profile value in UI if profile is switched while window is already displayed

0 commit comments

Comments
 (0)