dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
aq32.cpp
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #include "aq32.h"
29 
33 #include "board_usb_ids.h"
34 
35 #include "hwaq32.h"
36 
42 {
43  // Common USB IDs
45  USBInfo(DRONIN_VID_DRONIN_BOOTLOADER, DRONIN_PID_DRONIN_BOOTLOADER, BCD_DEVICE_BOOTLOADER));
47  USBInfo(DRONIN_VID_DRONIN_FIRMWARE, DRONIN_PID_DRONIN_FIRMWARE, BCD_DEVICE_FIRMWARE));
48  // Legacy USB IDs
50  USBInfo(DRONIN_VID_AEROQUAD_AQ32, DRONIN_PID_AEROQUAD_AQ32, BCD_DEVICE_BOOTLOADER));
52  USBInfo(DRONIN_VID_AEROQUAD_AQ32, DRONIN_PID_AEROQUAD_AQ32, BCD_DEVICE_FIRMWARE));
53 
54  boardType = 0x94;
55 
56  // Define the bank of channels that are connected to a given timer
57  channelBanks.resize(5);
58  channelBanks[0] = QVector<int>() << 1 << 2;
59  channelBanks[1] = QVector<int>() << 3 << 4;
60  channelBanks[2] = QVector<int>() << 5 << 6;
61  channelBanks[3] = QVector<int>() << 7 << 8 << 9 << 10;
62 }
63 
65 {
66 }
67 
68 QString AQ32::shortName()
69 {
70  return QString("AQ32");
71 }
72 
74 {
75  return QString("The AQ32 board");
76 }
77 
80 {
81  switch (capability) {
87  return true;
88  default:
89  break;
90  }
91 
92  return false;
93 }
94 
96 {
97  return QPixmap(":/aq32/images/aq32.png");
98 }
99 
102 {
103  switch (type) {
104  case INPUT_TYPE_PWM:
105  case INPUT_TYPE_UNKNOWN:
106  return false;
107  default:
108  break;
109  }
110 
111  return true;
112 }
113 
115 {
116  return "HwAQ32";
117 }
118 
125 {
126  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
127  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
128  HwAQ32 *hwAQ32 = HwAQ32::GetInstance(uavoManager);
129  Q_ASSERT(hwAQ32);
130  if (!hwAQ32)
131  return false;
132 
133  HwAQ32::DataFields settings = hwAQ32->getData();
134 
135  switch (type) {
136  case INPUT_TYPE_PPM:
137  settings.RcvrPort = HwAQ32::RCVRPORT_PPM;
138  break;
139  case INPUT_TYPE_HOTTSUMD:
140  settings.Uart3 = HwAQ32::UART3_HOTTSUMD;
141  break;
142  case INPUT_TYPE_HOTTSUMH:
143  settings.Uart3 = HwAQ32::UART3_HOTTSUMH;
144  break;
145  case INPUT_TYPE_SBUS:
146  settings.Uart3 = HwAQ32::UART3_SBUS;
147  break;
149  settings.Uart3 = HwAQ32::UART3_SBUSNONINVERTED;
150  break;
151  case INPUT_TYPE_IBUS:
152  settings.Uart3 = HwAQ32::UART3_IBUS;
153  break;
154  case INPUT_TYPE_DSM:
155  settings.Uart4 = HwAQ32::UART4_DSM;
156  break;
157  case INPUT_TYPE_SRXL:
158  settings.Uart3 = HwAQ32::UART3_SRXL;
159  break;
161  settings.Uart3 = HwAQ32::UART3_TBSCROSSFIRE;
162  break;
163  default:
164  return false;
165  }
166 
167  // Apply these changes
168  hwAQ32->setData(settings);
169 
170  return true;
171 }
172 
178 {
179  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
180  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
181  HwAQ32 *hwAQ32 = HwAQ32::GetInstance(uavoManager);
182  Q_ASSERT(hwAQ32);
183  if (!hwAQ32)
184  return INPUT_TYPE_UNKNOWN;
185 
186  HwAQ32::DataFields settings = hwAQ32->getData();
187 
188  switch (settings.RcvrPort) {
189  case HwAQ32::RCVRPORT_PPM:
190  return INPUT_TYPE_PPM;
191  default:
192  break;
193  }
194 
195  switch (settings.Uart3) {
196  case HwAQ32::UART3_HOTTSUMD:
197  return INPUT_TYPE_HOTTSUMD;
198  case HwAQ32::UART3_HOTTSUMH:
199  return INPUT_TYPE_HOTTSUMH;
200  case HwAQ32::UART3_SBUS:
201  return INPUT_TYPE_SBUS;
202  case HwAQ32::UART3_SBUSNONINVERTED:
204  case HwAQ32::UART3_IBUS:
205  return INPUT_TYPE_IBUS;
206  case HwAQ32::UART3_SRXL:
207  return INPUT_TYPE_SRXL;
208  case HwAQ32::UART3_TBSCROSSFIRE:
210  default:
211  break;
212  }
213 
214  switch (settings.Uart4) {
215  case HwAQ32::UART4_DSM:
216  return INPUT_TYPE_DSM;
217  case HwAQ32::UART4_HOTTSUMD:
218  return INPUT_TYPE_HOTTSUMD;
219  case HwAQ32::UART4_HOTTSUMH:
220  return INPUT_TYPE_HOTTSUMH;
221  case HwAQ32::UART4_SBUSNONINVERTED:
223  case HwAQ32::UART4_IBUS:
224  return INPUT_TYPE_IBUS;
225  case HwAQ32::UART4_SRXL:
226  return INPUT_TYPE_SRXL;
227  case HwAQ32::UART4_TBSCROSSFIRE:
229  default:
230  break;
231  }
232 
233  switch (settings.Uart6) {
234  case HwAQ32::UART6_DSM:
235  return INPUT_TYPE_DSM;
236  case HwAQ32::UART6_HOTTSUMD:
237  return INPUT_TYPE_HOTTSUMD;
238  case HwAQ32::UART6_HOTTSUMH:
239  return INPUT_TYPE_HOTTSUMH;
240  case HwAQ32::UART6_SBUSNONINVERTED:
242  case HwAQ32::UART6_IBUS:
243  return INPUT_TYPE_IBUS;
244  case HwAQ32::UART6_SRXL:
245  return INPUT_TYPE_SRXL;
246  case HwAQ32::UART6_TBSCROSSFIRE:
248  default:
249  break;
250  }
251 
252  return INPUT_TYPE_UNKNOWN;
253 }
254 
256 {
257  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
258  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
259  HwAQ32 *hwAQ32 = HwAQ32::GetInstance(uavoManager);
260  Q_ASSERT(hwAQ32);
261  if (!hwAQ32)
262  return 0;
263 
264  HwAQ32::DataFields settings = hwAQ32->getData();
265 
266  switch (settings.GyroRange) {
267  case HwAQ32::GYRORANGE_250:
268  return 250;
269  case HwAQ32::GYRORANGE_500:
270  return 500;
271  case HwAQ32::GYRORANGE_1000:
272  return 1000;
273  case HwAQ32::GYRORANGE_2000:
274  return 2000;
275  default:
276  break;
277  }
278 
279  return 500;
280 }
281 
282 QStringList AQ32::getAdcNames()
283 {
284  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
285  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
286  HwAQ32 *hwAQ32 = HwAQ32::GetInstance(uavoManager);
287  Q_ASSERT(hwAQ32);
288  if (!hwAQ32)
289  return QStringList();
290 
291  HwAQ32::DataFields settings = hwAQ32->getData();
292  if (settings.ADCInputs == HwAQ32::ADCINPUTS_ENABLED) {
293  return QStringList() << "AI2"
294  << "BM"
295  << "AI3"
296  << "AI4"
297  << "AI5";
298  }
299 
300  return QStringList() << "Disabled"
301  << "Disabled"
302  << "Disabled"
303  << "Disabled"
304  << "Disabled";
305 }
306 
308 {
309  switch (annunc) {
311  case ANNUNCIATOR_ALARM:
312  case ANNUNCIATOR_BUZZER:
313  case ANNUNCIATOR_RGB:
314  case ANNUNCIATOR_DAC:
315  return true;
316  }
317  return false;
318 }
virtual QString shortName()
Definition: aq32.cpp:68
virtual bool setInputType(Core::IBoardType::InputType type)
Definition: aq32.cpp:124
qint32 boardType
The numerical board type ID.
Definition: iboardtype.h:284
InputType
Types of input to configure for the default port.
Definition: iboardtype.h:158
virtual QPixmap getBoardPicture()
getBoardPicture
Definition: aq32.cpp:95
QVector< QVector< qint32 > > channelBanks
The channel groups that are driven by timers.
Definition: iboardtype.h:287
virtual Core::IBoardType::InputType getInputType()
getInputOnPort get the current input type
Definition: aq32.cpp:177
virtual ~AQ32()
Definition: aq32.cpp:64
Core plugin system that manages the plugins, their life cycle and their registered objects...
Definition: pluginmanager.h:53
BoardCapabilities
Types of capabilities boards can support.
Definition: iboardtype.h:92
virtual bool queryCapabilities(BoardCapabilities capability)
Return which capabilities this board has.
Definition: aq32.cpp:79
The USBInfo struct.
Definition: iboardtype.h:62
void addFirmwareUSBInfo(USBInfo info)
Definition: iboardtype.h:277
void addBootloaderUSBInfo(USBInfo info)
Definition: iboardtype.h:278
virtual int queryMaxGyroRate()
Query the board for the currently set max rate of the gyro.
Definition: aq32.cpp:255
virtual QString boardDescription()
Definition: aq32.cpp:73
virtual bool hasAnnunciator(AnnunciatorType annunc)
Check if the board has the given type of annunciator.
Definition: aq32.cpp:307
virtual QString getHwUAVO()
Definition: aq32.cpp:114
AQ32()
AQ32::AQ32 This is the AQ32 board definition.
Definition: aq32.cpp:41
virtual bool isInputConfigurationSupported(Core::IBoardType::InputType type)
Determine if this board supports configuring the receiver.
Definition: aq32.cpp:101
virtual QStringList getAdcNames()
Definition: aq32.cpp:282