Skip to content

Commit 96b5f95

Browse files
authored
Saturation adu change (#1269)
* Cleanup of MultiStar processing and UI if subframes enabled * Force rebuild of MultiStar list when subframes are disabled * Fix star.cpp clang regression * Remove bit-depth controls from profile wizard; add code to set a rational default saturation ADU value based on bit-depth
1 parent 0b04d07 commit 96b5f95

File tree

2 files changed

+14
-43
lines changed

2 files changed

+14
-43
lines changed

src/profile_wizard.cpp

+4-41
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ class ProfileWizard : public wxDialog
8282
wxStaticBitmap *m_scaleIcon;
8383
wxStaticText *m_pixelScale;
8484
wxChoice *m_pBinningLevel;
85-
wxRadioButton *m_pBits8;
86-
wxRadioButton *m_pBits16;
8785
wxSpinCtrlDouble *m_pFocalLength;
8886
wxStaticText *m_pFocalLengthWarning;
8987
wxSpinCtrlDouble *m_pGuideSpeed;
@@ -270,21 +268,12 @@ ProfileWizard::ProfileWizard(wxWindow *parent, bool showGreeting)
270268
"With long focal length guide scopes and OAGs, binning can allow use of fainter guide "
271269
"stars. For more common setups, it's better to leave binning at 1."));
272270
m_pBinningLevel->SetSelection(0);
273-
m_pBits8 = new wxRadioButton(this, wxID_ANY, _("8-bit"));
274-
m_pBits8->SetToolTip(_("Choose this if your guide camera driver downloads 8-bit data"));
275-
m_pBits16 = new wxRadioButton(this, wxID_ANY, _("16-bit"));
276-
m_pBits16->SetToolTip(_("Choose this if your guide camera driver downoads 16-bit data. Requires a camera with 10, 12, 14 "
277-
"or 16-bit ADC electronics"));
271+
278272
wxBoxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
279273
sz->Add(Label(this, _("Binning level")), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
280274
sz->Add(m_pBinningLevel, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
281275
m_pUserProperties->Add(sz, wxGBPosition(1, 1), wxDefaultSpan, 0, 0);
282-
// Camera bit depth
283-
wxBoxSizer *sz2 = new wxBoxSizer(wxHORIZONTAL);
284-
sz2->Add(Label(this, _("Bit depth (bits/pixel)")), 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
285-
sz2->Add(m_pBits8, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
286-
sz2->Add(m_pBits16, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
287-
m_pUserProperties->Add(sz2, wxGBPosition(2, 1), wxDefaultSpan, 0, 0);
276+
288277
// Focal length
289278
m_pFocalLength = pFrame->MakeSpinCtrlDouble(this, ID_FOCALLENGTH, wxEmptyString, wxDefaultPosition,
290279
wxSize(StringWidth(this, _T("888888")), -1), wxSP_ARROW_KEYS,
@@ -631,8 +620,7 @@ bool ProfileWizard::SemanticCheck(DialogState state, int change)
631620
case STATE_GREETINGS:
632621
break;
633622
case STATE_CAMERA:
634-
bOk = (m_SelectedCamera.length() > 0 && m_PixelSize > 0 && m_FocalLength > 0 &&
635-
(m_pBits8->GetValue() || m_pBits16->GetValue()) && m_SelectedCamera != _("None"));
623+
bOk = (m_SelectedCamera.length() > 0 && m_PixelSize > 0 && m_FocalLength > 0 && m_SelectedCamera != _("None"));
636624
if (!bOk)
637625
ShowStatus(_("Please specify camera type, guider focal length, camera bit-depth, and guide camera pixel size"));
638626
break;
@@ -983,10 +971,7 @@ void ProfileWizard::WrapUp()
983971
double ImageScale = MyFrame::GetPixelScale(m_PixelSize, m_FocalLength, binning);
984972
if (ImageScale < 2.0)
985973
pConfig->Profile.SetBoolean("/guider/onestar/MassChangeThresholdEnabled", false);
986-
if (m_pBits8->GetValue())
987-
pConfig->Profile.SetInt("/camera/SaturationADU", 255);
988-
else
989-
pConfig->Profile.SetInt("/camera/SaturationADU", 65535);
974+
pConfig->Profile.SetInt("/camera/SaturationADU", 0); // Default will be updated with first auto-find to reflect bpp
990975

991976
GuideLog.EnableLogging(true); // Especially for newbies
992977

@@ -1161,8 +1146,6 @@ static double GetPixelSize(GuideCamera *cam)
11611146

11621147
void ProfileWizard::InitCameraProps(bool tryConnect)
11631148
{
1164-
m_pBits8->Enable(true);
1165-
m_pBits16->Enable(true);
11661149
if (tryConnect)
11671150
{
11681151
// Pixel size
@@ -1182,24 +1165,6 @@ void ProfileWizard::InitCameraProps(bool tryConnect)
11821165
GuideCamera::GetBinningOpts(4, &opts);
11831166
m_pBinningLevel->Set(opts);
11841167
m_pBinningLevel->SetSelection(0);
1185-
// Bit depth
1186-
wxByte bitDepth = 0;
1187-
if (cam)
1188-
bitDepth = cam->BitsPerPixel();
1189-
if (bitDepth == 0) // Cam doesn't report it, force the user to choose
1190-
{
1191-
m_pBits8->SetValue(false);
1192-
m_pBits16->SetValue(false);
1193-
}
1194-
else
1195-
{
1196-
m_pBits8->Enable(false);
1197-
m_pBits16->Enable(false);
1198-
if (bitDepth == 8)
1199-
m_pBits8->SetValue(true);
1200-
else
1201-
m_pBits16->SetValue(true);
1202-
}
12031168
}
12041169
else
12051170
{
@@ -1211,8 +1176,6 @@ void ProfileWizard::InitCameraProps(bool tryConnect)
12111176
m_pPixelSize->Enable(true);
12121177
wxSpinDoubleEvent dummy;
12131178
OnPixelSizeChange(dummy);
1214-
m_pBits8->SetValue(false); // force a user selection
1215-
m_pBits16->SetValue(false);
12161179
}
12171180
}
12181181

src/star.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,16 @@ bool GuideStar::AutoFind(const usImage& image, int extraEdgeAllowance, int searc
953953

954954
if (pCamera->IsSaturationByADU())
955955
{
956-
// known saturation level ... easy
957-
sat_level = pCamera->GetSaturationADU() + image.Pedestal;
956+
// known saturation level ... maybe easy
957+
unsigned short satADU = pCamera->GetSaturationADU();
958+
wxByte bpp = image.BitsPerPixel;
959+
if (satADU == 0 || (bpp == 8 && satADU > 255) || (bpp > 8 && satADU < 4095))
960+
{
961+
satADU = ((1U << bpp) - 1);
962+
pCamera->SetSaturationByADU(true, satADU);
963+
Debug.Write(wxString::Format("SaturationADU auto-adjusted to %d\n", satADU));
964+
}
965+
sat_level = satADU + image.Pedestal;
958966
}
959967
else
960968
{

0 commit comments

Comments
 (0)