From 0828d81d61e2ed993e9ac72611342560ad1de875 Mon Sep 17 00:00:00 2001 From: Andy Galasso Date: Mon, 6 Jan 2025 15:51:16 -0500 Subject: [PATCH] Code cleanup - dead code removal (ClearGuidePort) (#1284) 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. --- src/cam_altair.cpp | 6 ------ src/cam_atik16.cpp | 6 ------ src/cam_playerone.cpp | 9 --------- src/cam_qguide.cpp | 13 ++----------- src/cam_qguide.h | 1 - src/cam_qhy5.cpp | 6 ------ src/cam_qhy5.h | 1 - src/cam_sspiag.cpp | 5 ----- src/cam_sspiag.h | 1 - src/cam_zwo.cpp | 9 --------- 10 files changed, 2 insertions(+), 55 deletions(-) diff --git a/src/cam_altair.cpp b/src/cam_altair.cpp index 40ca8922e..681dbb37d 100644 --- a/src/cam_altair.cpp +++ b/src/cam_altair.cpp @@ -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); diff --git a/src/cam_atik16.cpp b/src/cam_atik16.cpp index 0758cff69..9f7114ed7 100644 --- a/src/cam_atik16.cpp +++ b/src/cam_atik16.cpp @@ -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)) diff --git a/src/cam_playerone.cpp b/src/cam_playerone.cpp index e801d7ef0..a1c3fa926 100644 --- a/src/cam_playerone.cpp +++ b/src/cam_playerone.cpp @@ -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 diff --git a/src/cam_qguide.cpp b/src/cam_qguide.cpp index dd69bc692..055da5d26 100644 --- a/src/cam_qguide.cpp +++ b/src/cam_qguide.cpp @@ -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(); diff --git a/src/cam_qguide.h b/src/cam_qguide.h index 700e780ea..2b79f10d9 100644 --- a/src/cam_qguide.h +++ b/src/cam_qguide.h @@ -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; diff --git a/src/cam_qhy5.cpp b/src/cam_qhy5.cpp index c02b5809c..eb662019f 100644 --- a/src/cam_qhy5.cpp +++ b/src/cam_qhy5.cpp @@ -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() diff --git a/src/cam_qhy5.h b/src/cam_qhy5.h index 8090c8d7b..cc78fa166 100644 --- a/src/cam_qhy5.h +++ b/src/cam_qhy5.h @@ -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; }; diff --git a/src/cam_sspiag.cpp b/src/cam_sspiag.cpp index ca0e0d6b6..bde3a822f 100644 --- a/src/cam_sspiag.cpp +++ b/src/cam_sspiag.cpp @@ -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); diff --git a/src/cam_sspiag.h b/src/cam_sspiag.h index 75b239d87..035f0ef11 100644 --- a/src/cam_sspiag.h +++ b/src/cam_sspiag.h @@ -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; } diff --git a/src/cam_zwo.cpp b/src/cam_zwo.cpp index 8f1f1b49f..608664580 100644 --- a/src/cam_zwo.cpp +++ b/src/cam_zwo.cpp @@ -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();