Debian Codegraph @

drivers/auxiliary/pegasus_ppba.h

raw symbols SCIP
1 /*******************************************************************************
2 Copyright(c) 2019 Jasem Mutlaq. All rights reserved.
3
4 Pegasus Pocket Power Box Advance
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20
21 The full GNU General Public License is included in this distribution in the
22 file called LICENSE.
23 *******************************************************************************/
24
25 #pragma once
26
27 #include "defaultdevice.h"cxx . . $ `<file>/libs/indibase/defaultdevice.h`/
28 #include "indiweatherinterface.h"cxx . . $ `<file>/libs/indibase/indiweatherinterface.h`/
29 #include "indifocuserinterface.h"cxx . . $ `<file>/libs/indibase/indifocuserinterface.h`/
30
31 #include <vector>
32 #include <stdint.h>
33
34 namespace Connectioncxx . . $ Connection/
35 {
36 class Serialcxx . . $ Connection/Serial#;
37 }
38
39 class PegasusPPBAcxx . . $ PegasusPPBA# : public INDIcxx . . $ INDI/::DefaultDevicecxx . . $ INDI/DefaultDevice#, public INDIcxx . . $ INDI/::FocuserInterfacecxx . . $ INDI/FocuserInterface#, public INDIcxx . . $ INDI/::WeatherInterfacecxx . . $ INDI/WeatherInterface#
40 {
41 public:
42 PegasusPPBAcxx . . $ PegasusPPBA#PegasusPPBA(49f6e7a06ebc5aa8).();
43
44 virtual bool initPropertiescxx . . $ PegasusPPBA#initProperties(c9857a73d68e59ba).() override;
45 virtual bool updatePropertiescxx . . $ PegasusPPBA#updateProperties(c9857a73d68e59ba).() override;
46
47 virtual bool ISNewNumbercxx . . $ PegasusPPBA#ISNewNumber(b910d3521abb33fb).(const char *dev, const char *name, double values[], char *names[], int n) override;
48 virtual bool ISNewSwitchcxx . . $ PegasusPPBA#ISNewSwitch(e439c05866add404).(const char *dev, const char *name, ISStatecxx . . $ ISState# *states, char *names[], int n) override;
49
50 protected:
51 const char *getDefaultNamecxx . . $ PegasusPPBA#getDefaultName(33a1f659e94feb42).() override;
52 virtual bool saveConfigItemscxx . . $ PegasusPPBA#saveConfigItems(dc9e5a301483124c).(FILE *fp) override;
53
54 // Event loop
55 virtual void TimerHitcxx . . $ PegasusPPBA#TimerHit(49f6e7a06ebc5aa8).() override;
56
57 // Focuser Overrides
58 virtual IPStatecxx . . $ IPState# MoveAbsFocusercxx . . $ PegasusPPBA#MoveAbsFocuser(e933ec4323fbb8bc).(uint32_tcxx . . $ uint32_t# targetTicks) override;
59 virtual IPStatecxx . . $ IPState# MoveRelFocusercxx . . $ PegasusPPBA#MoveRelFocuser(7f9c1e68e57c0ac9).(FocusDirectioncxx . . $ INDI/FocuserInterface#FocusDirection# dir, uint32_tcxx . . $ uint32_t# ticks) override;
60 virtual bool AbortFocusercxx . . $ PegasusPPBA#AbortFocuser(c9857a73d68e59ba).() override;
61 virtual bool ReverseFocusercxx . . $ PegasusPPBA#ReverseFocuser(efaadfb7dc14930a).(bool enabled) override;
62 virtual bool SyncFocusercxx . . $ PegasusPPBA#SyncFocuser(dfa6e707f7696010).(uint32_tcxx . . $ uint32_t# ticks) override;
63
64 virtual bool SetFocuserBacklashcxx . . $ PegasusPPBA#SetFocuserBacklash(83c267b20bac841a).(int32_t steps) override;
65 virtual bool SetFocuserBacklashEnabledcxx . . $ PegasusPPBA#SetFocuserBacklashEnabled(efaadfb7dc14930a).(bool enabled) override;
66
67 // Weather Overrides
68 virtual IPStatecxx . . $ IPState# updateWeathercxx . . $ PegasusPPBA#updateWeather(dd764fd8e59c78c4).() override
69 {
70 return IPS_OKcxx . . $ IPS_OK.;
71 }
72
73
74 private:
75 bool Handshakecxx . . $ PegasusPPBA#Handshake(c9857a73d68e59ba).();
76
77 // Get Data
78 bool sendFirmwarecxx . . $ PegasusPPBA#sendFirmware(c9857a73d68e59ba).();
79 bool getSensorDatacxx . . $ PegasusPPBA#getSensorData(c9857a73d68e59ba).();
80 bool getConsumptionDatacxx . . $ PegasusPPBA#getConsumptionData(c9857a73d68e59ba).();
81 bool getMetricsDatacxx . . $ PegasusPPBA#getMetricsData(c9857a73d68e59ba).();
82 bool findExternalMotorControllercxx . . $ PegasusPPBA#findExternalMotorController(c9857a73d68e59ba).();
83 bool getXMCStartupDatacxx . . $ PegasusPPBA#getXMCStartupData(c9857a73d68e59ba).();
84 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> splitcxx . . $ PegasusPPBA#split(c47e161d59f8b6e7).(const stdcxx . . $ std/::stringcxx . . $ std/string# &input, const stdcxx . . $ std/::stringcxx . . $ std/string# &regex);
85 enumcxx . . $ PegasusPPBA#$anonymous_type_0#
86 {
87 PA_NAMEcxx . . $ PegasusPPBA#PA_NAME.,
88 PA_VOLTAGEcxx . . $ PegasusPPBA#PA_VOLTAGE.,
89 PA_CURRENTcxx . . $ PegasusPPBA#PA_CURRENT.,
90 PA_TEMPERATUREcxx . . $ PegasusPPBA#PA_TEMPERATURE.,
91 PA_HUMIDITYcxx . . $ PegasusPPBA#PA_HUMIDITY.,
92 PA_DEW_POINTcxx . . $ PegasusPPBA#PA_DEW_POINT.,
93 PA_PORT_STATUScxx . . $ PegasusPPBA#PA_PORT_STATUS.,
94 PA_ADJ_STATUScxx . . $ PegasusPPBA#PA_ADJ_STATUS.,
95 PA_DEW_1cxx . . $ PegasusPPBA#PA_DEW_1.,
96 PA_DEW_2cxx . . $ PegasusPPBA#PA_DEW_2.,
97 PA_AUTO_DEWcxx . . $ PegasusPPBA#PA_AUTO_DEW.,
98 PA_PWR_WARNcxx . . $ PegasusPPBA#PA_PWR_WARN.,
99 PA_PWRADJcxx . . $ PegasusPPBA#PA_PWRADJ.,
100 PA_Ncxx . . $ PegasusPPBA#PA_N.,
101 };
102 enumcxx . . $ PegasusPPBA#$anonymous_type_1#
103 {
104 PS_NAMEcxx . . $ PegasusPPBA#PS_NAME.,
105 PS_AVG_AMPScxx . . $ PegasusPPBA#PS_AVG_AMPS.,
106 PS_AMP_HOURScxx . . $ PegasusPPBA#PS_AMP_HOURS.,
107 PS_WATT_HOURScxx . . $ PegasusPPBA#PS_WATT_HOURS.,
108 PS_UPTIMEcxx . . $ PegasusPPBA#PS_UPTIME.,
109 PS_Ncxx . . $ PegasusPPBA#PS_N.,
110 };
111 enumcxx . . $ PegasusPPBA#$anonymous_type_2#
112 {
113 PC_NAMEcxx . . $ PegasusPPBA#PC_NAME.,
114 PC_TOTAL_CURRENTcxx . . $ PegasusPPBA#PC_TOTAL_CURRENT.,
115 PC_12V_CURRENTcxx . . $ PegasusPPBA#PC_12V_CURRENT.,
116 PC_DEWA_CURRENTcxx . . $ PegasusPPBA#PC_DEWA_CURRENT.,
117 PC_DEWB_CURRENTcxx . . $ PegasusPPBA#PC_DEWB_CURRENT.,
118 PC_UPTIMEcxx . . $ PegasusPPBA#PC_UPTIME.,
119 PC_Ncxx . . $ PegasusPPBA#PC_N.,
120 };
121
122 // Device Control
123 bool rebootcxx . . $ PegasusPPBA#reboot(c9857a73d68e59ba).();
124
125 // Power
126 bool setPowerEnabledcxx . . $ PegasusPPBA#setPowerEnabled(e6c03217c9f46667).(uint8_tcxx . . $ uint8_t# port, bool enabled);
127 bool setPowerOnBootcxx . . $ PegasusPPBA#setPowerOnBoot(c9857a73d68e59ba).();
128
129 // Dew
130 bool setAutoDewEnabledcxx . . $ PegasusPPBA#setAutoDewEnabled(efaadfb7dc14930a).(bool enabled);
131 bool setDewPWMcxx . . $ PegasusPPBA#setDewPWM(4ed805b44025c28a).(uint8_tcxx . . $ uint8_t# id, uint8_tcxx . . $ uint8_t# value);
132
133 // Focuser
134 void queryXMCcxx . . $ PegasusPPBA#queryXMC(49f6e7a06ebc5aa8).();
135 bool setFocuserMaxSpeedcxx . . $ PegasusPPBA#setFocuserMaxSpeed(3c978dac0e5ee2ad).(uint16_tcxx . . $ uint16_t# maxSpeed);
136 bool setFocuserMicrostepscxx . . $ PegasusPPBA#setFocuserMicrosteps(83c267b20bac841a).(int value);
137
138 /**
139 * @brief sendCommand Send command to unit.
140 * @param cmd Command
141 * @param res if nullptr, respones is ignored, otherwise read response and store it in the buffer.
142 * @return
143 */
144 bool sendCommandcxx . . $ PegasusPPBA#sendCommand(84e74a5521f49206).(const char *cmd, char *res);
145
146 int PortFDcxx . . $ PegasusPPBA#PortFD. { -1 };
147 bool setupCompletecxx . . $ PegasusPPBA#setupComplete. { false };
148
149 Connectioncxx . . $ Connection/::Serialcxx . . $ Connection/Serial# *serialConnectioncxx . . $ PegasusPPBA#serialConnection. { nullptr };
150
151 ////////////////////////////////////////////////////////////////////////////////////
152 /// Main Control
153 ////////////////////////////////////////////////////////////////////////////////////
154 /// Reboot Device
155 ISwitchcxx . . $ ISwitch# RebootScxx . . $ PegasusPPBA#RebootS.[1];
156 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# RebootSPcxx . . $ PegasusPPBA#RebootSP.;
157
158 // Power Sensors
159 INumbercxx . . $ INumber# PowerSensorsNcxx . . $ PegasusPPBA#PowerSensorsN.[9];
160 INumberVectorPropertycxx . . $ INumberVectorProperty# PowerSensorsNPcxx . . $ PegasusPPBA#PowerSensorsNP.;
161 enumcxx . . $ PegasusPPBA#$anonymous_type_3#
162 {
163 SENSOR_VOLTAGEcxx . . $ PegasusPPBA#SENSOR_VOLTAGE.,
164 SENSOR_CURRENTcxx . . $ PegasusPPBA#SENSOR_CURRENT.,
165 SENSOR_AVG_AMPScxx . . $ PegasusPPBA#SENSOR_AVG_AMPS.,
166 SENSOR_AMP_HOURScxx . . $ PegasusPPBA#SENSOR_AMP_HOURS.,
167 SENSOR_WATT_HOURScxx . . $ PegasusPPBA#SENSOR_WATT_HOURS.,
168 SENSOR_TOTAL_CURRENTcxx . . $ PegasusPPBA#SENSOR_TOTAL_CURRENT.,
169 SENSOR_12V_CURRENTcxx . . $ PegasusPPBA#SENSOR_12V_CURRENT.,
170 SENSOR_DEWA_CURRENTcxx . . $ PegasusPPBA#SENSOR_DEWA_CURRENT.,
171 SENSOR_DEWB_CURRENTcxx . . $ PegasusPPBA#SENSOR_DEWB_CURRENT.
172 };
173
174 ////////////////////////////////////////////////////////////////////////////////////
175 /// Power Group
176 ////////////////////////////////////////////////////////////////////////////////////
177
178 ISwitchcxx . . $ ISwitch# QuadOutScxx . . $ PegasusPPBA#QuadOutS.[2];
179 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# QuadOutSPcxx . . $ PegasusPPBA#QuadOutSP.;
180
181 // ISwitch AdjOutS[2];
182 // ISwitchVectorProperty AdjOutSP;
183
184 ISwitchcxx . . $ ISwitch# AdjOutVoltScxx . . $ PegasusPPBA#AdjOutVoltS.[6];
185 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# AdjOutVoltSPcxx . . $ PegasusPPBA#AdjOutVoltSP.;
186 enumcxx . . $ PegasusPPBA#$anonymous_type_4#
187 {
188 ADJOUT_OFFcxx . . $ PegasusPPBA#ADJOUT_OFF.,
189 ADJOUT_3Vcxx . . $ PegasusPPBA#ADJOUT_3V.,
190 ADJOUT_5Vcxx . . $ PegasusPPBA#ADJOUT_5V.,
191 ADJOUT_8Vcxx . . $ PegasusPPBA#ADJOUT_8V.,
192 ADJOUT_9Vcxx . . $ PegasusPPBA#ADJOUT_9V.,
193 ADJOUT_12Vcxx . . $ PegasusPPBA#ADJOUT_12V.,
194 };
195
196 // Select which power is ON on bootup
197 ISwitchcxx . . $ ISwitch# PowerOnBootScxx . . $ PegasusPPBA#PowerOnBootS.[4];
198 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# PowerOnBootSPcxx . . $ PegasusPPBA#PowerOnBootSP.;
199
200 // Short circuit warn
201 ILightcxx . . $ ILight# PowerWarnLcxx . . $ PegasusPPBA#PowerWarnL.[1];
202 ILightVectorPropertycxx . . $ ILightVectorProperty# PowerWarnLPcxx . . $ PegasusPPBA#PowerWarnLP.;
203
204 ISwitchcxx . . $ ISwitch# LedIndicatorScxx . . $ PegasusPPBA#LedIndicatorS.[2];
205 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# LedIndicatorSPcxx . . $ PegasusPPBA#LedIndicatorSP.;
206
207 ////////////////////////////////////////////////////////////////////////////////////
208 /// Dew Group
209 ////////////////////////////////////////////////////////////////////////////////////
210
211 // Auto Dew
212 ISwitchcxx . . $ ISwitch# AutoDewScxx . . $ PegasusPPBA#AutoDewS.[2];
213 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# AutoDewSPcxx . . $ PegasusPPBA#AutoDewSP.;
214
215 // Dew PWM
216 INumbercxx . . $ INumber# DewPWMNcxx . . $ PegasusPPBA#DewPWMN.[2];
217 INumberVectorPropertycxx . . $ INumberVectorProperty# DewPWMNPcxx . . $ PegasusPPBA#DewPWMNP.;
218 enumcxx . . $ PegasusPPBA#$anonymous_type_5#
219 {
220 DEW_PWM_Acxx . . $ PegasusPPBA#DEW_PWM_A.,
221 DEW_PWM_Bcxx . . $ PegasusPPBA#DEW_PWM_B.,
222 };
223
224 ////////////////////////////////////////////////////////////////////////////////////
225 /// Focuser
226 ////////////////////////////////////////////////////////////////////////////////////
227
228 // Focuser speed
229 INumbercxx . . $ INumber# FocuserSettingsNcxx . . $ PegasusPPBA#FocuserSettingsN.[1];
230 INumberVectorPropertycxx . . $ INumberVectorProperty# FocuserSettingsNPcxx . . $ PegasusPPBA#FocuserSettingsNP.;
231 enumcxx . . $ PegasusPPBA#$anonymous_type_6#
232 {
233 SETTING_MAX_SPEEDcxx . . $ PegasusPPBA#SETTING_MAX_SPEED.,
234 };
235
236 // Microstepping
237 ISwitchVectorPropertycxx . . $ ISwitchVectorProperty# FocuserDriveSPcxx . . $ PegasusPPBA#FocuserDriveSP.;
238 ISwitchcxx . . $ ISwitch# FocuserDriveScxx . . $ PegasusPPBA#FocuserDriveS.[4];
239 enumcxx . . $ PegasusPPBA#$anonymous_type_7#
240 {
241 STEP_FULLcxx . . $ PegasusPPBA#STEP_FULL.,
242 STEP_HALFcxx . . $ PegasusPPBA#STEP_HALF.,
243 STEP_FORTHcxx . . $ PegasusPPBA#STEP_FORTH.,
244 STEP_EIGHTHcxx . . $ PegasusPPBA#STEP_EIGHTH.
245 };
246
247
248
249 ////////////////////////////////////////////////////////////////////////////////////
250 /// Firmware
251 ////////////////////////////////////////////////////////////////////////////////////
252
253 ITextVectorPropertycxx . . $ ITextVectorProperty# FirmwareTPcxx . . $ PegasusPPBA#FirmwareTP.;
254 ITextcxx . . $ IText# FirmwareTcxx . . $ PegasusPPBA#FirmwareT.[2] {};
255 enumcxx . . $ PegasusPPBA#$anonymous_type_8#
256 {
257 FIRMWARE_VERSIONcxx . . $ PegasusPPBA#FIRMWARE_VERSION.,
258 FIRMWARE_UPTIMEcxx . . $ PegasusPPBA#FIRMWARE_UPTIME.,
259 };
260
261 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lastSensorDatacxx . . $ PegasusPPBA#lastSensorData.;
262 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lastConsumptionDatacxx . . $ PegasusPPBA#lastConsumptionData.;
263 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> lastMetricsDatacxx . . $ PegasusPPBA#lastMetricsData.;
264 char stopCharcxx . . $ PegasusPPBA#stopChar. { 0xD };
265 bool m_HasExternalMotorcxx . . $ PegasusPPBA#m_HasExternalMotor. { false };
266
267 static constexpr const uint8_tcxx . . $ uint8_t# PEGASUS_TIMEOUTcxx . . $ PegasusPPBA#PEGASUS_TIMEOUT. {3};
268 static constexpr const uint8_tcxx . . $ uint8_t# PEGASUS_LENcxx . . $ PegasusPPBA#PEGASUS_LEN. {128};
269 static constexpr const char *DEW_TABcxx . . $ PegasusPPBA#DEW_TAB. {"Dew"};
270 static constexpr const char *ENVIRONMENT_TABcxx . . $ PegasusPPBA#ENVIRONMENT_TAB. {"Environment"};
271 static constexpr const char *FIRMWARE_TABcxx . . $ PegasusPPBA#FIRMWARE_TAB. {"Firmware"};
272 };