From 772c1303bfda4ba3864c03a8b315261424c57097 Mon Sep 17 00:00:00 2001 From: Andy Galasso Date: Sun, 8 Sep 2024 14:12:37 -0400 Subject: [PATCH] PlayerOne cameras: update to SDK version V3.7.1 * Merge prior work on PlayerOne cameras with Ethan's * format source files with clang-format * tested on Mac and Windows --- CMakeLists.txt | 18 +- build/unpack_playerone_sdk | 72 ++++++ cameras/PlayerOneCamera.lib | Bin 13960 -> 0 bytes .../{ => playerone/include}/PlayerOneCamera.h | 0 .../linux/arm32/libPlayerOneCamera.so | 0 .../linux/arm32/libPlayerOneCamera.so.3 | 0 .../linux/arm32/libPlayerOneCamera.so.3.7 | 0 .../linux/arm32/libPlayerOneCamera.so.3.7.1 | Bin .../linux/arm64/libPlayerOneCamera.so | 0 .../linux/arm64/libPlayerOneCamera.so.3 | 0 .../linux/arm64/libPlayerOneCamera.so.3.7 | 0 .../linux/arm64/libPlayerOneCamera.so.3.7.1 | Bin .../linux/x64/libPlayerOneCamera.so | 0 .../linux/x64/libPlayerOneCamera.so.3 | 0 .../linux/x64/libPlayerOneCamera.so.3.7 | 0 .../linux/x64/libPlayerOneCamera.so.3.7.1 | Bin .../linux/x86/libPlayerOneCamera.so | 0 .../linux/x86/libPlayerOneCamera.so.3 | 0 .../linux/x86/libPlayerOneCamera.so.3.7 | 0 .../linux/x86/libPlayerOneCamera.so.3.7.1 | Bin .../mac/libPlayerOneCamera.dylib} | Bin .../playerone/win}/PlayerOneCamera.dll | Bin 520392 -> 520392 bytes cameras/playerone/win/PlayerOneCamera.lib | Bin 0 -> 13960 bytes .../poalibs/mac/libPlayerOneCamera.3.7.dylib | 1 - .../poalibs/mac/libPlayerOneCamera.3.dylib | 1 - cameras/poalibs/mac/libPlayerOneCamera.dylib | 1 - src/{cam_poa.cpp => cam_playerone.cpp} | 216 +++++++++--------- src/cam_playerone.h | 45 ++++ src/cam_poa.h | 45 ---- src/camera.cpp | 22 +- src/cameras.h | 14 +- thirdparty/thirdparty.cmake | 73 +++--- 32 files changed, 296 insertions(+), 212 deletions(-) create mode 100755 build/unpack_playerone_sdk delete mode 100644 cameras/PlayerOneCamera.lib rename cameras/{ => playerone/include}/PlayerOneCamera.h (100%) rename cameras/{poalibs => playerone}/linux/arm32/libPlayerOneCamera.so (100%) rename cameras/{poalibs => playerone}/linux/arm32/libPlayerOneCamera.so.3 (100%) rename cameras/{poalibs => playerone}/linux/arm32/libPlayerOneCamera.so.3.7 (100%) rename cameras/{poalibs => playerone}/linux/arm32/libPlayerOneCamera.so.3.7.1 (100%) mode change 100644 => 100755 rename cameras/{poalibs => playerone}/linux/arm64/libPlayerOneCamera.so (100%) rename cameras/{poalibs => playerone}/linux/arm64/libPlayerOneCamera.so.3 (100%) rename cameras/{poalibs => playerone}/linux/arm64/libPlayerOneCamera.so.3.7 (100%) rename cameras/{poalibs => playerone}/linux/arm64/libPlayerOneCamera.so.3.7.1 (100%) mode change 100644 => 100755 rename cameras/{poalibs => playerone}/linux/x64/libPlayerOneCamera.so (100%) rename cameras/{poalibs => playerone}/linux/x64/libPlayerOneCamera.so.3 (100%) rename cameras/{poalibs => playerone}/linux/x64/libPlayerOneCamera.so.3.7 (100%) rename cameras/{poalibs => playerone}/linux/x64/libPlayerOneCamera.so.3.7.1 (100%) mode change 100644 => 100755 rename cameras/{poalibs => playerone}/linux/x86/libPlayerOneCamera.so (100%) rename cameras/{poalibs => playerone}/linux/x86/libPlayerOneCamera.so.3 (100%) rename cameras/{poalibs => playerone}/linux/x86/libPlayerOneCamera.so.3.7 (100%) rename cameras/{poalibs => playerone}/linux/x86/libPlayerOneCamera.so.3.7.1 (100%) mode change 100644 => 100755 rename cameras/{poalibs/mac/libPlayerOneCamera.3.7.1.dylib => playerone/mac/libPlayerOneCamera.dylib} (100%) mode change 100644 => 100755 rename {WinLibs => cameras/playerone/win}/PlayerOneCamera.dll (99%) mode change 100644 => 100755 create mode 100644 cameras/playerone/win/PlayerOneCamera.lib delete mode 120000 cameras/poalibs/mac/libPlayerOneCamera.3.7.dylib delete mode 120000 cameras/poalibs/mac/libPlayerOneCamera.3.dylib delete mode 120000 cameras/poalibs/mac/libPlayerOneCamera.dylib rename src/{cam_poa.cpp => cam_playerone.cpp} (85%) create mode 100644 src/cam_playerone.h delete mode 100644 src/cam_poa.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 67595f64..a7390f2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,8 +200,8 @@ set(cam_SRC ${phd_src_dir}/cam_openssag.h ${phd_src_dir}/cam_OSPL130.cpp ${phd_src_dir}/cam_OSPL130.h - ${phd_src_dir}/cam_poa.cpp - ${phd_src_dir}/cam_poa.h + ${phd_src_dir}/cam_playerone.cpp + ${phd_src_dir}/cam_playerone.h ${phd_src_dir}/cam_qguide.cpp ${phd_src_dir}/cam_qguide.h ${phd_src_dir}/cam_qhy.cpp @@ -725,6 +725,20 @@ if(APPLE) ) endif() + if(playerone) + set_source_files_properties(${playerone} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks) + add_custom_command( + TARGET phd2 + POST_BUILD + COMMAND install_name_tool -change libPlayerOneCamera.3.dylib + @executable_path/../Frameworks/libPlayerOneCamera.dylib $ + COMMAND install_name_tool -change @loader_path/libusb-1.0.0.dylib + @executable_path/../Frameworks/libusb_openphd.dylib + $/../Frameworks/libPlayerOneCamera.dylib + COMMENT "Updating dylib path for libPlayerOneCamera.dylib" + ) + endif() + add_custom_command( TARGET phd2 POST_BUILD diff --git a/build/unpack_playerone_sdk b/build/unpack_playerone_sdk new file mode 100755 index 00000000..f5ba84e3 --- /dev/null +++ b/build/unpack_playerone_sdk @@ -0,0 +1,72 @@ +#!/usr/bin/env bash + +# usage: unpack_playerone_sdk \ +# PlayerOne_Camera_SDK_MacOS_V3.6.3.tar.gz \ +# PlayerOne_Camera_SDK_Windows_V3.6.3.zip \ +# PlayerOne_Camera_SDK_Linux_V3.6.3.tar.gz + +die () { + echo "Error: $*" >&2 + exit 1 +} + +# === main === + +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) +SCRIPT_NAME=${BASH_SOURCE[0]##*/} + +set -x +set -e +set -o pipefail + +linux= +mac= +win= + +for file in "$@"; do + case $file in + *PlayerOne*_Linux_*) linux=$file ;; + *PlayerOne*_MacOS_*) mac=$file ;; + *PlayerOne*_Windows_*) win=$file ;; + esac +done + +if [[ ! -f $linux || ! -f $mac || ! -f $win ]]; then + echo "usage: $SCRIPT_NAME LINUX_SDK MAC_SDK WINDOWS_SDK" >&2 + exit 1 +fi + +top=$(cd "$SCRIPT_DIR" && git rev-parse --show-toplevel) +dest=$top/cameras/playerone + +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT + +# linux + include +tar xf "$linux" -C "$TMP" +( + cd "$TMP"/*_Linux_* + install -d -m 0755 "$dest"/include/ "$dest"/linux + install -m 0644 include/PlayerOneCamera.h "$dest"/include/ + cd lib + # include shared lib symlinks + tar cf - . | tar xf - -C "$dest"/linux +) + +# mac +tar xf "$mac" -C "$TMP" +( + cd "$TMP"/*_MacOS_* + install -d -m 0755 "$dest"/mac + install -m 0755 lib/libPlayerOneCamera.dylib "$dest"/mac/ +) + +# windows +mkdir "$TMP/win" +unzip -d "$TMP/win" "$win" +( + cd "$TMP"/win + install -d -m 0755 "$dest"/win + install -m 0644 lib/x86/PlayerOneCamera.lib "$dest"/win/ + install -m 0755 lib/x86/PlayerOneCamera.dll "$dest"/win/ +) diff --git a/cameras/PlayerOneCamera.lib b/cameras/PlayerOneCamera.lib deleted file mode 100644 index 44609d497daed26975f238e78f788f2fe2836e4e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13960 zcmcgy&2Jn<7Jp7)lQkijBtXcQ#~+F9*zxyFVrjLC?a9X|jy=jaEC&>461SZJ&-AEg ztc~};UN~@wxFR7AoRKzv0f(%FIG{a5NQ<h5|~UEOg@XrNcRQ2vZ_;dF}PJgB@PG6cSTrA}0bpB-UIXyR5kU#Hs6Ol`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mz1OJ z>w%CDe>c!!ekevoj^^CX{HtG9>g?h kJK&5$)^2$_(c-l8{cMP<-63}bHN{8eBUE-nZ3FH8Kl9Z)?*IS* diff --git a/cameras/PlayerOneCamera.h b/cameras/playerone/include/PlayerOneCamera.h similarity index 100% rename from cameras/PlayerOneCamera.h rename to cameras/playerone/include/PlayerOneCamera.h diff --git a/cameras/poalibs/linux/arm32/libPlayerOneCamera.so b/cameras/playerone/linux/arm32/libPlayerOneCamera.so similarity index 100% rename from cameras/poalibs/linux/arm32/libPlayerOneCamera.so rename to cameras/playerone/linux/arm32/libPlayerOneCamera.so diff --git a/cameras/poalibs/linux/arm32/libPlayerOneCamera.so.3 b/cameras/playerone/linux/arm32/libPlayerOneCamera.so.3 similarity index 100% rename from cameras/poalibs/linux/arm32/libPlayerOneCamera.so.3 rename to cameras/playerone/linux/arm32/libPlayerOneCamera.so.3 diff --git a/cameras/poalibs/linux/arm32/libPlayerOneCamera.so.3.7 b/cameras/playerone/linux/arm32/libPlayerOneCamera.so.3.7 similarity index 100% rename from cameras/poalibs/linux/arm32/libPlayerOneCamera.so.3.7 rename to cameras/playerone/linux/arm32/libPlayerOneCamera.so.3.7 diff --git a/cameras/poalibs/linux/arm32/libPlayerOneCamera.so.3.7.1 b/cameras/playerone/linux/arm32/libPlayerOneCamera.so.3.7.1 old mode 100644 new mode 100755 similarity index 100% rename from cameras/poalibs/linux/arm32/libPlayerOneCamera.so.3.7.1 rename to cameras/playerone/linux/arm32/libPlayerOneCamera.so.3.7.1 diff --git a/cameras/poalibs/linux/arm64/libPlayerOneCamera.so b/cameras/playerone/linux/arm64/libPlayerOneCamera.so similarity index 100% rename from cameras/poalibs/linux/arm64/libPlayerOneCamera.so rename to cameras/playerone/linux/arm64/libPlayerOneCamera.so diff --git a/cameras/poalibs/linux/arm64/libPlayerOneCamera.so.3 b/cameras/playerone/linux/arm64/libPlayerOneCamera.so.3 similarity index 100% rename from cameras/poalibs/linux/arm64/libPlayerOneCamera.so.3 rename to cameras/playerone/linux/arm64/libPlayerOneCamera.so.3 diff --git a/cameras/poalibs/linux/arm64/libPlayerOneCamera.so.3.7 b/cameras/playerone/linux/arm64/libPlayerOneCamera.so.3.7 similarity index 100% rename from cameras/poalibs/linux/arm64/libPlayerOneCamera.so.3.7 rename to cameras/playerone/linux/arm64/libPlayerOneCamera.so.3.7 diff --git a/cameras/poalibs/linux/arm64/libPlayerOneCamera.so.3.7.1 b/cameras/playerone/linux/arm64/libPlayerOneCamera.so.3.7.1 old mode 100644 new mode 100755 similarity index 100% rename from cameras/poalibs/linux/arm64/libPlayerOneCamera.so.3.7.1 rename to cameras/playerone/linux/arm64/libPlayerOneCamera.so.3.7.1 diff --git a/cameras/poalibs/linux/x64/libPlayerOneCamera.so b/cameras/playerone/linux/x64/libPlayerOneCamera.so similarity index 100% rename from cameras/poalibs/linux/x64/libPlayerOneCamera.so rename to cameras/playerone/linux/x64/libPlayerOneCamera.so diff --git a/cameras/poalibs/linux/x64/libPlayerOneCamera.so.3 b/cameras/playerone/linux/x64/libPlayerOneCamera.so.3 similarity index 100% rename from cameras/poalibs/linux/x64/libPlayerOneCamera.so.3 rename to cameras/playerone/linux/x64/libPlayerOneCamera.so.3 diff --git a/cameras/poalibs/linux/x64/libPlayerOneCamera.so.3.7 b/cameras/playerone/linux/x64/libPlayerOneCamera.so.3.7 similarity index 100% rename from cameras/poalibs/linux/x64/libPlayerOneCamera.so.3.7 rename to cameras/playerone/linux/x64/libPlayerOneCamera.so.3.7 diff --git a/cameras/poalibs/linux/x64/libPlayerOneCamera.so.3.7.1 b/cameras/playerone/linux/x64/libPlayerOneCamera.so.3.7.1 old mode 100644 new mode 100755 similarity index 100% rename from cameras/poalibs/linux/x64/libPlayerOneCamera.so.3.7.1 rename to cameras/playerone/linux/x64/libPlayerOneCamera.so.3.7.1 diff --git a/cameras/poalibs/linux/x86/libPlayerOneCamera.so b/cameras/playerone/linux/x86/libPlayerOneCamera.so similarity index 100% rename from cameras/poalibs/linux/x86/libPlayerOneCamera.so rename to cameras/playerone/linux/x86/libPlayerOneCamera.so diff --git a/cameras/poalibs/linux/x86/libPlayerOneCamera.so.3 b/cameras/playerone/linux/x86/libPlayerOneCamera.so.3 similarity index 100% rename from cameras/poalibs/linux/x86/libPlayerOneCamera.so.3 rename to cameras/playerone/linux/x86/libPlayerOneCamera.so.3 diff --git a/cameras/poalibs/linux/x86/libPlayerOneCamera.so.3.7 b/cameras/playerone/linux/x86/libPlayerOneCamera.so.3.7 similarity index 100% rename from cameras/poalibs/linux/x86/libPlayerOneCamera.so.3.7 rename to cameras/playerone/linux/x86/libPlayerOneCamera.so.3.7 diff --git a/cameras/poalibs/linux/x86/libPlayerOneCamera.so.3.7.1 b/cameras/playerone/linux/x86/libPlayerOneCamera.so.3.7.1 old mode 100644 new mode 100755 similarity index 100% rename from cameras/poalibs/linux/x86/libPlayerOneCamera.so.3.7.1 rename to cameras/playerone/linux/x86/libPlayerOneCamera.so.3.7.1 diff --git a/cameras/poalibs/mac/libPlayerOneCamera.3.7.1.dylib b/cameras/playerone/mac/libPlayerOneCamera.dylib old mode 100644 new mode 100755 similarity index 100% rename from cameras/poalibs/mac/libPlayerOneCamera.3.7.1.dylib rename to cameras/playerone/mac/libPlayerOneCamera.dylib diff --git a/WinLibs/PlayerOneCamera.dll b/cameras/playerone/win/PlayerOneCamera.dll old mode 100644 new mode 100755 similarity index 99% rename from WinLibs/PlayerOneCamera.dll rename to cameras/playerone/win/PlayerOneCamera.dll index 30155e9651d597f008262d396056816d39652140..dc14e106f37c9dcffbc722e089dc258a25eda7db GIT binary patch delta 1487 zcmV;=1u*)^;UCE1AFv<+13WfJlOq950wDu~asjt;0RiuA0qKWgZvls5Zvuy6Zv%&7 zZv?kuZv~!J0Wr4$#RX%z13WfJw`YC^%~u0FHb}QO)&`%92>}2H00RI300Fn(Vh14s z0Wr4$WCw=<0Wr6UWe0*(6txBkDuzgg_YDCD0-%C6rZ9pwqL&}K2T~wWyJE(Ptn?N4 zbLbZ9uX-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>m_a-`rw#m8|$xN0KYnDe5)q$2uqVMW=& z@=`>JaUS=EycA!GW`5%7GkVO_R&rpI`^u1MOjnstCER-k1|mLGm9Q{65Wunc8*P*q zJ*Y9?%GHe?R#S-hSuSVZma`4B$M>p{Y2pjCX%eub(*&Z>7jszSG=O&8XhNiV=g?Se z_J(=tXXaxkwb1{WnSMXzpS#Kn)r4dJ{XpW}Fa3;Lh;eGu=mvq-g)EQ**Q2!+X(PCIiL4$)GC`d;w-*UAY$X9IKj@fXQ;%#h zW+o$XhJ2WYtDK`u@M%Z6FlTPHShR<9ba6^Efu?VB%xp$N5|~<>S%S(0p0>qBe`C{T z7ZR9=P-3y&BW4!(g@k$5t>eoBtO+)CpC@^c7a6WRADbXk_jJN2AJGxR^R;n`rNy3$ z!4}cmOYzw3Y@bOFBVcxrta;eJ*zjwWjPxYZ0f#Fm|w?KRGtwsL8otVf*(5`V)KMkHn=hS zrHK4q4RM2vgb6flKPT;yuW6WWw#)>YX%D}yp?X=CY;Y4|f)g69o5aZkwK#2#M8+_# zZ|JCgjwl=Cn7u+oBPSWMo~bl}r=D3c(TIq3#r>vt55@AJ`;B^#|u&H~u7_)BhuRZv09J%+P zcTIOj+2F_Ywa9#&SMc>KDHD9^k&bD-$b4J~(ZdTb6KLu_Ps&@4hp5>`uL<+(qK5gr z;>ZaN_xZ$;lR9dqab(iiPKC(9RiKuwBi@*(Oz#574e;7o|D f-1278;-vHatdFbQA!mY`;G+rwD!ZXJfp-5Nl!q&p literal 0 HcmV?d00001 diff --git a/cameras/poalibs/mac/libPlayerOneCamera.3.7.dylib b/cameras/poalibs/mac/libPlayerOneCamera.3.7.dylib deleted file mode 120000 index c9376696..00000000 --- a/cameras/poalibs/mac/libPlayerOneCamera.3.7.dylib +++ /dev/null @@ -1 +0,0 @@ -libPlayerOneCamera.3.7.1.dylib \ No newline at end of file diff --git a/cameras/poalibs/mac/libPlayerOneCamera.3.dylib b/cameras/poalibs/mac/libPlayerOneCamera.3.dylib deleted file mode 120000 index c9376696..00000000 --- a/cameras/poalibs/mac/libPlayerOneCamera.3.dylib +++ /dev/null @@ -1 +0,0 @@ -libPlayerOneCamera.3.7.1.dylib \ No newline at end of file diff --git a/cameras/poalibs/mac/libPlayerOneCamera.dylib b/cameras/poalibs/mac/libPlayerOneCamera.dylib deleted file mode 120000 index c9376696..00000000 --- a/cameras/poalibs/mac/libPlayerOneCamera.dylib +++ /dev/null @@ -1 +0,0 @@ -libPlayerOneCamera.3.7.1.dylib \ No newline at end of file diff --git a/src/cam_poa.cpp b/src/cam_playerone.cpp similarity index 85% rename from src/cam_poa.cpp rename to src/cam_playerone.cpp index 85e34bcd..16142b56 100644 --- a/src/cam_poa.cpp +++ b/src/cam_playerone.cpp @@ -1,53 +1,53 @@ /* -* cam_poa.cpp -* PHD Guiding -* -* Created by Ethan Chappel based on cam_zwo.cpp -* Copyright (c) 2024 PHD2 Developers -* All rights reserved. -* -* This source code is distributed under the following "BSD" license -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* Neither the name of openphdguiding.org nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -* -*/ + * cam_playerone.cpp - Player One Astronomy (POA) camera support + * PHD Guiding + * + * Created by Ethan Chappel based on cam_zwo.cpp + * Copyright (c) 2024 PHD2 Developers + * All rights reserved. + * + * This source code is distributed under the following "BSD" license + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of openphdguiding.org nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ #include "phd.h" -#ifdef POA_CAMERA +#ifdef PLAYERONE_CAMERA -#include "cam_poa.h" -#include "cameras/PlayerOneCamera.h" +# include "cam_playerone.h" +# include "PlayerOneCamera.h" -#ifdef __WINDOWS__ +# ifdef __WINDOWS__ -#ifdef OS_WINDOWS +# ifdef OS_WINDOWS // troubleshooting with the libusb definitions -# undef OS_WINDOWS -#endif +# undef OS_WINDOWS +# endif -# include -# include -#endif +# include +# include +# endif enum CaptureMode { @@ -55,14 +55,14 @@ enum CaptureMode CM_VIDEO, }; -class CameraPOA : public GuideCamera +class POACamera : public GuideCamera { wxRect m_maxSize; wxRect m_frame; unsigned short m_prevBinning; void *m_buffer; size_t m_buffer_size; - wxByte m_bpp; // bits per pixel: 8 or 16 + wxByte m_bpp; // bits per pixel: 8 or 16 CaptureMode m_mode; bool m_capturing; int m_cameraId; @@ -73,8 +73,8 @@ class CameraPOA : public GuideCamera double m_devicePixelSize; public: - CameraPOA(); - ~CameraPOA(); + POACamera(); + ~POACamera(); bool CanSelectCamera() const override { return true; } bool EnumCameras(wxArrayString& names, wxArrayString& ids) override; @@ -110,35 +110,34 @@ class CameraPOA : public GuideCamera POAErrors SetConfig(int nCameraID, POAConfig confID, POABool isEnable); }; -CameraPOA::CameraPOA() : m_buffer(nullptr) +POACamera::POACamera() : m_buffer(nullptr) { Name = _T("Player One Camera"); PropertyDialogType = PROPDLG_WHEN_DISCONNECTED; Connected = false; m_hasGuideOutput = true; HasSubframes = true; - HasGainControl = true; // workaround: ok to set to false later, but brain dialog will crash if we start false then change to true later when the camera is connected + HasGainControl = true; // workaround: ok to set to false later, but brain dialog will crash if we start false then change to + // true later when the camera is connected m_defaultGainPct = GuideCamera::GetDefaultCameraGain(); int value = pConfig->Profile.GetInt("/camera/POA/bpp", 8); m_bpp = value == 8 ? 8 : 16; } -CameraPOA::~CameraPOA() +POACamera::~POACamera() { ::free(m_buffer); } -wxByte CameraPOA::BitsPerPixel() +wxByte POACamera::BitsPerPixel() { return m_bpp; } -inline wxSize CameraPOA::BinnedFrameSize(unsigned int binning) +inline wxSize POACamera::BinnedFrameSize(unsigned int binning) { // Player One cameras require width % 4 == 0 and height % 2 == 0 - return wxSize( - (m_maxSize.x / binning) & ~(4U - 1), - (m_maxSize.y / binning) & ~(2U - 1)); + return wxSize((m_maxSize.x / binning) & ~(4U - 1), (m_maxSize.y / binning) & ~(2U - 1)); } struct POACameraDlg : public wxDialog @@ -148,8 +147,7 @@ struct POACameraDlg : public wxDialog POACameraDlg(); }; -POACameraDlg::POACameraDlg() - : wxDialog(wxGetApp().GetTopWindow(), wxID_ANY, _("Player One Camera Properties")) +POACameraDlg::POACameraDlg() : wxDialog(wxGetApp().GetTopWindow(), wxID_ANY, _("Player One Camera Properties")) { SetSizeHints(wxDefaultSize, wxDefaultSize); @@ -164,7 +162,7 @@ POACameraDlg::POACameraDlg() wxStdDialogButtonSizer *sdbSizer2 = new wxStdDialogButtonSizer(); wxButton *sdbSizer2OK = new wxButton(this, wxID_OK); - wxButton* sdbSizer2Cancel = new wxButton(this, wxID_CANCEL); + wxButton *sdbSizer2Cancel = new wxButton(this, wxID_CANCEL); sdbSizer2->AddButton(sdbSizer2OK); sdbSizer2->AddButton(sdbSizer2Cancel); sdbSizer2->Realize(); @@ -177,7 +175,7 @@ POACameraDlg::POACameraDlg() Centre(wxBOTH); } -void CameraPOA::ShowPropertyDialog() +void POACamera::ShowPropertyDialog() { POACameraDlg dlg; int value = pConfig->Profile.GetInt("/camera/POA/bpp", m_bpp); @@ -202,14 +200,14 @@ inline static int gain_pct(int minval, int maxval, int val) return (val - minval) * 100 / (maxval - minval); } -#ifdef __WINDOWS__ +# ifdef __WINDOWS__ -#if !defined(FACILITY_VISUALCPP) -# define FACILITY_VISUALCPP ((LONG)0x6d) -#endif -#ifndef VcppException -# define VcppException(sev,err) ((sev) | ((FACILITY_VISUALCPP)<<16) | (err)) -#endif +# if !defined(FACILITY_VISUALCPP) +# define FACILITY_VISUALCPP ((LONG) 0x6d) +# endif +# ifndef VcppException +# define VcppException(sev, err) ((sev) | ((FACILITY_VISUALCPP) << 16) | (err)) +# endif static LONG WINAPI DelayLoadDllExceptionFilter(PEXCEPTION_POINTERS pExcPointers, wxString *err) { @@ -218,7 +216,8 @@ static LONG WINAPI DelayLoadDllExceptionFilter(PEXCEPTION_POINTERS pExcPointers, switch (pExcPointers->ExceptionRecord->ExceptionCode) { - case VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND): { + case VcppException(ERROR_SEVERITY_ERROR, ERROR_MOD_NOT_FOUND): + { *err = wxString::Format(_("Could not load DLL %s"), pdli->szDll); break; } @@ -241,23 +240,25 @@ static LONG WINAPI DelayLoadDllExceptionFilter(PEXCEPTION_POINTERS pExcPointers, static bool DoTryLoadDll(wxString *err) { - __try { + __try + { POAGetCameraCount(); return true; } - __except (DelayLoadDllExceptionFilter(GetExceptionInformation(), err)) { + __except (DelayLoadDllExceptionFilter(GetExceptionInformation(), err)) + { return false; } } -#else // __WINDOWS__ +# else // __WINDOWS__ static bool DoTryLoadDll(wxString *err) { return true; } -#endif // __WINDOWS__ +# endif // __WINDOWS__ static bool TryLoadDll(wxString *err) { @@ -275,7 +276,7 @@ static bool TryLoadDll(wxString *err) return true; } -bool CameraPOA::EnumCameras(wxArrayString& names, wxArrayString& ids) +bool POACamera::EnumCameras(wxArrayString& names, wxArrayString& ids) { wxString err; if (!TryLoadDll(&err)) @@ -386,7 +387,7 @@ static int FindCamera(const wxString& camId, wxString *err) return -1; } -bool CameraPOA::Connect(const wxString& camId) +bool POACamera::Connect(const wxString& camId) { wxString err; if (!TryLoadDll(&err)) @@ -530,7 +531,6 @@ bool CameraPOA::Connect(const wxString& camId) break; } } - } if (HasGainControl) @@ -569,7 +569,7 @@ bool CameraPOA::Connect(const wxString& camId) return false; } -void CameraPOA::StopCapture() +void POACamera::StopCapture() { if (m_capturing) { @@ -579,14 +579,14 @@ void CameraPOA::StopCapture() } } -bool CameraPOA::StopExposure() +bool POACamera::StopExposure() { Debug.Write("Player One: stopexposure\n"); POAStopExposure(m_cameraId); return true; } -bool CameraPOA::Disconnect() +bool POACamera::Disconnect() { StopCapture(); POACloseCamera(m_cameraId); @@ -599,7 +599,7 @@ bool CameraPOA::Disconnect() return false; } -bool CameraPOA::GetDevicePixelSize(double *devPixelSize) +bool POACamera::GetDevicePixelSize(double *devPixelSize) { if (!Connected) return true; @@ -608,22 +608,22 @@ bool CameraPOA::GetDevicePixelSize(double *devPixelSize) return false; } -int CameraPOA::GetDefaultCameraGain() +int POACamera::GetDefaultCameraGain() { return m_defaultGainPct; } -bool CameraPOA::SetCoolerOn(bool on) +bool POACamera::SetCoolerOn(bool on) { - return (SetConfig(m_cameraId, POA_COOLER, on ? (long)1 : (long)0, POA_FALSE) != POA_OK); + return SetConfig(m_cameraId, POA_COOLER, on ? (long) 1 : (long) 0, POA_FALSE) != POA_OK; } -bool CameraPOA::SetCoolerSetpoint(double temperature) +bool POACamera::SetCoolerSetpoint(double temperature) { - return (SetConfig(m_cameraId, POA_TARGET_TEMP, temperature, POA_FALSE) != POA_OK); + return SetConfig(m_cameraId, POA_TARGET_TEMP, temperature, POA_FALSE) != POA_OK; } -bool CameraPOA::GetCoolerStatus(bool *on, double *setpoint, double *power, double *temperature) +bool POACamera::GetCoolerStatus(bool *on, double *setpoint, double *power, double *temperature) { POAErrors r; long value; @@ -660,7 +660,7 @@ bool CameraPOA::GetCoolerStatus(bool *on, double *setpoint, double *power, doubl return false; } -bool CameraPOA::GetSensorTemperature(double *temperature) +bool POACamera::GetSensorTemperature(double *temperature) { POAErrors r; long value; @@ -688,7 +688,10 @@ inline static int round_up(int v, int m) static void flush_buffered_image(int cameraId, void *buf, size_t size) { - enum { NUM_IMAGE_BUFFERS = 2 }; // camera has 2 internal frame buffers + enum + { + NUM_IMAGE_BUFFERS = 2 + }; // camera has 2 internal frame buffers // clear buffered frames if any @@ -702,7 +705,7 @@ static void flush_buffered_image(int cameraId, void *buf, size_t size) } } -bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& subframe) +bool POACamera::Capture(int duration, usImage& img, int options, const wxRect& subframe) { bool binning_change = false; if (Binning != m_prevBinning) @@ -746,8 +749,7 @@ bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& s long exposureUS = duration * 1000; POABool tmp; long cur_exp; - if (GetConfig(m_cameraId, POA_EXPOSURE, &cur_exp, &tmp) == POA_OK && - cur_exp != exposureUS) + if (GetConfig(m_cameraId, POA_EXPOSURE, &cur_exp, &tmp) == POA_OK && cur_exp != exposureUS) { Debug.Write(wxString::Format("Player One: set CONTROL_EXPOSURE %d\n", exposureUS)); SetConfig(m_cameraId, POA_EXPOSURE, exposureUS, POA_FALSE); @@ -755,8 +757,7 @@ bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& s long new_gain = cam_gain(m_minGain, m_maxGain, GuideCameraGain); long cur_gain; - if (GetConfig(m_cameraId, POA_GAIN, &cur_gain, &tmp) == POA_OK && - new_gain != cur_gain) + if (GetConfig(m_cameraId, POA_GAIN, &cur_gain, &tmp) == POA_OK && new_gain != cur_gain) { Debug.Write(wxString::Format("Player One: set CONTROL_GAIN %d%% %d\n", GuideCameraGain, new_gain)); SetConfig(m_cameraId, POA_GAIN, new_gain, POA_FALSE); @@ -768,7 +769,8 @@ bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& s if (size_change || pos_change) { m_frame = frame; - Debug.Write(wxString::Format("Player One: frame (%d,%d)+(%d,%d)\n", m_frame.x, m_frame.y, m_frame.width, m_frame.height)); + Debug.Write( + wxString::Format("Player One: frame (%d,%d)+(%d,%d)\n", m_frame.x, m_frame.y, m_frame.width, m_frame.height)); } if (size_change || binning_change) @@ -781,7 +783,8 @@ bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& s status = POASetImageSize(m_cameraId, frame.GetWidth(), frame.GetHeight()); if (status != POA_OK) - Debug.Write(wxString::Format("Player One: setImageSize(%d,%d) => %d\n", frame.GetWidth(), frame.GetHeight(), status)); + Debug.Write( + wxString::Format("Player One: setImageSize(%d,%d) => %d\n", frame.GetWidth(), frame.GetHeight(), status)); } if (pos_change) @@ -793,8 +796,7 @@ bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& s int poll = wxMin(duration, 100); - unsigned char *const buffer = - m_bpp == 16 && !useSubframe ? (unsigned char *) img.ImageData : (unsigned char *) m_buffer; + unsigned char *const buffer = m_bpp == 16 && !useSubframe ? (unsigned char *) img.ImageData : (unsigned char *) m_buffer; if (m_mode == CM_VIDEO) { @@ -845,7 +847,8 @@ bool CameraPOA::Capture(int duration, usImage& img, int options, const wxRect& s POAStartExposure(m_cameraId, POA_TRUE); - CameraWatchdog watchdog(duration, duration + GetTimeoutMs() + 10000); // total timeout is 2 * duration + 15s (typically) + CameraWatchdog watchdog(duration, + duration + GetTimeoutMs() + 10000); // total timeout is 2 * duration + 15s (typically) if (duration > 100) { @@ -976,7 +979,7 @@ inline static POAConfig GetPOADirection(int direction) } } -bool CameraPOA::ST4PulseGuideScope(int direction, int duration) +bool POACamera::ST4PulseGuideScope(int direction, int duration) { POAConfig d = GetPOADirection(direction); SetConfig(m_cameraId, d, POA_TRUE); @@ -986,7 +989,7 @@ bool CameraPOA::ST4PulseGuideScope(int direction, int duration) return false; } -void CameraPOA::ClearGuidePort() +void POACamera::ClearGuidePort() { SetConfig(m_cameraId, POA_GUIDE_NORTH, POA_FALSE); SetConfig(m_cameraId, POA_GUIDE_SOUTH, POA_FALSE); @@ -994,11 +997,10 @@ void CameraPOA::ClearGuidePort() 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 -POAErrors CameraPOA::GetConfig(int nCameraID, POAConfig confID, long *pValue, POABool *pIsAuto) +POAErrors POACamera::GetConfig(int nCameraID, POAConfig confID, long *pValue, POABool *pIsAuto) { POAValueType pConfValueType; POAErrors error = POAGetConfigValueType(confID, &pConfValueType); @@ -1026,7 +1028,7 @@ POAErrors CameraPOA::GetConfig(int nCameraID, POAConfig confID, long *pValue, PO } // Get the current value of POAConfig with POAValueType is VAL_FLOAT, eg: POA_TEMPERATURE, POA_EGAIN -POAErrors CameraPOA::GetConfig(int nCameraID, POAConfig confID, double *pValue, POABool *pIsAuto) +POAErrors POACamera::GetConfig(int nCameraID, POAConfig confID, double *pValue, POABool *pIsAuto) { POAValueType pConfValueType; POAErrors error = POAGetConfigValueType(confID, &pConfValueType); @@ -1054,7 +1056,7 @@ POAErrors CameraPOA::GetConfig(int nCameraID, POAConfig confID, double *pValue, } // Get the current value of POAConfig with POAValueType is VAL_BOOL, eg: POA_COOLER, POA_PIXEL_BIN_SUM -POAErrors CameraPOA::GetConfig(int nCameraID, POAConfig confID, POABool *pIsEnable) +POAErrors POACamera::GetConfig(int nCameraID, POAConfig confID, POABool *pIsEnable) { POAValueType pConfValueType; POAErrors error = POAGetConfigValueType(confID, &pConfValueType); @@ -1083,7 +1085,7 @@ POAErrors CameraPOA::GetConfig(int nCameraID, POAConfig confID, POABool *pIsEnab } // Set the POAConfig value, the POAValueType of POAConfig is VAL_INT, eg: POA_TARGET_TEMP, POA_OFFSET -POAErrors CameraPOA::SetConfig(int nCameraID, POAConfig confID, long nValue, POABool isAuto) +POAErrors POACamera::SetConfig(int nCameraID, POAConfig confID, long nValue, POABool isAuto) { POAValueType pConfValueType; POAErrors error = POAGetConfigValueType(confID, &pConfValueType); @@ -1107,7 +1109,7 @@ POAErrors CameraPOA::SetConfig(int nCameraID, POAConfig confID, long nValue, POA // Set the POAConfig value, the POAValueType of POAConfig is VAL_FLOAT, Note: currently, there is no POAConfig which // POAValueType is VAL_FLOAT needs to be set -POAErrors CameraPOA::SetConfig(int nCameraID, POAConfig confID, double fValue, POABool isAuto) +POAErrors POACamera::SetConfig(int nCameraID, POAConfig confID, double fValue, POABool isAuto) { POAValueType pConfValueType; POAErrors error = POAGetConfigValueType(confID, &pConfValueType); @@ -1130,7 +1132,7 @@ POAErrors CameraPOA::SetConfig(int nCameraID, POAConfig confID, double fValue, P } // Set the POAConfig value, the POAValueType of POAConfig is VAL_BOOL, eg: POA_HARDWARE_BIN, POA_GUIDE_NORTH -POAErrors CameraPOA::SetConfig(int nCameraID, POAConfig confID, POABool isEnable) +POAErrors POACamera::SetConfig(int nCameraID, POAConfig confID, POABool isEnable) { POAValueType pConfValueType; POAErrors error = POAGetConfigValueType(confID, &pConfValueType); @@ -1152,9 +1154,9 @@ POAErrors CameraPOA::SetConfig(int nCameraID, POAConfig confID, POABool isEnable return POASetConfig(nCameraID, confID, confValue, POA_FALSE); } -GuideCamera *POACameraFactory::MakePOACamera() +GuideCamera *PlayerOneCameraFactory::MakePlayerOneCamera() { - return new CameraPOA(); + return new POACamera(); } -#endif // POA_CAMERA +#endif // CAMERA_PLAYERONE diff --git a/src/cam_playerone.h b/src/cam_playerone.h new file mode 100644 index 00000000..a81b49ee --- /dev/null +++ b/src/cam_playerone.h @@ -0,0 +1,45 @@ +/* + * cam_playerone.h + * PHD Guiding + * + * Created by Ethan Chappel based on cam_zwo.h + * Copyright (c) 2024 PHD2 Developers + * All rights reserved. + * + * This source code is distributed under the following "BSD" license + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of openphdguiding.org nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef CAM_PLAYERONE_INCLUDED +#define CAM_PLAYERONE_INCLUDED + +class GuideCamera; + +class PlayerOneCameraFactory +{ +public: + static GuideCamera *MakePlayerOneCamera(); +}; + +#endif diff --git a/src/cam_poa.h b/src/cam_poa.h deleted file mode 100644 index 4a4c4b23..00000000 --- a/src/cam_poa.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -* cam_poa.h -* PHD Guiding -* -* Created by Ethan Chappel based on cam_zwo.h -* Copyright (c) 2024 PHD2 Developers -* All rights reserved. -* -* This source code is distributed under the following "BSD" license -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, -* this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* Neither the name of openphdguiding.org nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -* POSSIBILITY OF SUCH DAMAGE. -* -*/ -#ifndef CAM_POA_H_INCLUDED -#define CAM_POA_H_INCLUDED - -class GuideCamera; - -class POACameraFactory -{ -public: - static GuideCamera *MakePOACamera(); -}; - -#endif diff --git a/src/camera.cpp b/src/camera.cpp index db90a7da..cef67d45 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -78,6 +78,10 @@ wxSize UNDEFINED_FRAME_SIZE = wxSize(0, 0); # include "cam_qhy5.h" #endif +#if defined(PLAYERONE_CAMERA) +# include "cam_playerone.h" +#endif + #if defined(QHY_CAMERA) # include "cam_qhy.h" #endif @@ -90,10 +94,6 @@ wxSize UNDEFINED_FRAME_SIZE = wxSize(0, 0); # include "cam_zwo.h" #endif -#if defined(POA_CAMERA) -# include "cam_poa.h" -#endif - #if defined(TOUPTEK_CAMERA) # include "cam_touptek.h" #endif @@ -306,6 +306,9 @@ wxArrayString GuideCamera::GuideCameraList() #if defined(MORAVIAN_CAMERA) CameraList.Add(_T("Moravian Camera")); #endif +#if defined(PLAYERONE_CAMERA) + CameraList.Add(_T("Player One Camera")); +#endif #if defined(CAM_QHY5) CameraList.Add(_T("QHY 5")); #endif @@ -319,9 +322,6 @@ wxArrayString GuideCamera::GuideCameraList() #if defined(ZWO_ASI) CameraList.Add(_T("ZWO ASI Camera")); #endif -#if defined(POA_CAMERA) - CameraList.Add(_T("Player One Camera")); -#endif #if defined(TOUPTEK_CAMERA) CameraList.Add(_T("ToupTek Camera")); CameraList.Add(_T("Omegon Pro Camera")); @@ -454,6 +454,10 @@ GuideCamera *GuideCamera::Factory(const wxString& choice) pReturn->Name = _T("MagZero MZ-5"); } #endif +#if defined(PLAYERONE_CAMERA) + else if (choice == _T("Player One Camera")) + pReturn = PlayerOneCameraFactory::MakePlayerOneCamera(); +#endif #if defined(QHY_CAMERA) else if (choice == _T("QHY Camera")) pReturn = QHYCameraFactory::MakeQHYCamera(); @@ -468,10 +472,6 @@ GuideCamera *GuideCamera::Factory(const wxString& choice) else if (choice == _T("ZWO ASI Camera")) pReturn = ZWOCameraFactory::MakeZWOCamera(); #endif -#if defined(POA_CAMERA) - else if (choice == _T("Player One Camera")) - pReturn = POACameraFactory::MakePOACamera(); -#endif #if defined(TOUPTEK_CAMERA) else if (choice == _T("ToupTek Camera") || choice == _T("Omegon Pro Camera")) { diff --git a/src/cameras.h b/src/cameras.h index 103fcf9e..d8496164 100644 --- a/src/cameras.h +++ b/src/cameras.h @@ -56,7 +56,7 @@ # define OGMA_CAMERA # define OPENCV_CAMERA # define ORION_DSCI -# define POA_CAMERA +# define PLAYERONE_CAMERA # define QGUIDE # define QHY_CAMERA # define SBIG @@ -91,6 +91,9 @@ # ifdef HAVE_OPENSSAG_CAMERA # define OPENSSAG_CAMERA # endif +# ifdef HAVE_PLAYERONE_CAMERA +# define PLAYERONE_CAMERA +# endif # ifdef HAVE_QHY_CAMERA # define QHY_CAMERA # endif @@ -107,9 +110,6 @@ # ifdef HAVE_ZWO_CAMERA # define ZWO_ASI # endif -# ifdef HAVE_POA_CAMERA -# define POA_CAMERA -# endif # ifdef HAVE_SVB_CAMERA # define SVB_CAMERA # endif @@ -122,6 +122,9 @@ # ifdef HAVE_OGMA_CAMERA # define OGMA_CAMERA # endif +# ifdef HAVE_PLAYERONE_CAMERA +# define PLAYERONE_CAMERA +# endif # ifdef HAVE_QHY_CAMERA # define QHY_CAMERA # endif @@ -129,9 +132,6 @@ # ifdef HAVE_ZWO_CAMERA # define ZWO_ASI # endif -# ifdef HAVE_POA_CAMERA -# define POA_CAMERA -# endif # ifdef HAVE_TOUPTEK_CAMERA # define TOUPTEK_CAMERA # endif diff --git a/thirdparty/thirdparty.cmake b/thirdparty/thirdparty.cmake index 130b9a5a..1d92ae2e 100644 --- a/thirdparty/thirdparty.cmake +++ b/thirdparty/thirdparty.cmake @@ -756,11 +756,6 @@ if(WIN32) set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${PHD_PROJECT_ROOT_DIR}/cameras/ASICamera2.lib) set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/WinLibs/ASICamera2.dll) - # Player One cameras - set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${PHD_PROJECT_ROOT_DIR}/cameras/PlayerOneCamera.lib) - set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/WinLibs/PlayerOneCamera.dll) - - # ToupTek cameras set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${PHD_PROJECT_ROOT_DIR}/cameras/toupcam.lib) set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/WinLibs/toupcam.dll) @@ -816,6 +811,11 @@ if(WIN32) set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/cameras/moravian/win/lib/gXusb.dll) include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/moravian/include) + # Player One cameras + set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${PHD_PROJECT_ROOT_DIR}/cameras/playerone/win/PlayerOneCamera.lib) + set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/cameras/playerone/win/PlayerOneCamera.dll) + include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/playerone/include) + set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/WinLibs/msvcr120.dll) set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/WinLibs/msvcp140.dll) set(PHD_COPY_EXTERNAL_ALL ${PHD_COPY_EXTERNAL_ALL} ${PHD_PROJECT_ROOT_DIR}/WinLibs/vcomp140.dll) @@ -895,16 +895,6 @@ if(APPLE) set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${asiCamera2}) set(phd2_OSX_FRAMEWORKS ${phd2_OSX_FRAMEWORKS} ${asiCamera2}) - find_library( poaCamera - NAMES PlayerOneCamera - PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/poalibs/mac) - if(NOT poaCamera) - message(FATAL_ERROR "Cannot find the poaCamera drivers") - endif() - add_definitions(-DHAVE_POA_CAMERA=1) - set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${poaCamera}) - set(phd2_OSX_FRAMEWORKS ${phd2_OSX_FRAMEWORKS} ${poaCamera}) - find_library( SVBCameraSDK NAMES SVBCameraSDK PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/svblibs/mac/x64) @@ -973,6 +963,17 @@ if(APPLE) add_definitions(-DHAVE_OPENSSAG_CAMERA=1) set_property(TARGET OpenSSAG PROPERTY FOLDER "Thirdparty/") + find_library( playerone + NAMES PlayerOneCamera + PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/playerone/mac) + if(NOT playerone) + message(FATAL_ERROR "Cannot find the playerone SDK lib") + endif() + include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/playerone/include) + list(APPEND PHD_LINK_EXTERNAL ${playerone}) + add_definitions(-DHAVE_PLAYERONE_CAMERA=1) + list(APPEND phd2_OSX_FRAMEWORKS ${playerone}) + endif() # APPLE @@ -996,36 +997,36 @@ if(UNIX AND NOT APPLE) if (CMAKE_SYSTEM_PROCESSOR MATCHES "^armv6(.*)") set(zwoarch "armv6") set(qhyarch "arm32") - set(poaarch "arm32") set(toupcam_arch "armel") set(svbony_arch "armv6") + set(playerone_arch arm32) elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^armv7(.*)|arm64|aarch64|^armv8(.*)") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(zwoarch "armv8") set(qhyarch "arm64") - set(poaarch "arm64") set(toupcam_arch "arm64") set(svbony_arch "armv8") + set(playerone_arch arm64) else() set(zwoarch "armv7") - set(poaarch "arm32") set(qhyarch "arm32") set(toupcam_arch "armhf") set(svbony_arch "armv7") + set(playerone_arch arm32) endif() elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86|X86|amd64|AMD64|i.86") if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(zwoarch "x64") - set(poaarch "x64") set(qhyarch "x86_64") set(toupcam_arch "x64") set(svbony_arch "x64") + set(playerone_arch x64) else() set(zwoarch "x86") - set(poaarch "x86") set(qhyarch "x86_32") # no longer distributed by QHY set(toupcam_arch "x86") set(svbony_arch "x86") + set(playerone_arch x86) endif() else() message(FATAL_ERROR "unknown system architecture") @@ -1036,11 +1037,6 @@ if(UNIX AND NOT APPLE) PATHS ${PHD_PROJECT_ROOT_DIR}/cameras ) - find_path(POA_INCLUDE_DIR PlayerOneCamera.h - NO_DEFAULT_PATHS - PATHS ${PHD_PROJECT_ROOT_DIR}/cameras - ) - # The binary libraries below do not support FreeBSD, ignore them # when building for FreeBSD. if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") @@ -1056,18 +1052,6 @@ if(UNIX AND NOT APPLE) add_definitions(-DHAVE_ZWO_CAMERA=1) set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${asiCamera2}) - find_library(poaCamera - NAMES PlayerOneCamera - NO_DEFAULT_PATHS - PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/poalibs/linux/${poaarch}) - - if(NOT poaCamera) - message(FATAL_ERROR "Cannot find the poaCamera drivers") - endif() - message(STATUS "Found PlayerOneCamera lib ${poaCamera}") - add_definitions(-DHAVE_POA_CAMERA=1) - set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${poaCamera}) - find_library(toupcam NAMES toupcam NO_DEFAULT_PATHS @@ -1120,6 +1104,21 @@ if(UNIX AND NOT APPLE) endif() set(PHD_LINK_EXTERNAL ${PHD_LINK_EXTERNAL} ${qhylib}) endif() + + find_library( playerone + NAMES PlayerOneCamera + NO_DEFAULT_PATHS + PATHS ${PHD_PROJECT_ROOT_DIR}/cameras/playerone/linux/${playerone_arch}) + + if(NOT playerone) + message(FATAL_ERROR "Cannot find the PlayerOneCamera SDK lib") + endif() + message(STATUS "Found PlayerOneCamera SDK lib ${playerone}") + include_directories(${PHD_PROJECT_ROOT_DIR}/cameras/playerone/include) + add_definitions(-DHAVE_PLAYERONE_CAMERA=1) + list(APPEND PHD_LINK_EXTERNAL ${playerone}) + list(APPEND PHD_INSTALL_LIBS ${playerone}) + endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") find_program(LSB_RELEASE_EXEC lsb_release)