Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending PHD2 for Planetary Guiding #1187

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ set(guiding_SRC
${phd_src_dir}/guide_algorithms.h
${phd_src_dir}/guider_multistar.cpp
${phd_src_dir}/guider_multistar.h
${phd_src_dir}/guider_planetary.cpp
${phd_src_dir}/guider_planetary.h
${phd_src_dir}/guider.cpp
${phd_src_dir}/guider.h
${phd_src_dir}/guiders.h
Expand Down Expand Up @@ -425,6 +427,8 @@ set(phd2_SRC
${phd_src_dir}/phdupdate.h
${phd_src_dir}/pierflip_tool.cpp
${phd_src_dir}/pierflip_tool.h
${phd_src_dir}/planetary_tool.cpp
${phd_src_dir}/planetary_tool.h
${phd_src_dir}/polardrift_tool.h
${phd_src_dir}/polardrift_toolwin.h
${phd_src_dir}/polardrift_toolwin.cpp
Expand Down
1 change: 0 additions & 1 deletion Refine_DefMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ void RefineDefMap::LoadFromProfile()
{
// Let the user know this might take some time...
ShowStatus(_("Please wait while image statistics are being computed..."), false);


m_darks.LoadDarks();
m_builder.Init(m_darks);
Expand Down
2 changes: 0 additions & 2 deletions advanced_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,6 @@ void AdvancedDialog::MakeImageScaleAdjustments()
Debug.Write("Calibrations cleared because of image scale change\n");
}
}


}

int AdvancedDialog::GetBinning()
Expand Down
32 changes: 16 additions & 16 deletions aui_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,18 @@ SBStarIndicators::SBStarIndicators(SBPanel *panel, std::vector<int>& fldWidths)

int txtHeight;
panel->GetTextExtent(_("SNR"), &snrLabelWidth, &txtHeight);
panel->GetTextExtent("999.9", &snrValueWidth, &txtHeight);
panel->GetTextExtent(_("SAT"), &satWidth, &txtHeight);
panel->GetTextExtent("99999.9", &snrValueWidth, &txtHeight);
panel->GetTextExtent(_("PLANET"), &satWidth, &txtHeight);
fldWidths.push_back(satWidth + 1 * panel->emWidth);
fldWidths.push_back(snrLabelWidth + snrValueWidth + 2 * panel->emWidth);

// Use default positions for control creation - positioning is handled explicitly in PositionControls()
txtStarInfo = new wxStaticText(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(satWidth, -1));
txtStarInfo->SetBackgroundColour(*wxBLACK);
txtStarInfo->SetForegroundColour(*wxWHITE);
txtStarInfo->SetToolTip(_("In multiple star mode, displays the number of guiding stars out of the total detected. "
"In single star mode, shows 'STAR*' (or 'SAT' if the star is saturated), and 'PLANET' in planetary detection mode."));

// Label and value fields separated to allow different foreground colors for each
txtSNRLabel = new wxStaticText(panel, wxID_ANY, _("SNR"), wxDefaultPosition, wxDefaultSize);
txtSNRValue = new wxStaticText(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(snrValueWidth, 3), wxALIGN_RIGHT);
Expand Down Expand Up @@ -425,21 +428,19 @@ void SBStarIndicators::UpdateState(double MassPct, double SNR, bool Saturated)
txtSNRValue->SetForegroundColour(*wxRED);
}
m_parentPanel->ShowControl(txtSNRLabel, true);
txtSNRValue->SetLabelText(wxString::Format("%3.1f", SNR));
txtSNRValue->SetLabelText(wxString::Format("%4.1f", SNR));
m_parentPanel->ShowControl(txtStarInfo, true);
m_parentPanel->ShowControl(txtSNRValue, true);
if (pFrame->pGuider->GetMultiStarMode())
{
wxString txtCount = pFrame->pGuider->GetStarCount();
txtStarInfo->SetLabelText(txtCount);
}

// Update the star info text
wxString starText;
if (pFrame->GetStarFindMode() == Star::FIND_PLANET)
starText = _T("PLANET");
else if (pFrame->pGuider->GetMultiStarMode())
starText = pFrame->pGuider->GetStarCount();
else
{
if (Saturated)
txtStarInfo->SetLabelText("SAT");
else
txtStarInfo->SetLabelText(wxEmptyString);
}
starText = Saturated ? _T(" SAT ") : _T("STAR*");
txtStarInfo->SetLabelText(starText);
}
else
{
Expand Down Expand Up @@ -512,7 +513,7 @@ void SBGuideIndicators::PositionControls()
wxPoint decPosition = m_parentPanel->FieldLoc(fieldNum);
txtDecAmounts->SetPosition(decPosition);

decPosition.x += txtWidth + 8;
decPosition.x += txtWidth + 18;
decPosition.y -= 1;
bitmapDec->SetPosition(decPosition);
}
Expand Down Expand Up @@ -879,7 +880,6 @@ void SBStateIndicators::UpdateState()
}
}


enum {
SB_HEIGHT = 16
};
Expand Down
1 change: 0 additions & 1 deletion backlash_comp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
static const unsigned int MIN_COMP_AMOUNT = 20; // min pulse in ms, must be small enough to effectively disable blc
static const unsigned int MAX_COMP_AMOUNT = 8000; // max pulse in ms


class CorrectionTuple
{
public:
Expand Down
1 change: 0 additions & 1 deletion calibration_assistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ class CalCustomDialog : public wxDialog
CalCustomDialog(CalibrationAssistant* Parent, int DefaultHA, int DefaultDec);
};


// Utility function to add the <label, input> pairs to a flexgrid
static void AddTableEntryPair(wxWindow *parent, wxFlexGridSizer *pTable, const wxString& label, wxWindow *pControl)
{
Expand Down
1 change: 0 additions & 1 deletion cam_INovaPLC.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*
*/


#ifndef CAM_INOVAPLC_H_INCLUDED
#define CAM_INOVAPLC_H_INCLUDED

Expand Down
1 change: 0 additions & 1 deletion cam_KWIQGuider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*
*/


#include "phd.h"

#ifdef KWIQGUIDER_CAMERA
Expand Down
1 change: 0 additions & 1 deletion cam_KWIQGuider.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*
*/


#ifndef CAM_KWIQGUIDER_INCLUDED
#define CAM_KWIQGUIDER_INCLUDED

Expand Down
1 change: 0 additions & 1 deletion cam_NebSBIG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*
*/


#include "phd.h"

#ifdef NEB_SBIG
Expand Down
3 changes: 1 addition & 2 deletions cam_altair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ inline static int round_up(int v, int m)
return round_down(v + m - 1, m);
}


void __stdcall CameraCallback(unsigned int event, void *pCallbackCtx)
{
if (event == ALTAIRCAM_EVENT_IMAGE)
Expand Down Expand Up @@ -573,7 +572,7 @@ bool AltairCamera::Capture(int duration, usImage& img, int options, const wxRect
// which could be quite stale. read out all buffered frames so the frame we
// get is current

//flush_buffered_image(m_handle, img);
// flush_buffered_image(m_handle, img);
unsigned int width, height;
while (SUCCEEDED(m_sdk.PullImage(m_handle, m_buffer, 8, &width, &height)))
{
Expand Down
1 change: 0 additions & 1 deletion cam_firewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*
*/


#ifndef FIREWIREDEF
#define FIREWIREDEF

Expand Down
4 changes: 0 additions & 4 deletions cam_firewire_IC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@
// Deal with 8-bit vs. 16-bit??
// Take care of gain capability


// Start stream in InitCapture()?


#include "cam_firewire.h"
using namespace _DSHOWLIB_NAMESPACE;


CameraFirewire::CameraFirewire()
{
Connected = false;
Expand Down Expand Up @@ -303,7 +300,6 @@ bool CameraFirewire::Capture(int duration, usImage& img, int options, const wxRe

// Flush


// grab the next frame

Error err = pSink->snapImages( 1,15000 );
Expand Down
6 changes: 3 additions & 3 deletions cam_firewire_OSX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool CameraFirewire::Connect(const wxString& camId)
dc1394video_mode_t vidmode;

if(m_dcContext == 0)
{
{
m_dcContext = dc1394_new();
}
if(m_dcContext == 0)
Expand Down Expand Up @@ -113,9 +113,9 @@ bool CameraFirewire::Connect(const wxString& camId)
return true;
}
}

uint64_t camera_guid = cameras->ids[CamNum].guid;

// Free unused cameras, open the one with the guid above.
dc1394_camera_free_list(cameras);

Expand Down
18 changes: 4 additions & 14 deletions cam_indi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include <libindi/basedevice.h>
#include <libindi/indiproperty.h>


class CapturedFrame
{
public:
Expand Down Expand Up @@ -172,7 +171,6 @@ class CameraINDI : public GuideCamera, public INDI::BaseClient
void serverConnected() override;
void serverDisconnected(int exit_code) override;


public:
CameraINDI();
~CameraINDI();
Expand Down Expand Up @@ -458,15 +456,11 @@ void CameraINDI::updateProperty(INDI::Property property)
StackStream(&cf);
}
}


}
break;
default:
break;
}


}

void CameraINDI::newMessage(INDI::BaseDevice dp, int messageID)
Expand All @@ -477,7 +471,6 @@ void CameraINDI::newMessage(INDI::BaseDevice dp, int messageID)
Debug.Write(wxString::Format("INDI Camera Received message: %s\n", dp.messageQueue(messageID)));
}


void CameraINDI::newProperty(INDI::Property property)
{
// Here we receive a list of all the properties after the connection
Expand Down Expand Up @@ -639,28 +632,25 @@ bool CameraINDI::Connect(const wxString& camId)
watchDevice(INDICameraName.mb_str(wxConvUTF8));

Debug.Write(wxString::Format("Waiting for 30s for [%s] to connect...\n", INDICameraName));

/* Wait in background for driver to establish a device connection */
struct ConnectInBg : public ConnectCameraInBg
{
CameraINDI *cam;
ConnectInBg(CameraINDI *cam_) : cam(cam_) { }
bool Entry()
{

//Wait for driver to establish a device connection
// Wait for driver to establish a device connection
if (cam->connectServer())
{

int i = 0;
while (!cam->Connected && i++ < 300)
while (!cam->Connected && i++ < 300)
{
if (IsCanceled())
break;

wxMilliSleep(100);
}

}

// We need to return FALSE if we are successful
Expand Down
2 changes: 1 addition & 1 deletion cam_opencv.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CameraOpenCV : public GuideCamera
bool Capture(int duration, usImage& img, int options, const wxRect& subframe) override;
bool Connect(const wxString& camId) override;
bool Disconnect() override;
bool HasNonGuiCapture() override { return true; }
bool HasNonGuiCapture() override { return true; }
wxByte BitsPerPixel() override;
};

Expand Down
2 changes: 0 additions & 2 deletions cam_openssag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
*
*/



#include "phd.h"

#ifdef OPENSSAG_CAMERA
Expand Down
1 change: 0 additions & 1 deletion cam_openssag.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*
*/


#ifndef CAM_OPENSSAG_H_INCLUDED
#define CAM_OPENSSAG_H_INCLUDED

Expand Down
1 change: 0 additions & 1 deletion cam_qguide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <wx/textfile.h>
//wxTextFile *qglogfile;


int ushort_compare (const void * a, const void * b) {
if ( *(unsigned short *)a > *(unsigned short *)b ) return 1;
if ( *(unsigned short *)a < *(unsigned short *)b ) return -1;
Expand Down
4 changes: 2 additions & 2 deletions cam_svb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ bool SVBCamera::Connect(const wxString& camId)
case SVB_WB_R:
case SVB_WB_G:
case SVB_WB_B:
case SVB_FLIP: //reference: enum SVB_FLIP_STATUS
case SVB_FLIP: // reference: enum SVB_FLIP_STATUS
case SVB_FRAME_SPEED_MODE: // 0:low speed, 1:medium speed, 2:high speed
case SVB_CONTRAST:
case SVB_SHARPNESS:
case SVB_SATURATION:
case SVB_AUTO_TARGET_BRIGHTNESS:
case SVB_BLACK_LEVEL: //black level offset
case SVB_BLACK_LEVEL: // black level offset
SVBSetControlValue(m_cameraId, caps.ControlType, caps.DefaultValue, SVB_FALSE);
break;

Expand Down
4 changes: 2 additions & 2 deletions cam_sxv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,11 @@ static bool InitImgCMOSGuider(usImage& img, const wxSize& FullSize, const unsign
evenbias = evenbias / 8 - 1000;
for (int x = 0; x < output_xsize; x += 2) { // Load value into new image array pulling out right bias
int val = (int)*rawptr++ - oddbias;
if (val < 0) val = 0; //Bounds check
if (val < 0) val = 0; // Bounds check
else if (val > 65535) val = 65535;
*dataptr++ = (unsigned short)val;
val = (int)*rawptr++ - evenbias;
if (val < 0) val = 0; //Bounds check
if (val < 0) val = 0; // Bounds check
else if (val > 65535) val = 65535;
*dataptr++ = (unsigned short)val;
}
Expand Down
1 change: 0 additions & 1 deletion cam_vfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ bool CameraVFW::Capture(int duration, usImage& img, int options, const wxRect& s
return false;
}


void CameraVFW::ShowPropertyDialog() {
// if (event.GetId() == ADV_BUTTON1) {
/* if (VFW_Window->HasVideoFormatDialog()) {
Expand Down
1 change: 0 additions & 1 deletion camcal_import_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*
*/


// Handles import of camera calibration files (dark library, bad-pix map files) from user-selected profile to the current profile
// Source profile choices are limited to camera data with compatible geometry

Expand Down
3 changes: 3 additions & 0 deletions camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ bool GuideCamera::SetCameraGain(int cameraGain)

pConfig->Profile.SetInt("/camera/gain", GuideCameraGain);

if (pFrame)
pFrame->UpdateCameraSettings();

return bError;
}

Expand Down
Loading