| 1 | /* |
| 2 | Celestron driver |
| 3 | |
| 4 | Copyright (C) 2015 Jasem Mutlaq |
| 5 | Copyright (C) 2017 Juan Menendez |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation; either |
| 10 | version 2.1 of the License, or (at your option) any later version. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | Version with experimental pulse guide support. GC 04.12.2015 |
| 24 | */ |
| 25 | |
| 26 | #pragma once |
| 27 | |
| 28 | #include <string> |
| 29 | #include "indicom.h"cxx . . $ `<file>/libs/indicore/indicom.h`/ |
| 30 | |
| 31 | #include <stdint.h> |
| 32 | |
| 33 | //#include <thread> |
| 34 | //#include <condition_variable> |
| 35 | //#include <atomic> |
| 36 | |
| 37 | /* Starsense specific constants */ |
| 38 | #define ISNEXSTARcxx . . $ `drivers/telescope/celestrondriver.h:38:9`! 0x11 |
| 39 | #define ISSTARSENSEcxx . . $ `drivers/telescope/celestrondriver.h:39:9`! 0x13 |
| 40 | #define MINSTSENSVERcxx . . $ `drivers/telescope/celestrondriver.h:40:9`! 1.18 |
| 41 | #define MAX_RESP_SIZEcxx . . $ `drivers/telescope/celestrondriver.h:41:9`! 20 |
| 42 | |
| 43 | // device IDs |
| 44 | #define CELESTRON_DEV_RAcxx . . $ `drivers/telescope/celestrondriver.h:44:9`! 0x10 |
| 45 | #define CELESTRON_DEV_DECcxx . . $ `drivers/telescope/celestrondriver.h:45:9`! 0x11 |
| 46 | #define CELESTRON_DEV_GPScxx . . $ `drivers/telescope/celestrondriver.h:46:9`! 0xb0 |
| 47 | // focuser device |
| 48 | #define CELESTRON_DEV_FOCcxx . . $ `drivers/telescope/celestrondriver.h:48:9`! 0x12 |
| 49 | |
| 50 | // motor commands |
| 51 | #define MC_GET_POSITIONcxx . . $ `drivers/telescope/celestrondriver.h:51:9`! 0x01 // return 24 bit position |
| 52 | #define MC_GOTO_FASTcxx . . $ `drivers/telescope/celestrondriver.h:52:9`! 0x02 // send 24 bit target |
| 53 | #define MC_SET_POS_GUIDERATEcxx . . $ `drivers/telescope/celestrondriver.h:53:9`! 0x06 // use the 2 byte CelestronTrackRates to set the rate |
| 54 | #define MC_SET_NEG_GUIDERATEcxx . . $ `drivers/telescope/celestrondriver.h:54:9`! 0x07 // for Southern hemisphere, track mode EQ_S |
| 55 | #define MC_LEVEL_STARTcxx . . $ `drivers/telescope/celestrondriver.h:55:9`! 0x0b // move to switch position |
| 56 | #define MC_PEC_RECORD_STARTcxx . . $ `drivers/telescope/celestrondriver.h:56:9`! 0x0C // n/a Ack Start recording PEC position |
| 57 | #define MC_PEC_PLAYBACKcxx . . $ `drivers/telescope/celestrondriver.h:57:9`! 0x0D // 8 bits Ack Start(01)/stop(00) PEC playback |
| 58 | |
| 59 | #define MTR_PECBINcxx . . $ `drivers/telescope/celestrondriver.h:59:9`! 0x0E // current PEC index - 1 byte 0 - 255(88) |
| 60 | |
| 61 | #define MC_LEVEL_DONEcxx . . $ `drivers/telescope/celestrondriver.h:61:9`! 0x12 // return 0xFF when move finished |
| 62 | #define MC_SLEW_DONEcxx . . $ `drivers/telescope/celestrondriver.h:62:9`! 0x13 // return 0xFF when move finished |
| 63 | #define MC_PEC_RECORD_DONEcxx . . $ `drivers/telescope/celestrondriver.h:63:9`! 0x15 // n/a 8 bits != 0 is PEC record completed |
| 64 | #define MC_PEC_RECORD_STOPcxx . . $ `drivers/telescope/celestrondriver.h:64:9`! 0x16 // n/a n/a Stop PEC recording |
| 65 | |
| 66 | #define MC_GOTO_SLOWcxx . . $ `drivers/telescope/celestrondriver.h:66:9`! 0x17 // 16/24 bits Ack Goto position with slow, variable rate. Either 16 or 24 bit accuracy. |
| 67 | // Position is a signed fraction of a full rotation |
| 68 | #define MC_AT_INDEXcxx . . $ `drivers/telescope/celestrondriver.h:68:9`! 0x18 // n/a 8 bits FFH at index, 00H not |
| 69 | #define MC_SEEK_INDEXcxx . . $ `drivers/telescope/celestrondriver.h:69:9`! 0x19 // n/a n/a Seek PEC Index |
| 70 | #define MC_MOVE_POScxx . . $ `drivers/telescope/celestrondriver.h:70:9`! 0x24 // start move positive direction, rate 0-9, 0 is stop |
| 71 | #define MC_MOVE_NEGcxx . . $ `drivers/telescope/celestrondriver.h:71:9`! 0x25 // start move negative direction, rate 0-9, 0 is stop |
| 72 | |
| 73 | #define MTR_AUX_GUIDEcxx . . $ `drivers/telescope/celestrondriver.h:73:9`! 0x26 // aux guide command, rate -100 to 100, duration centiseconds |
| 74 | #define MTR_IS_AUX_GUIDE_ACTIVEcxx . . $ `drivers/telescope/celestrondriver.h:74:9`! 0x27 // return 0x00 when aux guide is not in progress |
| 75 | |
| 76 | // command 0x30 and 0x31 are read/ write memory commands |
| 77 | #define MC_PEC_READ_DATAcxx . . $ `drivers/telescope/celestrondriver.h:77:9`! 0x30 // 8 PEC data value return 1 byte of data: |
| 78 | // 0x3f number of PEC bins (88) |
| 79 | // 0x40+i PEC data for bin i |
| 80 | #define MC_PEC_WRITE_DATAcxx . . $ `drivers/telescope/celestrondriver.h:80:9`! 0x31 // 16 PEC data address, PEC data value |
| 81 | // 0x40+i, value bin i |
| 82 | |
| 83 | #define MC_SET_AUTOGUIDE_RATEcxx . . $ `drivers/telescope/celestrondriver.h:83:9`! 0x46 // 0 to 99 as % sidereal |
| 84 | #define MC_GET_AUTOGUIDE_RATEcxx . . $ `drivers/telescope/celestrondriver.h:84:9`! 0x47 // 0 to 99 as % sidereal |
| 85 | |
| 86 | // focuser passthrough commands |
| 87 | #define FOC_CALIB_ENABLEcxx . . $ `drivers/telescope/celestrondriver.h:87:9`! 42 // send 0 to start or 1 to stop |
| 88 | #define FOC_CALIB_DONEcxx . . $ `drivers/telescope/celestrondriver.h:88:9`! 43 // returns 2 bytes [0] done, [1] state 0-12 |
| 89 | #define FOC_GET_HS_POSITIONScxx . . $ `drivers/telescope/celestrondriver.h:89:9`! 44 // returns 2 ints, low and high limits |
| 90 | |
| 91 | // generic device commands |
| 92 | #define GET_VERcxx . . $ `drivers/telescope/celestrondriver.h:92:9`! 0xfe // return 2 or 4 bytes major.minor.build |
| 93 | |
| 94 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_0# { GPS_OFFcxx . . $ GPS_OFF., GPS_ONcxx . . $ GPS_ON. } CELESTRON_GPS_STATUScxx . . $ CELESTRON_GPS_STATUS#; |
| 95 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_1# { SR_1cxx . . $ SR_1., SR_2cxx . . $ SR_2., SR_3cxx . . $ SR_3., SR_4cxx . . $ SR_4., SR_5cxx . . $ SR_5., SR_6cxx . . $ SR_6., SR_7cxx . . $ SR_7., SR_8cxx . . $ SR_8., SR_9cxx . . $ SR_9. } CELESTRON_SLEW_RATEcxx . . $ CELESTRON_SLEW_RATE#; |
| 96 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_2# { CTM_OFFcxx . . $ CTM_OFF., CTM_ALTAZcxx . . $ CTM_ALTAZ., CTM_EQNcxx . . $ CTM_EQN., CTM_EQScxx . . $ CTM_EQS., CTM_RADECcxx . . $ CTM_RADEC. } CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE#; |
| 97 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_3# { RA_AXIScxx . . $ RA_AXIS., DEC_AXIScxx . . $ DEC_AXIS. } CELESTRON_AXIScxx . . $ CELESTRON_AXIS#; |
| 98 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_4# { CELESTRON_Ncxx . . $ CELESTRON_N., CELESTRON_Scxx . . $ CELESTRON_S., CELESTRON_Wcxx . . $ CELESTRON_W., CELESTRON_Ecxx . . $ CELESTRON_E. } CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION#; |
| 99 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_5# { FW_MODELcxx . . $ FW_MODEL., FW_VERSIONcxx . . $ FW_VERSION., FW_RAcxx . . $ FW_RA., FW_DECcxx . . $ FW_DEC., FW_ISGEMcxx . . $ FW_ISGEM., FW_CAN_AUXcxx . . $ FW_CAN_AUX., FW_HAS_FOCcxx . . $ FW_HAS_FOC. } CELESTRON_FIRMWAREcxx . . $ CELESTRON_FIRMWARE#; |
| 100 | |
| 101 | |
| 102 | // PEC state machine |
| 103 | // the order matters because it's used to check what states are available. |
| 104 | // they do not match the the base TelescopePECState |
| 105 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_6# |
| 106 | { |
| 107 | NotKnowncxx . . $ NotKnown., // PEC has not been checked. |
| 108 | |
| 109 | /// <summary> |
| 110 | /// PEC is not available, hardware has been checked, no other state is possible |
| 111 | /// </summary> |
| 112 | PEC_NOT_AVAILABLEcxx . . $ PEC_NOT_AVAILABLE., |
| 113 | |
| 114 | /// <summary> |
| 115 | /// PEC is available but inactive, can seek index |
| 116 | /// Seek index is only available command |
| 117 | /// </summary> |
| 118 | PEC_AVAILABLEcxx . . $ PEC_AVAILABLE., |
| 119 | |
| 120 | /// <summary> |
| 121 | /// The PEC index is being searched for, goes to PEC_INDEXED when found |
| 122 | /// </summary> |
| 123 | PEC_SEEKINGcxx . . $ PEC_SEEKING., |
| 124 | |
| 125 | /// <summary> |
| 126 | /// the PEC index has been found, can go to Playback or Recording |
| 127 | /// this is equivalent to TelescopePECState PEC_OFF |
| 128 | /// </summary> |
| 129 | PEC_INDEXEDcxx . . $ PEC_INDEXED., |
| 130 | |
| 131 | /// <summary> |
| 132 | /// PEC is being played back, stays in this state until stopped |
| 133 | /// equivalent to TelescopePECState PEC_ON |
| 134 | /// </summary> |
| 135 | PEC_PLAYBACKcxx . . $ PEC_PLAYBACK., |
| 136 | |
| 137 | /// <summary> |
| 138 | /// PEC is being recorded, goes to PEC_INDEXED when completed |
| 139 | /// </summary> |
| 140 | PEC_RECORDINGcxx . . $ PEC_RECORDING. |
| 141 | |
| 142 | } PEC_STATEcxx . . $ PEC_STATE#; |
| 143 | |
| 144 | // These values are sent to the hour angle axis motor using the MC_SET_POS|NEG_GUIDERATE |
| 145 | // commands to set the tracking rate. |
| 146 | typedef enumcxx . . $ $anonymous_type_b559dc56d0e1a731_7# |
| 147 | { |
| 148 | CTR_SIDEREALcxx . . $ CTR_SIDEREAL. = 0xFFFF, |
| 149 | CTR_SOLARcxx . . $ CTR_SOLAR. = 0xFFFE, |
| 150 | CTR_LUNARcxx . . $ CTR_LUNAR. = 0xFFFD |
| 151 | } CELESTRON_TRACK_RATEcxx . . $ CELESTRON_TRACK_RATE#; |
| 152 | |
| 153 | typedef structcxx . . $ $anonymous_type_b559dc56d0e1a731_8# |
| 154 | { |
| 155 | stdcxx . . $ std/::stringcxx . . $ std/string# Modelcxx . . $ $anonymous_type_b559dc56d0e1a731_8#Model.; |
| 156 | stdcxx . . $ std/::stringcxx . . $ std/string# Versioncxx . . $ $anonymous_type_b559dc56d0e1a731_8#Version.; |
| 157 | //std::string GPSFirmware; |
| 158 | stdcxx . . $ std/::stringcxx . . $ std/string# RAFirmwarecxx . . $ $anonymous_type_b559dc56d0e1a731_8#RAFirmware.; |
| 159 | stdcxx . . $ std/::stringcxx . . $ std/string# DEFirmwarecxx . . $ $anonymous_type_b559dc56d0e1a731_8#DEFirmware.; |
| 160 | double controllerVersioncxx . . $ $anonymous_type_b559dc56d0e1a731_8#controllerVersion.; |
| 161 | char controllerVariantcxx . . $ $anonymous_type_b559dc56d0e1a731_8#controllerVariant.; |
| 162 | bool isGemcxx . . $ $anonymous_type_b559dc56d0e1a731_8#isGem.; |
| 163 | bool canPeccxx . . $ $anonymous_type_b559dc56d0e1a731_8#canPec.; |
| 164 | bool hasHomeIndexcxx . . $ $anonymous_type_b559dc56d0e1a731_8#hasHomeIndex.; |
| 165 | bool hasFocusercxx . . $ $anonymous_type_b559dc56d0e1a731_8#hasFocuser.; |
| 166 | CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# celestronTrackModecxx . . $ $anonymous_type_b559dc56d0e1a731_8#celestronTrackMode.; |
| 167 | } FirmwareInfocxx . . $ FirmwareInfo#; |
| 168 | |
| 169 | typedef struct SimDatacxx . . $ SimData# |
| 170 | { |
| 171 | double racxx . . $ SimData#ra.; |
| 172 | double deccxx . . $ SimData#dec.; |
| 173 | double azcxx . . $ SimData#az.; |
| 174 | double altcxx . . $ SimData#alt.; |
| 175 | CELESTRON_SLEW_RATEcxx . . $ CELESTRON_SLEW_RATE# slewRatecxx . . $ SimData#slewRate.; |
| 176 | CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# trackModecxx . . $ SimData#trackMode.; |
| 177 | CELESTRON_GPS_STATUScxx . . $ CELESTRON_GPS_STATUS# gpsStatuscxx . . $ SimData#gpsStatus.; |
| 178 | bool isSlewingcxx . . $ SimData#isSlewing.; |
| 179 | uint32_tcxx . . $ uint32_t# foc_positioncxx . . $ SimData#foc_position. = 20000; |
| 180 | uint32_tcxx . . $ uint32_t# foc_targetcxx . . $ SimData#foc_target. = 20000; |
| 181 | } SimDatacxx . . $ SimData#; |
| 182 | |
| 183 | |
| 184 | /************************************************************************** |
| 185 | Utility functions |
| 186 | **************************************************************************/ |
| 187 | namespace Celestroncxx . . $ Celestron/ |
| 188 | { |
| 189 | double trimDecAnglecxx . . $ Celestron/trimDecAngle(447c67c6676f75c3).(double angle); |
| 190 | uint16_tcxx . . $ uint16_t# dd2nexcxx . . $ Celestron/dd2nex(b24fd2dbec494380).(double angle); |
| 191 | uint32_tcxx . . $ uint32_t# dd2pnexcxx . . $ Celestron/dd2pnex(91a40ab43b4b81b).(double angle); |
| 192 | double nex2ddcxx . . $ Celestron/nex2dd(15aa3a26f3ee3975).(uint32_tcxx . . $ uint32_t# value); |
| 193 | double pnex2ddcxx . . $ Celestron/pnex2dd(15aa3a26f3ee3975).(uint32_tcxx . . $ uint32_t# value); |
| 194 | } |
| 195 | |
| 196 | class CelestronDrivercxx . . $ CelestronDriver# |
| 197 | { |
| 198 | public: |
| 199 | CelestronDrivercxx . . $ CelestronDriver#CelestronDriver(49f6e7a06ebc5aa8).() {} |
| 200 | virtual ~cxx . . $ CelestronDriver#`~CelestronDriver`(49f6e7a06ebc5aa8).CelestronDrivercxx . . $ CelestronDriver#() = default; |
| 201 | |
| 202 | // Misc. |
| 203 | const char *getDeviceNamecxx . . $ CelestronDriver#getDeviceName(33a1f659e94feb42).(); |
| 204 | void set_port_fdcxx . . $ CelestronDriver#set_port_fd(d4f767463ce0a6b3).(int port_fd) |
| 205 | { |
| 206 | fdcxx . . $ CelestronDriver#fd. = port_fd; |
| 207 | } |
| 208 | void set_simulationcxx . . $ CelestronDriver#set_simulation(b45ddcbc8423892c).(bool enable) |
| 209 | { |
| 210 | simulationcxx . . $ CelestronDriver#simulation. = enable; |
| 211 | } |
| 212 | void set_devicecxx . . $ CelestronDriver#set_device(85c52e162fed56f9).(const char *name); |
| 213 | |
| 214 | // Simulation |
| 215 | void set_sim_slew_ratecxx . . $ CelestronDriver#set_sim_slew_rate(2f21aa9394f4b914).(CELESTRON_SLEW_RATEcxx . . $ CELESTRON_SLEW_RATE# val) |
| 216 | { |
| 217 | sim_datacxx . . $ CelestronDriver#sim_data..slewRatecxx . . $ SimData#slewRate. = val; |
| 218 | } |
| 219 | void set_sim_track_modecxx . . $ CelestronDriver#set_sim_track_mode(3b926775ecfc4f7f).(CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# val) |
| 220 | { |
| 221 | sim_datacxx . . $ CelestronDriver#sim_data..trackModecxx . . $ SimData#trackMode. = val; |
| 222 | } |
| 223 | void set_sim_gps_statuscxx . . $ CelestronDriver#set_sim_gps_status(678cdbbe79e2e928).(CELESTRON_GPS_STATUScxx . . $ CELESTRON_GPS_STATUS# val) |
| 224 | { |
| 225 | sim_datacxx . . $ CelestronDriver#sim_data..gpsStatuscxx . . $ SimData#gpsStatus. = val; |
| 226 | } |
| 227 | void set_sim_slewingcxx . . $ CelestronDriver#set_sim_slewing(b45ddcbc8423892c).(bool isSlewing) |
| 228 | { |
| 229 | sim_datacxx . . $ CelestronDriver#sim_data..isSlewingcxx . . $ SimData#isSlewing. = isSlewing; |
| 230 | } |
| 231 | void set_sim_racxx . . $ CelestronDriver#set_sim_ra(ba8836b59fb42830).(double ra) |
| 232 | { |
| 233 | sim_datacxx . . $ CelestronDriver#sim_data..racxx . . $ SimData#ra. = ra; |
| 234 | } |
| 235 | void set_sim_deccxx . . $ CelestronDriver#set_sim_dec(ba8836b59fb42830).(double dec) |
| 236 | { |
| 237 | sim_datacxx . . $ CelestronDriver#sim_data..deccxx . . $ SimData#dec. = dec; |
| 238 | } |
| 239 | void set_sim_azcxx . . $ CelestronDriver#set_sim_az(ba8836b59fb42830).(double az) |
| 240 | { |
| 241 | sim_datacxx . . $ CelestronDriver#sim_data..azcxx . . $ SimData#az. = az; |
| 242 | } |
| 243 | void set_sim_altcxx . . $ CelestronDriver#set_sim_alt(ba8836b59fb42830).(double alt) |
| 244 | { |
| 245 | sim_datacxx . . $ CelestronDriver#sim_data..altcxx . . $ SimData#alt. = alt; |
| 246 | } |
| 247 | double get_sim_racxx . . $ CelestronDriver#get_sim_ra(31fa7155c10fdd13).() |
| 248 | { |
| 249 | return sim_datacxx . . $ CelestronDriver#sim_data..racxx . . $ SimData#ra.; |
| 250 | } |
| 251 | double get_sim_deccxx . . $ CelestronDriver#get_sim_dec(31fa7155c10fdd13).() |
| 252 | { |
| 253 | return sim_datacxx . . $ CelestronDriver#sim_data..deccxx . . $ SimData#dec.; |
| 254 | } |
| 255 | int get_sim_foc_offsetcxx . . $ CelestronDriver#get_sim_foc_offset(b126dc7c1de90089).() |
| 256 | { |
| 257 | return sim_datacxx . . $ CelestronDriver#sim_data..foc_targetcxx . . $ SimData#foc_target. - sim_datacxx . . $ CelestronDriver#sim_data..foc_positioncxx . . $ SimData#foc_position.; |
| 258 | } |
| 259 | void move_sim_foccxx . . $ CelestronDriver#move_sim_foc(d4f767463ce0a6b3).(int offset) |
| 260 | { |
| 261 | sim_datacxx . . $ CelestronDriver#sim_data..foc_positioncxx . . $ SimData#foc_position. += offset; |
| 262 | } |
| 263 | |
| 264 | bool echocxx . . $ CelestronDriver#echo(c9857a73d68e59ba).(); |
| 265 | bool check_connectioncxx . . $ CelestronDriver#check_connection(c9857a73d68e59ba).(); |
| 266 | |
| 267 | // Get info |
| 268 | bool get_firmwarecxx . . $ CelestronDriver#get_firmware(b20975ad9cc0b832).(FirmwareInfocxx . . $ FirmwareInfo# *info); |
| 269 | bool get_versioncxx . . $ CelestronDriver#get_version(ccee65ad8ce1f171).(char *version, size_t size); |
| 270 | bool get_variantcxx . . $ CelestronDriver#get_variant(c6b7e35ff6de5671).(char *variant); |
| 271 | int modelcxx . . $ CelestronDriver#model(b126dc7c1de90089).(); // returns model number, -1 if failed |
| 272 | bool get_modelcxx . . $ CelestronDriver#get_model(b11d967dd5010bd2).(char *model, size_t size, bool *isGem, bool *canPec, bool *hasHomeIndex); |
| 273 | bool get_dev_firmwarecxx . . $ CelestronDriver#get_dev_firmware(4e6f7867ad9795ab).(int dev, char *version, size_t size); |
| 274 | bool get_radeccxx . . $ CelestronDriver#get_radec(f2662cc30a3558c8).(double *ra, double *dec, bool precise); |
| 275 | bool get_azaltcxx . . $ CelestronDriver#get_azalt(f2662cc30a3558c8).(double *az, double *alt, bool precise); |
| 276 | bool get_utc_date_timecxx . . $ CelestronDriver#get_utc_date_time(d0d6aa749aab92f4).(double *utc_hours, int *yy, int *mm, int *dd, int *hh, int *minute, int *ss, bool *dst, |
| 277 | bool precise); |
| 278 | |
| 279 | // Motion |
| 280 | bool start_motioncxx . . $ CelestronDriver#start_motion(9729089313ac7e98).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# dir, CELESTRON_SLEW_RATEcxx . . $ CELESTRON_SLEW_RATE# rate); |
| 281 | bool stop_motioncxx . . $ CelestronDriver#stop_motion(2220baaa4ff0274e).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# dir); |
| 282 | bool abortcxx . . $ CelestronDriver#abort(c9857a73d68e59ba).(); |
| 283 | bool slew_radeccxx . . $ CelestronDriver#slew_radec(fe56b98831c6e5f).(double ra, double dec, bool precise); |
| 284 | bool slew_azaltcxx . . $ CelestronDriver#slew_azalt(fe56b98831c6e5f).(double az, double alt, bool precise); |
| 285 | bool synccxx . . $ CelestronDriver#sync(fe56b98831c6e5f).(double ra, double dec, bool precise); |
| 286 | bool unsynccxx . . $ CelestronDriver#unsync(c9857a73d68e59ba).(); |
| 287 | |
| 288 | // Time & Location |
| 289 | bool set_locationcxx . . $ CelestronDriver#set_location(828b76dce88fac).(double longitude, double latitude); |
| 290 | bool get_locationcxx . . $ CelestronDriver#get_location(d4b2eeea6769c73a).(double* longitude, double *latitude); |
| 291 | bool set_datetimecxx . . $ CelestronDriver#set_datetime(ad631c8a590c75b6).(struct ln_datecxx . . $ ln_date# *utc, double utc_offset, bool dst = false, bool precise = false); |
| 292 | |
| 293 | // Track Mode, this is not the Indi track mode |
| 294 | bool get_track_modecxx . . $ CelestronDriver#get_track_mode(4e65d5af00e66e31).(CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# *mode); |
| 295 | bool set_track_modecxx . . $ CelestronDriver#set_track_mode(ba63e92b759e4983).(CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# mode); |
| 296 | |
| 297 | bool is_slewingcxx . . $ CelestronDriver#is_slewing(78ac5d2f3d401626).(bool *slewing); |
| 298 | |
| 299 | // Hibernate/Wakeup/ align |
| 300 | bool hibernatecxx . . $ CelestronDriver#hibernate(c9857a73d68e59ba).(); |
| 301 | bool wakeupcxx . . $ CelestronDriver#wakeup(c9857a73d68e59ba).(); |
| 302 | bool lastaligncxx . . $ CelestronDriver#lastalign(c9857a73d68e59ba).(); |
| 303 | bool startmovetoindexcxx . . $ CelestronDriver#startmovetoindex(c9857a73d68e59ba).(); |
| 304 | bool indexreachedcxx . . $ CelestronDriver#indexreached(78ac5d2f3d401626).(bool *atIndex); |
| 305 | |
| 306 | // Pulse Guide |
| 307 | size_t send_pulsecxx . . $ CelestronDriver#send_pulse(84ca681bfcda7b90).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# direction, unsigned char rate, unsigned char duration_msec); |
| 308 | bool get_pulse_statuscxx . . $ CelestronDriver#get_pulse_status(2220baaa4ff0274e).(CELESTRON_DIRECTIONcxx . . $ CELESTRON_DIRECTION# direction); |
| 309 | |
| 310 | // get and set guide rate |
| 311 | // 0 to 255 corresponding to 0 to 100% sidereal |
| 312 | bool get_guide_ratecxx . . $ CelestronDriver#get_guide_rate(cb5106d32dd6a8bd).(CELESTRON_AXIScxx . . $ CELESTRON_AXIS# axis, uint8_tcxx . . $ uint8_t# * rate); |
| 313 | bool set_guide_ratecxx . . $ CelestronDriver#set_guide_rate(7d813873e5d1867d).(CELESTRON_AXIScxx . . $ CELESTRON_AXIS# axis, uint8_tcxx . . $ uint8_t# rate); |
| 314 | |
| 315 | // Pointing state, pier side, returns 'E' or 'W' |
| 316 | bool get_pier_sidecxx . . $ CelestronDriver#get_pier_side(c6b7e35ff6de5671).(char * sop); |
| 317 | |
| 318 | // check if the mount is aligned using the mount J command |
| 319 | bool check_alignedcxx . . $ CelestronDriver#check_aligned(78ac5d2f3d401626).(bool *isAligned); |
| 320 | |
| 321 | // set the tracking rate, sidereal, solar or lunar |
| 322 | bool set_track_ratecxx . . $ CelestronDriver#set_track_rate(9cdab27b8f466e11).(CELESTRON_TRACK_RATEcxx . . $ CELESTRON_TRACK_RATE# rate, CELESTRON_TRACK_MODEcxx . . $ CELESTRON_TRACK_MODE# mode); |
| 323 | |
| 324 | // focuser commands |
| 325 | bool foc_existscxx . . $ CelestronDriver#foc_exists(c9857a73d68e59ba).(); // read version |
| 326 | int foc_positioncxx . . $ CelestronDriver#foc_position(b126dc7c1de90089).(); // read position, return -1 if failed |
| 327 | bool foc_movecxx . . $ CelestronDriver#foc_move(dfa6e707f7696010).(uint32_tcxx . . $ uint32_t# steps); // start move |
| 328 | bool foc_movingcxx . . $ CelestronDriver#foc_moving(c9857a73d68e59ba).(); // return true if moving |
| 329 | bool foc_limitscxx . . $ CelestronDriver#foc_limits(f51ff5b60ffa8194).(int * low, int * high); // read limits |
| 330 | bool foc_abortcxx . . $ CelestronDriver#foc_abort(c9857a73d68e59ba).(); // stop move |
| 331 | |
| 332 | // PEC management |
| 333 | |
| 334 | PEC_STATEcxx . . $ PEC_STATE# pecStatecxx . . $ CelestronDriver#pecState. { PEC_STATEcxx . . $ PEC_STATE#::NotKnowncxx . . $ NotKnown. }; |
| 335 | |
| 336 | PEC_STATEcxx . . $ PEC_STATE# updatePecStatecxx . . $ CelestronDriver#updatePecState(bd081be047c6c358).(); |
| 337 | |
| 338 | bool PecSeekIndexcxx . . $ CelestronDriver#PecSeekIndex(c9857a73d68e59ba).(); |
| 339 | bool isPecAtIndexcxx . . $ CelestronDriver#isPecAtIndex(efaadfb7dc14930a).(bool force = false); // returns true if the PEC index has been found |
| 340 | |
| 341 | size_t pecIndexcxx . . $ CelestronDriver#pecIndex(f708dce9a8856c70).(); // reads the current PEC index |
| 342 | int getPecValuecxx . . $ CelestronDriver#getPecValue(15f694ef3c96d230).(size_t index); // reads the current PEC value |
| 343 | bool setPecValuecxx . . $ CelestronDriver#setPecValue(659aaffc2a31c7db).(size_t index, int data); |
| 344 | |
| 345 | bool PecPlaybackcxx . . $ CelestronDriver#PecPlayback(efaadfb7dc14930a).(bool start); |
| 346 | |
| 347 | bool PecRecordcxx . . $ CelestronDriver#PecRecord(efaadfb7dc14930a).(bool start); |
| 348 | bool isPecRecordDonecxx . . $ CelestronDriver#isPecRecordDone(c9857a73d68e59ba).(); |
| 349 | |
| 350 | size_t getPecNumBinscxx . . $ CelestronDriver#getPecNumBins(f708dce9a8856c70).(); |
| 351 | |
| 352 | const char *PecStateStrcxx . . $ CelestronDriver#PecStateStr(8bc83b0396516c69).(PEC_STATEcxx . . $ PEC_STATE#); |
| 353 | const char *PecStateStrcxx . . $ CelestronDriver#PecStateStr(33a1f659e94feb42).(); |
| 354 | |
| 355 | // PEC simulation properties |
| 356 | int simIndexcxx . . $ CelestronDriver#simIndex.; |
| 357 | int simRecordStartcxx . . $ CelestronDriver#simRecordStart.; |
| 358 | bool simSeekIndexcxx . . $ CelestronDriver#simSeekIndex. = false; |
| 359 | |
| 360 | protected: |
| 361 | void set_sim_responsecxx . . $ CelestronDriver#set_sim_response(326aeb464d16410c).(const char *fmt, ...); |
| 362 | virtual int serial_writecxx . . $ CelestronDriver#serial_write(ee13b30f0a2700f1).(const char *cmd, int nbytes, int *nbytes_written); |
| 363 | virtual int serial_readcxx . . $ CelestronDriver#serial_read(ac48f4a6ffa9e770).(int nbytes, int *nbytes_read); |
| 364 | virtual int serial_read_sectioncxx . . $ CelestronDriver#serial_read_section(e47a364481c3b1f9).(char stop_char, int *nbytes_read); |
| 365 | |
| 366 | size_t send_commandcxx . . $ CelestronDriver#send_command(7b73dc35a0d805b8).(const char *cmd, size_t cmd_len, char *resp, size_t resp_len, |
| 367 | bool ascii_cmd, bool ascii_resp); |
| 368 | size_t send_passthroughcxx . . $ CelestronDriver#send_passthrough(14cd86040d0aada8).(int dest, int cmd_id, const char *payload, |
| 369 | size_t payload_len, char *resp, size_t response_len); |
| 370 | |
| 371 | char responsecxx . . $ CelestronDriver#response.[MAX_RESP_SIZEcxx . . $ `drivers/telescope/celestrondriver.h:41:9`!]; |
| 372 | bool simulationcxx . . $ CelestronDriver#simulation. = false; |
| 373 | SimDatacxx . . $ SimData# sim_datacxx . . $ CelestronDriver#sim_data.; |
| 374 | int fdcxx . . $ CelestronDriver#fd. = 0; |
| 375 | |
| 376 | char sim_ra_guide_ratecxx . . $ CelestronDriver#sim_ra_guide_rate. = 50; |
| 377 | char sim_dec_guide_ratecxx . . $ CelestronDriver#sim_dec_guide_rate. = 50; |
| 378 | }; |
| 379 | |
| 380 | class PecDatacxx . . $ PecData# |
| 381 | { |
| 382 | public: |
| 383 | PecDatacxx . . $ PecData#PecData(49f6e7a06ebc5aa8).(); |
| 384 | |
| 385 | // save PEC data to a file |
| 386 | bool Savecxx . . $ PecData#Save(c5f7da30cbc0f4e9).(const char * filename); |
| 387 | |
| 388 | // saves PEC data to mount |
| 389 | bool Savecxx . . $ PecData#Save(4fb8600e495d4e65).(CelestronDrivercxx . . $ CelestronDriver# * driver); |
| 390 | |
| 391 | // Loads PEC data from mount |
| 392 | bool Loadcxx . . $ PecData#Load(4fb8600e495d4e65).(CelestronDrivercxx . . $ CelestronDriver# * driver); |
| 393 | |
| 394 | // Loads PEC data from file |
| 395 | bool Loadcxx . . $ PecData#Load(c5f7da30cbc0f4e9).(const char * fileName); |
| 396 | |
| 397 | size_t NumBinscxx . . $ PecData#NumBins(f708dce9a8856c70).() |
| 398 | { |
| 399 | return numBinscxx . . $ PecData#numBins.; |
| 400 | } |
| 401 | |
| 402 | void RemoveDriftcxx . . $ PecData#RemoveDrift(49f6e7a06ebc5aa8).(); |
| 403 | |
| 404 | const char *getDeviceNamecxx . . $ PecData#getDeviceName(33a1f659e94feb42).(); |
| 405 | // void set_device(const char *name); |
| 406 | |
| 407 | private: |
| 408 | double wormArcSecondscxx . . $ PecData#wormArcSeconds. = 7200; |
| 409 | double rateScalecxx . . $ PecData#rateScale. = 1024; |
| 410 | size_t numBinscxx . . $ PecData#numBins. = 88; |
| 411 | const double SIDEREAL_ARCSEC_PER_SECcxx . . $ PecData#SIDEREAL_ARCSEC_PER_SEC. = 360.0 * 60.0 * 60.0 / (23.0 * 3600.0 + 56 * 60 + 4.09); |
| 412 | |
| 413 | double datacxx . . $ PecData#data.[255]; // numbins + 1 values, accumulated PEC offset in arc secs. First one zero |
| 414 | |
| 415 | void Kalmancxx . . $ PecData#Kalman(4a7589dc75bc07cc).(PecDatacxx . . $ PecData# newData, int num); |
| 416 | }; |
| 417 | |
| 418 |