| 1 | /* |
| 2 | Celestron GPS |
| 3 | Copyright (C) 2003-2017 Jasem Mutlaq ([email protected]) |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | |
| 19 | */ |
| 20 | |
| 21 | /* |
| 22 | Version with experimental pulse guide support. GC 04.12.2015 |
| 23 | */ |
| 24 | |
| 25 | #pragma once |
| 26 | |
| 27 | #include "celestrondriver.h"cxx . . $ `<file>/drivers/telescope/celestrondriver.h`/ |
| 28 | |
| 29 | #include "indiguiderinterface.h"cxx . . $ `<file>/libs/indibase/indiguiderinterface.h`/ |
| 30 | #include "inditelescope.h"cxx . . $ `<file>/libs/indibase/inditelescope.h`/ |
| 31 | #include "indifocuserinterface.h"cxx . . $ `<file>/libs/indibase/indifocuserinterface.h`/ |
| 32 | |
| 33 | class CelestronGPScxx . . $ CelestronGPS# : public INDIcxx . . $ INDI/::Telescopecxx . . $ INDI/Telescope#, public INDIcxx . . $ INDI/::GuiderInterfacecxx . . $ INDI/GuiderInterface#, public INDIcxx . . $ INDI/::FocuserInterfacecxx . . $ INDI/FocuserInterface# |
| 34 | { |
| 35 | public: |
| 36 | CelestronGPScxx . . $ CelestronGPS#CelestronGPS(49f6e7a06ebc5aa8).(); |
| 37 | |
| 38 | virtual const char *getDefaultNamecxx . . $ CelestronGPS#getDefaultName(33a1f659e94feb42).() override; |
| 39 | virtual bool Handshakecxx . . $ CelestronGPS#Handshake(c9857a73d68e59ba).() override; |
| 40 | virtual bool ReadScopeStatuscxx . . $ CelestronGPS#ReadScopeStatus(c9857a73d68e59ba).() override; |
| 41 | virtual void ISGetPropertiescxx . . $ CelestronGPS#ISGetProperties(85c52e162fed56f9).(const char *dev) override; |
| 42 | virtual bool ISNewNumbercxx . . $ CelestronGPS#ISNewNumber(b910d3521abb33fb).(const char *dev, const char *name, double values[], char *names[], int n) override; |
| 43 | virtual bool ISNewSwitchcxx . . $ CelestronGPS#ISNewSwitch(e439c05866add404).(const char *dev, const char *name, ISStatecxx . . $ ISState# *states, char *names[], int n) override; |
| 44 | virtual bool initPropertiescxx . . $ CelestronGPS#initProperties(c9857a73d68e59ba).() override; |
| 45 | virtual bool updatePropertiescxx . . $ CelestronGPS#updateProperties(c9857a73d68e59ba).() override; |
| 46 | |
| 47 | virtual bool ISNewTextcxx . . $ CelestronGPS#ISNewText(1f3dbebc116ed926).(const char *dev, const char *name, char **texts, char **names, int n) override; |
| 48 | |
| 49 | protected: |
| 50 | // Goto, Sync, and Motion |
| 51 | virtual bool Gotocxx . . $ CelestronGPS#Goto(828b76dce88fac).(double ra, double dec) override; |
| 52 | //bool GotoAzAlt(double az, double alt); |
| 53 | virtual bool Synccxx . . $ CelestronGPS#Sync(828b76dce88fac).(double ra, double dec) override; |
| 54 | virtual bool MoveNScxx . . $ CelestronGPS#MoveNS(ffb1bb92c4b05851).(INDI_DIR_NScxx . . $ INDI_DIR_NS# dir, TelescopeMotionCommandcxx . . $ INDI/Telescope#TelescopeMotionCommand# command) override; |
| 55 | virtual bool MoveWEcxx . . $ CelestronGPS#MoveWE(a98f225cdad633ca).(INDI_DIR_WEcxx . . $ INDI_DIR_WE# dir, TelescopeMotionCommandcxx . . $ INDI/Telescope#TelescopeMotionCommand# command) override; |
| 56 | virtual bool Abortcxx . . $ CelestronGPS#Abort(c9857a73d68e59ba).() override; |
| 57 | |
| 58 | // Time and Location |
| 59 | virtual bool updateLocationcxx . . $ CelestronGPS#updateLocation(c3c51e0645da350e).(double latitude, double longitude, double elevation) override; |
| 60 | virtual bool updateTimecxx . . $ CelestronGPS#updateTime(8f5ba5a5ba688cb1).(ln_datecxx . . $ ln_date# *utc, double utc_offset) override; |
| 61 | |
| 62 | //GUIDE: guiding functions |
| 63 | virtual IPStatecxx . . $ IPState# GuideNorthcxx . . $ CelestronGPS#GuideNorth(e933ec4323fbb8bc).(uint32_tcxx . . $ uint32_t# ms) override; |
| 64 | virtual IPStatecxx . . $ IPState# GuideSouthcxx . . $ CelestronGPS#GuideSouth(e933ec4323fbb8bc).(uint32_tcxx . . $ uint32_t# ms) override; |
| 65 | virtual IPStatecxx . . $ IPState# GuideEastcxx . . $ CelestronGPS#GuideEast(e933ec4323fbb8bc).(uint32_tcxx . . $ uint32_t# ms) override; |
| 66 | virtual IPStatecxx . . $ IPState# GuideWestcxx . . $ CelestronGPS#GuideWest(e933ec4323fbb8bc).(uint32_tcxx . . $ uint32_t# ms) override; |
| 67 | // these all call this function |
| 68 | IPStatecxx . . $ IPState# Guidecxx . . $ CelestronGPS#Guide(bd3d0ae75d019ce9).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# dirn, uint32_tcxx . . $ uint32_t# ms); |
| 69 | |
| 70 | // Guide Rate |
| 71 | INumbercxx . . $ INumber# GuideRateNcxx . . $ CelestronGPS#GuideRateN.[2]; // 0 to 1 corresponding to 0 to 1.0x sidereal |
| 72 | INumberVectorPropertycxx . . $ INumberVectorProperty# GuideRateNPcxx . . $ CelestronGPS#GuideRateNP.; |
| 73 | |
| 74 | uint8_tcxx . . $ uint8_t# guideRateRacxx . . $ CelestronGPS#guideRateRa.; // 0 to 255 corresponding to 0 to 100% sidereal |
| 75 | uint8_tcxx . . $ uint8_t# guideRateDeccxx . . $ CelestronGPS#guideRateDec.; |
| 76 | |
| 77 | //GUIDE guideTimerHelper() function |
| 78 | static void guideTimerHelperNcxx . . $ CelestronGPS#guideTimerHelperN(5d22bdacc48458e8).(void *p); |
| 79 | static void guideTimerHelperScxx . . $ CelestronGPS#guideTimerHelperS(5d22bdacc48458e8).(void *p); |
| 80 | static void guideTimerHelperWcxx . . $ CelestronGPS#guideTimerHelperW(5d22bdacc48458e8).(void *p); |
| 81 | static void guideTimerHelperEcxx . . $ CelestronGPS#guideTimerHelperE(5d22bdacc48458e8).(void *p); |
| 82 | // these all call this function |
| 83 | void guideTimercxx . . $ CelestronGPS#guideTimer(e0d9715742da9ab9).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# dirn); |
| 84 | |
| 85 | void AddGuideTimercxx . . $ CelestronGPS#AddGuideTimer(d4d0b1b6c97eba70).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# dirn, int ms); |
| 86 | |
| 87 | // Focus Backlash |
| 88 | virtual bool SetFocuserBacklashcxx . . $ CelestronGPS#SetFocuserBacklash(83c267b20bac841a).(int32_t steps) override; |
| 89 | |
| 90 | // Tracking |
| 91 | virtual bool SetTrackModecxx . . $ CelestronGPS#SetTrackMode(cef82f9be00a201a).(uint8_tcxx . . $ uint8_t# mode) override; |
| 92 | virtual bool SetTrackEnabledcxx . . $ CelestronGPS#SetTrackEnabled(efaadfb7dc14930a).(bool enabled) override; |
| 93 | |
| 94 | // Parking |
| 95 | virtual bool Parkcxx . . $ CelestronGPS#Park(c9857a73d68e59ba).() override; |
| 96 | virtual bool UnParkcxx . . $ CelestronGPS#UnPark(c9857a73d68e59ba).() override; |
| 97 | virtual bool SetCurrentParkcxx . . $ CelestronGPS#SetCurrentPark(c9857a73d68e59ba).() override; |
| 98 | virtual bool SetDefaultParkcxx . . $ CelestronGPS#SetDefaultPark(c9857a73d68e59ba).() override; |
| 99 | |
| 100 | virtual bool saveConfigItemscxx . . $ CelestronGPS#saveConfigItems(dc9e5a301483124c).(FILEcxx . . $ FILE# *fp) override; |
| 101 | |
| 102 | virtual void simulationTriggeredcxx . . $ CelestronGPS#simulationTriggered(b45ddcbc8423892c).(bool enable) override; |
| 103 | |
| 104 | void mountSimcxx . . $ CelestronGPS#mountSim(49f6e7a06ebc5aa8).(); |
| 105 | |
| 106 | //GUIDE variables. |
| 107 | int GuideNSTIDcxx . . $ CelestronGPS#GuideNSTID.; |
| 108 | int GuideWETIDcxx . . $ CelestronGPS#GuideWETID.; |
| 109 | int ticksNScxx . . $ CelestronGPS#ticksNS.; |
| 110 | int ticksWEcxx . . $ CelestronGPS#ticksWE.; |
| 111 | //CELESTRON_DIRECTION guide_direction; |
| 112 | |
| 113 | /* Firmware */ |
| 114 | ITextcxx . . $ IText# FirmwareTcxx . . $ CelestronGPS#FirmwareT.[7] {}; |
| 115 | ITextVectorPropertycxx . . $ ITextVectorProperty# FirmwareTPcxx . . $ CelestronGPS#FirmwareTP.; |
| 116 | |
| 117 | //INumberVectorProperty HorizontalCoordsNP; |
| 118 | //INumber HorizontalCoordsN[2]; |
| 119 | |
| 120 | //ISwitch TrackS[4]; |
| 121 | //ISwitchVectorProperty TrackSP; |
| 122 | |
| 123 | // Celestron Track Mode (AltAz, EQ N, EQ S, Ra and Dec) |
| 124 | ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# CelestronTrackModeSPcxx . . $ CelestronGPS#CelestronTrackModeSP.; |
| 125 | ISwitchcxx . . $ ISwitch# CelestronTrackModeScxx . . $ CelestronGPS#CelestronTrackModeS.[4]; |
| 126 | |
| 127 | //GUIDE Pulse guide switch |
| 128 | // ISwitchVectorProperty UsePulseCmdSP; |
| 129 | // ISwitch UsePulseCmdS[2]; |
| 130 | |
| 131 | ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# UseHibernateSPcxx . . $ CelestronGPS#UseHibernateSP.; |
| 132 | ISwitchcxx . . $ ISwitch# UseHibernateScxx . . $ CelestronGPS#UseHibernateS.[2]; |
| 133 | |
| 134 | // PEC - implemented without using the base definition because this doesn't match what is required |
| 135 | // shows status and index |
| 136 | ITextcxx . . $ IText# PecInfoTcxx . . $ CelestronGPS#PecInfoT.[2] {}; |
| 137 | ITextVectorPropertycxx . . $ ITextVectorProperty# PecInfoTPcxx . . $ CelestronGPS#PecInfoTP.; |
| 138 | |
| 139 | ISwitchcxx . . $ ISwitch# PecControlScxx . . $ CelestronGPS#PecControlS.[4]; // Find Index, Stop, Playback, Record |
| 140 | ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# PecControlSPcxx . . $ CelestronGPS#PecControlSP.; |
| 141 | enumcxx . . $ CelestronGPS#$anonymous_type_0# { PEC_Seekcxx . . $ CelestronGPS#PEC_Seek., PEC_Stopcxx . . $ CelestronGPS#PEC_Stop., PEC_Playbackcxx . . $ CelestronGPS#PEC_Playback., PEC_Recordcxx . . $ CelestronGPS#PEC_Record. } PecControlcxx . . $ CelestronGPS#PecControl.; |
| 142 | |
| 143 | // move PEC data from file to mount |
| 144 | ITextcxx . . $ IText# PecFileNameTcxx . . $ CelestronGPS#PecFileNameT.[1] {}; |
| 145 | ITextVectorPropertycxx . . $ ITextVectorProperty# PecFileNameTPcxx . . $ CelestronGPS#PecFileNameTP.; |
| 146 | |
| 147 | // FocuserInterface |
| 148 | |
| 149 | IPStatecxx . . $ IPState# MoveAbsFocusercxx . . $ CelestronGPS#MoveAbsFocuser(e933ec4323fbb8bc). (uint32_tcxx . . $ uint32_t# targetTicks) override; |
| 150 | IPStatecxx . . $ IPState# MoveRelFocusercxx . . $ CelestronGPS#MoveRelFocuser(7f9c1e68e57c0ac9). (FocusDirectioncxx . . $ INDI/FocuserInterface#FocusDirection# dir, uint32_tcxx . . $ uint32_t# ticks) override; |
| 151 | bool AbortFocusercxx . . $ CelestronGPS#AbortFocuser(c9857a73d68e59ba). () override; |
| 152 | |
| 153 | // End FocuserInterface |
| 154 | |
| 155 | private: |
| 156 | bool setCelestronTrackModecxx . . $ CelestronGPS#setCelestronTrackMode(ba63e92b759e4983).(CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# mode); |
| 157 | bool checkMinVersioncxx . . $ CelestronGPS#checkMinVersion(8a92b43cef2196a6).(double minVersion, const char *feature, bool debug = false); |
| 158 | void checkAlignmentcxx . . $ CelestronGPS#checkAlignment(49f6e7a06ebc5aa8).(); |
| 159 | |
| 160 | double currentRAcxx . . $ CelestronGPS#currentRA., currentDECcxx . . $ CelestronGPS#currentDEC., currentAZcxx . . $ CelestronGPS#currentAZ., currentALTcxx . . $ CelestronGPS#currentALT.; |
| 161 | double targetRAcxx . . $ CelestronGPS#targetRA., targetDECcxx . . $ CelestronGPS#targetDEC., targetAZcxx . . $ CelestronGPS#targetAZ., targetALTcxx . . $ CelestronGPS#targetALT.; |
| 162 | |
| 163 | CelestronDrivercxx . . $ CelestronDriver# drivercxx . . $ CelestronGPS#driver.; |
| 164 | FirmwareInfocxx . . $ FirmwareInfo# fwInfocxx . . $ CelestronGPS#fwInfo.; |
| 165 | |
| 166 | bool usePreciseCoordscxx . . $ CelestronGPS#usePreciseCoords. {false}; |
| 167 | // bool usePulseCommand { false }; |
| 168 | bool canAuxGuidecxx . . $ CelestronGPS#canAuxGuide. { false}; |
| 169 | |
| 170 | //CelestronGuide guider; |
| 171 | |
| 172 | // Last align property |
| 173 | ISwitchcxx . . $ ISwitch# LastAlignScxx . . $ CelestronGPS#LastAlignS.[1]; |
| 174 | ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# LastAlignSPcxx . . $ CelestronGPS#LastAlignSP.; |
| 175 | |
| 176 | // DST setting |
| 177 | ISwitchcxx . . $ ISwitch# DSTSettingScxx . . $ CelestronGPS#DSTSettingS.[1]; |
| 178 | ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# DSTSettingSPcxx . . $ CelestronGPS#DSTSettingSP.; |
| 179 | |
| 180 | bool slewToIndexcxx . . $ CelestronGPS#slewToIndex.; |
| 181 | |
| 182 | size_t numPecBinscxx . . $ CelestronGPS#numPecBins. = 0; |
| 183 | |
| 184 | bool savePecDatacxx . . $ CelestronGPS#savePecData(c9857a73d68e59ba).(); |
| 185 | |
| 186 | // Slew Offsets |
| 187 | double SlewOffsetRacxx . . $ CelestronGPS#SlewOffsetRa. = 0.0; |
| 188 | |
| 189 | // focuser |
| 190 | // INumber FocusBacklashN[1]; |
| 191 | // INumberVectorProperty FocusBacklashNP; |
| 192 | |
| 193 | INumbercxx . . $ INumber# FocusMinPosNcxx . . $ CelestronGPS#FocusMinPosN.[1]; |
| 194 | INumberVectorPropertycxx . . $ INumberVectorProperty# FocusMinPosNPcxx . . $ CelestronGPS#FocusMinPosNP.; |
| 195 | |
| 196 | bool focusBacklashMovecxx . . $ CelestronGPS#focusBacklashMove.; // set if a final move is needed |
| 197 | uint32_tcxx . . $ uint32_t# focusPositioncxx . . $ CelestronGPS#focusPosition.; |
| 198 | bool focusReadLimitscxx . . $ CelestronGPS#focusReadLimits(c9857a73d68e59ba).(); |
| 199 | bool focuserIsCalibratedcxx . . $ CelestronGPS#focuserIsCalibrated.; |
| 200 | }; |