Skip to content

Commit

Permalink
Code cleanup - dead code removal (ClearGuidePort) (#1284)
Browse files Browse the repository at this point in the history
A bunch of the cameras implement ClearGuidePort which is not
needed and has no callers, but it keeps getting propagated when
new cameras a copy-pasted from older ones.
  • Loading branch information
agalasso authored Jan 6, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 1354fc3 commit 10f718b
Showing 10 changed files with 2 additions and 55 deletions.
6 changes: 0 additions & 6 deletions src/cam_altair.cpp
Original file line number Diff line number Diff line change
@@ -155,7 +155,6 @@ struct AltairCamera : public GuideCamera
bool Disconnect() override;

bool ST4PulseGuideScope(int direction, int duration) override;
void ClearGuidePort();

void ShowPropertyDialog() override;

@@ -669,11 +668,6 @@ bool AltairCamera::ST4PulseGuideScope(int direction, int duration)
return false;
}

void AltairCamera::ClearGuidePort()
{
m_sdk.ST4PlusGuide(m_handle, 0, 0);
}

GuideCamera *AltairCameraFactory::MakeAltairCamera(AltairCamType type)
{
return new AltairCamera(type);
6 changes: 0 additions & 6 deletions src/cam_atik16.cpp
Original file line number Diff line number Diff line change
@@ -62,7 +62,6 @@ class CameraAtik16 : public GuideCamera
bool Disconnect() override;

bool ST4PulseGuideScope(int direction, int duration) override;
void ClearGuidePort();
wxByte BitsPerPixel() override;

bool Color;
@@ -268,11 +267,6 @@ bool CameraAtik16::ST4PulseGuideScope(int direction, int duration)
return false;
}

void CameraAtik16::ClearGuidePort()
{
ArtemisStopGuiding(Cam_Handle);
}

bool CameraAtik16::Disconnect()
{
if (ArtemisIsConnected(Cam_Handle))
9 changes: 0 additions & 9 deletions src/cam_playerone.cpp
Original file line number Diff line number Diff line change
@@ -83,7 +83,6 @@ class POACamera : public GuideCamera
bool Disconnect() override;

bool ST4PulseGuideScope(int direction, int duration) override;
void ClearGuidePort();

void ShowPropertyDialog() override;
bool HasNonGuiCapture() override { return true; }
@@ -991,14 +990,6 @@ bool POACamera::ST4PulseGuideScope(int direction, int duration)
return false;
}

void POACamera::ClearGuidePort()
{
SetConfig(m_cameraId, POA_GUIDE_NORTH, POA_FALSE);
SetConfig(m_cameraId, POA_GUIDE_SOUTH, POA_FALSE);
SetConfig(m_cameraId, POA_GUIDE_EAST, POA_FALSE);
SetConfig(m_cameraId, POA_GUIDE_WEST, POA_FALSE);
}

// Functions from Player One ConvFuncs.h

// Get the current value of POAConfig with POAValueType is VAL_INT, eg: POA_EXPOSURE, POA_GAIN
13 changes: 2 additions & 11 deletions src/cam_qguide.cpp
Original file line number Diff line number Diff line change
@@ -75,17 +75,13 @@ wxByte CameraQGuider::BitsPerPixel()
bool CameraQGuider::Connect(const wxString& camId)
{
// returns true on error
// CameraReset();

if (!openUSB(0))
return CamConnectFailed(_("No camera"));

// ClearGuidePort();
// GuideCommand(0x0F,10);
// buffer = new unsigned char[1311744];
SETBUFFERMODE(0);
Connected = true;
// qglogfile = new wxTextFile(Debug.GetLogDir() + PATHSEPSTR + _T("PHD_QGuide_log.txt"));
// qglogfile->AddLine(wxNow() + ": QGuide connected"); //qglogfile->Write();

return false;
}

@@ -122,11 +118,6 @@ bool CameraQGuider::ST4PulseGuideScope(int direction, int duration)
return false;
}

void CameraQGuider::ClearGuidePort()
{
// SendGuideCommand(DevName,0,0);
}

void CameraQGuider::InitCapture()
{
// CameraReset();
1 change: 0 additions & 1 deletion src/cam_qguide.h
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@ class CameraQGuider : public GuideCamera
void InitCapture() override;

bool ST4PulseGuideScope(int direction, int duration) override;
void ClearGuidePort();
bool HasNonGuiCapture() override { return true; }
bool ST4HasNonGuiMove() override { return true; }
wxByte BitsPerPixel() override;
6 changes: 0 additions & 6 deletions src/cam_qhy5.cpp
Original file line number Diff line number Diff line change
@@ -173,12 +173,6 @@ bool CameraQHY5::ST4PulseGuideScope(int direction, int duration)
return result < 0 ? true : false;
}

void CameraQHY5::ClearGuidePort()
{
int16_t res = 0;
libusb_control_transfer(m_handle, 0xc2, 0x18, 0, 0, (unsigned char *) &res, sizeof(res), 5000);
}

void CameraQHY5::InitCapture() { }

bool CameraQHY5::Disconnect()
1 change: 0 additions & 1 deletion src/cam_qhy5.h
Original file line number Diff line number Diff line change
@@ -51,7 +51,6 @@ class CameraQHY5 : public GuideCamera
bool ST4PulseGuideScope(int direction, int duration) override;
bool ST4HasNonGuiMove() override { return true; }
bool HasNonGuiCapture() override { return true; }
void ClearGuidePort();
wxByte BitsPerPixel() override;
};

5 changes: 0 additions & 5 deletions src/cam_sspiag.cpp
Original file line number Diff line number Diff line change
@@ -333,11 +333,6 @@ bool CameraSSPIAG::ST4PulseGuideScope(int direction, int duration)
return false;
}

void CameraSSPIAG::ClearGuidePort()
{
Q5V_SendGuideCommand("QHY5V-0", 0, 0);
}

void CameraSSPIAG::InitCapture()
{
// Q5V_SetQHY5VGlobalGain(GuideCameraGain * 63 / 100);
1 change: 0 additions & 1 deletion src/cam_sspiag.h
Original file line number Diff line number Diff line change
@@ -48,7 +48,6 @@ class CameraSSPIAG : public GuideCamera
void InitCapture() override;

bool ST4PulseGuideScope(int direction, int duration) override;
void ClearGuidePort();

bool HasNonGuiCapture() override { return true; }
bool ST4HasNonGuiMove() override { return true; }
9 changes: 0 additions & 9 deletions src/cam_zwo.cpp
Original file line number Diff line number Diff line change
@@ -84,7 +84,6 @@ class Camera_ZWO : public GuideCamera
bool Disconnect() override;

bool ST4PulseGuideScope(int direction, int duration) override;
void ClearGuidePort();

void ShowPropertyDialog() override;
bool HasNonGuiCapture() override { return true; }
@@ -989,14 +988,6 @@ bool Camera_ZWO::ST4PulseGuideScope(int direction, int duration)
return false;
}

void Camera_ZWO::ClearGuidePort()
{
ASIPulseGuideOff(m_cameraId, ASI_GUIDE_NORTH);
ASIPulseGuideOff(m_cameraId, ASI_GUIDE_SOUTH);
ASIPulseGuideOff(m_cameraId, ASI_GUIDE_EAST);
ASIPulseGuideOff(m_cameraId, ASI_GUIDE_WEST);
}

GuideCamera *ZWOCameraFactory::MakeZWOCamera()
{
return new Camera_ZWO();

0 comments on commit 10f718b

Please sign in to comment.