Instrument Neutral Distributed Interface INDI  1.9.2
pmc8driver.h
Go to the documentation of this file.
1 /*
2  INDI Explore Scientific PMC8 driver
3 
4  Copyright (C) 2017 Michael Fulbright
5  Additional contributors:
6  Thomas Olson, Copyright (C) 2019
7  Karl Rees, Copyright (C) 2019-2021
8 
9  Based on IEQPro driver.
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 2.1 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25 
26 #pragma once
27 
28 #include <string>
29 
30 #include "inditelescope.h"
31 
32 // if tracking speed is above this (arcsec / sec) then assume mount is slewing
33 // this is just less than 3x sidereal
34 // which is what we would normally see if we are tracking
35 // and start moving east at the min move rate (4x sidereal)
36 #define PMC8_MAX_TRACK_RATE 44
37 
38 // set max settable slew rate as 833x sidereal
39 #define PMC8_MAX_MOVE_RATE (833*15)
40 
41 typedef enum {
50 
51 //#endif
52 
54 
55 //typedef enum { HEMI_SOUTH, HEMI_NORTH } PMC8_HEMISPHERE;
56 
57 typedef enum { PMC8_AXIS_RA=0, PMC8_AXIS_DEC=1 } PMC8_AXIS;
59 
60 typedef enum { MOUNT_G11 = 0, MOUNT_EXOS2 = 1, MOUNT_iEXOS100 = 2 } PMC8_MOUNT_TYPES;
61 
63 
64 typedef struct
65 {
68 // PMC8_HEMISPHERE hemisphere;
69 } PMC8Info;
70 
71 typedef struct
72 {
73  std::string Model;
74  std::string MainBoardFirmware;
77 } FirmwareInfo;
78 
79 /**************************************************************************
80  Misc.
81 **************************************************************************/
82 
83 void set_pmc8_debug(bool enable);
84 void set_pmc8_simulation(bool enable);
85 void set_pmc8_device(const char *name);
86 void set_pmc8_mountParameters(int index);
87 bool get_pmc8_response(int fd, char* buf, int* nbytes_read, const char* expected);
88 bool send_pmc8_command(int fd, const char *buf, int nbytes, int *nbytes_written);
89 
90 /**************************************************************************
91  Simulation
92 **************************************************************************/
95 void set_pmc8_sim_move_rate(int value);
96 //void set_sim_hemisphere(IEQ_HEMISPHERE value);
97 void set_pmc8_sim_ra(double ra);
98 void set_pmc8_sim_dec(double dec);
99 //void set_sim_guide_rate(double rate);
100 
101 /**************************************************************************
102  Diagnostics
103 **************************************************************************/
104 bool check_pmc8_connection(int fd, PMC8_CONNECTION_TYPE isSerial);
105 bool detect_pmc8(int fd);
108 
109 /**************************************************************************
110  Get Info
111 **************************************************************************/
113 bool get_pmc8_status(int fd, PMC8Info *info);
115 bool get_pmc8_firmware(int fd, FirmwareInfo *info);
117 bool get_pmc8_coords(int fd, double &ra, double &dec);
118 bool get_pmc8_move_rate_axis(int fd, PMC8_AXIS axis, double &rate);
119 bool get_pmc8_track_rate(int fd, double &rate);
120 bool get_pmc8_tracking_data(int fd, double &rate, uint8_t &mode);
121 
122 /**************************************************************************
123  Motion
124 **************************************************************************/
125 bool set_pmc8_move_rate_axis(int fd, PMC8_DIRECTION dir, int reqrate);
126 bool stop_pmc8_motion(int fd, PMC8_DIRECTION dir);
127 bool stop_pmc8_tracking_motion(int fd);
128 bool set_pmc8_ra_tracking(int fd, double rate);
129 bool set_pmc8_custom_ra_track_rate(int fd, double rate);
130 bool set_pmc8_custom_dec_track_rate(int fd, double rate);
131 bool set_pmc8_custom_ra_move_rate(int fd, double rate);
132 bool set_pmc8_custom_dec_move_rate(int fd, double rate);
133 bool set_pmc8_track_mode(int fd, uint8_t mode);
134 bool get_pmc8_is_scope_slewing(int fd, bool &isslew);
135 bool get_pmc8_direction_axis(int fd, PMC8_AXIS axis, int &dir);
136 bool set_pmc8_direction_axis(int fd, PMC8_AXIS axis, int dir, bool fast);
137 bool abort_pmc8(int fd);
138 bool slew_pmc8(int fd, double ra, double dec);
139 bool sync_pmc8(int fd, double ra, double dec);
140 bool set_pmc8_radec(int fd, double ra, double dec);
141 void set_pmc8_goto_resume(bool resume);
143 
144 
145 /**************************************************************************
146  Park
147 **************************************************************************/
148 bool park_pmc8(int fd);
149 bool unpark_pmc8(int fd);
150 
151 /**************************************************************************
152  Guide
153 **************************************************************************/
154 bool set_pmc8_guide_rate(int fd, PMC8_AXIS axis, double rate);
155 bool get_pmc8_guide_rate(int fd, PMC8_AXIS axis, double &rate);
156 bool start_pmc8_guide(int fd, PMC8_DIRECTION gdir, int ms, long &timetaken_us, double ratehint);
157 bool stop_pmc8_guide(int fd, PMC8_DIRECTION gdir);
158 
159 /**************************************************************************
160  Time & Location
161 **************************************************************************/
162 void set_pmc8_location(double latitude, double longitude);
163 int get_pmc8_east_dir();
164 
165 
166 
PMC8_AXIS
PMC8_AXIS
Definition: pmc8driver.h:57
unpark_pmc8
bool unpark_pmc8(int fd)
Definition: pmc8driver.cpp:1827
get_pmc8_is_scope_slewing
bool get_pmc8_is_scope_slewing(int fd, bool &isslew)
Definition: pmc8driver.cpp:700
PMC8_MOUNT_TYPES
PMC8_MOUNT_TYPES
Definition: pmc8driver.h:60
send_pmc8_command
bool send_pmc8_command(int fd, const char *buf, int nbytes, int *nbytes_written)
Definition: pmc8driver.cpp:2163
set_pmc8_sim_move_rate
void set_pmc8_sim_move_rate(int value)
Definition: pmc8driver.cpp:275
set_pmc8_custom_dec_track_rate
bool set_pmc8_custom_dec_track_rate(int fd, double rate)
Definition: pmc8driver.cpp:1094
ST_TRACKING
@ ST_TRACKING
Definition: pmc8driver.h:43
PMC8_SERIAL_STANDARD
@ PMC8_SERIAL_STANDARD
Definition: pmc8driver.h:62
ST_GUIDING
@ ST_GUIDING
Definition: pmc8driver.h:45
slew_pmc8
bool slew_pmc8(int fd, double ra, double dec)
Definition: pmc8driver.cpp:1878
set_pmc8_custom_dec_move_rate
bool set_pmc8_custom_dec_move_rate(int fd, double rate)
Definition: pmc8driver.cpp:1123
PMC8Info
Definition: pmc8driver.h:64
stop_pmc8_tracking_motion
bool stop_pmc8_tracking_motion(int fd)
Definition: pmc8driver.cpp:759
PMC8_TRACK_KING
@ PMC8_TRACK_KING
Definition: pmc8driver.h:53
set_pmc8_mountParameters
void set_pmc8_mountParameters(int index)
Definition: pmc8driver.cpp:201
set_pmc8_location
void set_pmc8_location(double latitude, double longitude)
Definition: pmc8driver.cpp:240
PMC8_DIRECTION
PMC8_DIRECTION
Definition: pmc8driver.h:58
set_pmc8_guide_rate
bool set_pmc8_guide_rate(int fd, PMC8_AXIS axis, double rate)
Definition: pmc8driver.cpp:1142
get_pmc8_direction_axis
bool get_pmc8_direction_axis(int fd, PMC8_AXIS axis, int &dir)
Definition: pmc8driver.cpp:597
FirmwareInfo::IsRev2Compliant
bool IsRev2Compliant
Definition: pmc8driver.h:76
PMC8_N
@ PMC8_N
Definition: pmc8driver.h:58
PMC8_S
@ PMC8_S
Definition: pmc8driver.h:58
stop_pmc8_guide
bool stop_pmc8_guide(int fd, PMC8_DIRECTION gdir)
Definition: pmc8driver.cpp:1438
PMC8_TRACK_CUSTOM
@ PMC8_TRACK_CUSTOM
Definition: pmc8driver.h:53
set_pmc8_custom_ra_move_rate
bool set_pmc8_custom_ra_move_rate(int fd, double rate)
Definition: pmc8driver.cpp:1104
set_pmc8_reconnect_flag
void set_pmc8_reconnect_flag()
Definition: pmc8driver.cpp:2185
PMC8Info::rememberSystemStatus
PMC8_SYSTEM_STATUS rememberSystemStatus
Definition: pmc8driver.h:67
set_pmc8_direction_axis
bool set_pmc8_direction_axis(int fd, PMC8_AXIS axis, int dir, bool fast)
Definition: pmc8driver.cpp:653
sync_pmc8
bool sync_pmc8(int fd, double ra, double dec)
Definition: pmc8driver.cpp:1941
PMC8_TRACK_LUNAR
@ PMC8_TRACK_LUNAR
Definition: pmc8driver.h:53
PMC8_E
@ PMC8_E
Definition: pmc8driver.h:58
PMC8_TRACK_RATE
PMC8_TRACK_RATE
Definition: pmc8driver.h:53
PMC8_CONNECTION_TYPE
PMC8_CONNECTION_TYPE
Definition: pmc8driver.h:62
set_pmc8_sim_system_status
void set_pmc8_sim_system_status(PMC8_SYSTEM_STATUS value)
Definition: pmc8driver.cpp:250
MOUNT_EXOS2
@ MOUNT_EXOS2
Definition: pmc8driver.h:60
PMC8_TRACK_SOLAR
@ PMC8_TRACK_SOLAR
Definition: pmc8driver.h:53
get_pmc8_response
bool get_pmc8_response(int fd, char *buf, int *nbytes_read, const char *expected)
Definition: pmc8driver.cpp:2077
ra
double ra
Definition: ieqprolegacydriver.cpp:43
detect_pmc8
bool detect_pmc8(int fd)
Definition: pmc8driver.cpp:345
INDI::Telescope::TelescopePierSide
TelescopePierSide
Definition: inditelescope.h:121
PMC8_AXIS_RA
@ PMC8_AXIS_RA
Definition: pmc8driver.h:57
set_pmc8_move_rate_axis
bool set_pmc8_move_rate_axis(int fd, PMC8_DIRECTION dir, int reqrate)
Definition: pmc8driver.cpp:733
ST_PARKED
@ ST_PARKED
Definition: pmc8driver.h:47
get_pmc8_east_dir
int get_pmc8_east_dir()
inditelescope.h
FirmwareInfo::MountType
PMC8_MOUNT_TYPES MountType
Definition: pmc8driver.h:75
dec
double dec
Definition: ieqprolegacydriver.cpp:44
PMC8Info::systemStatus
PMC8_SYSTEM_STATUS systemStatus
Definition: pmc8driver.h:66
get_pmc8_tracking_data
bool get_pmc8_tracking_data(int fd, double &rate, uint8_t &mode)
Definition: pmc8driver.cpp:822
check_pmc8_connection
bool check_pmc8_connection(int fd, PMC8_CONNECTION_TYPE isSerial)
Definition: pmc8driver.cpp:290
ST_MERIDIAN_FLIPPING
@ ST_MERIDIAN_FLIPPING
Definition: pmc8driver.h:46
MOUNT_iEXOS100
@ MOUNT_iEXOS100
Definition: pmc8driver.h:60
PMC8_SERIAL_AUTO
@ PMC8_SERIAL_AUTO
Definition: pmc8driver.h:62
get_pmc8_status
bool get_pmc8_status(int fd, PMC8Info *info)
set_pmc8_radec
bool set_pmc8_radec(int fd, double ra, double dec)
Definition: pmc8driver.cpp:1987
PMC8_SYSTEM_STATUS
PMC8_SYSTEM_STATUS
Definition: pmc8driver.h:41
set_pmc8_sim_dec
void set_pmc8_sim_dec(double dec)
Definition: pmc8driver.cpp:285
stop_pmc8_motion
bool stop_pmc8_motion(int fd, PMC8_DIRECTION dir)
set_pmc8_device
void set_pmc8_device(const char *name)
Definition: pmc8driver.cpp:235
destSideOfPier
INDI::Telescope::TelescopePierSide destSideOfPier(double ra, double dec)
Definition: pmc8driver.cpp:1918
PMC8_SERIAL_INVERTED
@ PMC8_SERIAL_INVERTED
Definition: pmc8driver.h:62
set_pmc8_debug
void set_pmc8_debug(bool enable)
Definition: pmc8driver.cpp:223
fd
int fd
Definition: intelliscope.c:43
ST_STOPPED
@ ST_STOPPED
Definition: pmc8driver.h:42
set_pmc8_goto_resume
void set_pmc8_goto_resume(bool resume)
Definition: pmc8driver.cpp:2201
PMC8_AXIS_DEC
@ PMC8_AXIS_DEC
Definition: pmc8driver.h:57
PMC8_W
@ PMC8_W
Definition: pmc8driver.h:58
get_pmc8_track_rate
bool get_pmc8_track_rate(int fd, double &rate)
Definition: pmc8driver.cpp:775
start_pmc8_guide
bool start_pmc8_guide(int fd, PMC8_DIRECTION gdir, int ms, long &timetaken_us, double ratehint)
Definition: pmc8driver.cpp:1279
get_pmc8_coords
bool get_pmc8_coords(int fd, double &ra, double &dec)
Definition: pmc8driver.cpp:2033
set_pmc8_simulation
void set_pmc8_simulation(bool enable)
Definition: pmc8driver.cpp:228
get_pmc8_firmware
bool get_pmc8_firmware(int fd, FirmwareInfo *info)
Definition: pmc8driver.cpp:526
set_pmc8_custom_ra_track_rate
bool set_pmc8_custom_ra_track_rate(int fd, double rate)
Definition: pmc8driver.cpp:1019
ST_SLEWING
@ ST_SLEWING
Definition: pmc8driver.h:44
FirmwareInfo
Definition: celestrondriver.h:156
set_pmc8_sim_track_rate
void set_pmc8_sim_track_rate(PMC8_TRACK_RATE value)
Definition: pmc8driver.cpp:270
park_pmc8
bool park_pmc8(int fd)
Definition: pmc8driver.cpp:1814
abort_pmc8
bool abort_pmc8(int fd)
Definition: pmc8driver.cpp:1846
get_pmc8_move_rate_axis
bool get_pmc8_move_rate_axis(int fd, PMC8_AXIS axis, double &rate)
Definition: pmc8driver.cpp:541
get_pmc8_reconnect_flag
bool get_pmc8_reconnect_flag()
Definition: pmc8driver.cpp:2191
PMC8_TRACK_UNDEFINED
@ PMC8_TRACK_UNDEFINED
Definition: pmc8driver.h:53
get_pmc8_guide_rate
bool get_pmc8_guide_rate(int fd, PMC8_AXIS axis, double &rate)
Definition: pmc8driver.cpp:1194
set_pmc8_sim_ra
void set_pmc8_sim_ra(double ra)
Definition: pmc8driver.cpp:280
ST_HOME
@ ST_HOME
Definition: pmc8driver.h:48
PMC8_TRACK_SIDEREAL
@ PMC8_TRACK_SIDEREAL
Definition: pmc8driver.h:53
set_pmc8_track_mode
bool set_pmc8_track_mode(int fd, uint8_t mode)
Definition: pmc8driver.cpp:979
MOUNT_G11
@ MOUNT_G11
Definition: pmc8driver.h:60
set_pmc8_ra_tracking
bool set_pmc8_ra_tracking(int fd, double rate)
Definition: pmc8driver.cpp:1007
PMC8_ETHERNET
@ PMC8_ETHERNET
Definition: pmc8driver.h:62