dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
omnibusf3.cpp
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #include "omnibusf3.h"
30 
31 #include <QIcon>
32 
36 #include "board_usb_ids.h"
37 
38 #include "hwomnibusf3.h"
39 
45 {
46  // Common USB IDs
48  USBInfo(DRONIN_VID_DRONIN_BOOTLOADER, DRONIN_PID_DRONIN_BOOTLOADER, BCD_DEVICE_BOOTLOADER));
50  USBInfo(DRONIN_VID_DRONIN_FIRMWARE, DRONIN_PID_DRONIN_FIRMWARE, BCD_DEVICE_FIRMWARE));
51 
52  boardType = 0xCE;
53 
54  // Define the bank of channels that are connected to a given timer
55  channelBanks.resize(3);
56  channelBanks[0] = QVector<int>() << 1 << 2; // 5 << 6
57  channelBanks[1] = QVector<int>() << 3;
58  channelBanks[2] = QVector<int>() << 4;
59  //channelBanks[3] = QVector<int>() << 7 << 8;
60 }
61 
63 {
64 }
65 
67 {
68  return QString("OmnibusF3");
69 }
70 
72 {
73  return QString("OmnibusF3 flight controller");
74 }
75 
78 {
79  switch (capability) {
83  return true;
86  default:
87  break;
88  }
89 
90  return false;
91 }
92 
94 {
95  return QPixmap(":/dronin/images/omnibusf3nano.png");
96 }
97 
100 {
101  switch (type) {
102  case INPUT_TYPE_PWM:
103  case INPUT_TYPE_UNKNOWN:
104  return false;
105  default:
106  break;
107  }
108 
109  return true;
110 }
111 
113 {
114  return "HwOmnibusF3";
115 }
116 
123 {
124  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
125  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
126  HwOmnibusF3 *HwOmnibusF3 = HwOmnibusF3::GetInstance(uavoManager);
127  Q_ASSERT(HwOmnibusF3);
128  if (!HwOmnibusF3)
129  return false;
130 
131  HwOmnibusF3::DataFields settings = HwOmnibusF3->getData();
132 
133  switch (type) {
134  case INPUT_TYPE_PPM:
135  settings.Uart3 = HwOmnibusF3::UART3_PPM;
136  break;
137  case INPUT_TYPE_HOTTSUMD:
138  settings.Uart3 = HwOmnibusF3::UART3_HOTTSUMD;
139  break;
140  case INPUT_TYPE_HOTTSUMH:
141  settings.Uart3 = HwOmnibusF3::UART3_HOTTSUMD;
142  break;
143  case INPUT_TYPE_SBUS:
144  settings.Uart3 = HwOmnibusF3::UART3_SBUS;
145  break;
147  settings.Uart3 = HwOmnibusF3::UART3_SBUSNONINVERTED;
148  break;
149  case INPUT_TYPE_IBUS:
150  settings.Uart3 = HwOmnibusF3::UART3_IBUS;
151  break;
152  case INPUT_TYPE_SRXL:
153  settings.Uart3 = HwOmnibusF3::UART3_SRXL;
154  break;
155  case INPUT_TYPE_DSM:
156  settings.Uart3 = HwOmnibusF3::UART3_DSM;
157  break;
159  settings.Uart3 = HwOmnibusF3::UART3_TBSCROSSFIRE;
160  break;
161  default:
162  return false;
163  }
164 
165  // Apply these changes
166  HwOmnibusF3->setData(settings);
167 
168  return true;
169 }
170 
176 {
177  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
178  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
179  HwOmnibusF3 *HwOmnibusF3 = HwOmnibusF3::GetInstance(uavoManager);
180  Q_ASSERT(HwOmnibusF3);
181  if (!HwOmnibusF3)
182  return INPUT_TYPE_UNKNOWN;
183 
184  HwOmnibusF3::DataFields settings = HwOmnibusF3->getData();
185 
186  switch (settings.Uart3) {
187  case HwOmnibusF3::UART3_PPM:
188  return INPUT_TYPE_PPM;
189  case HwOmnibusF3::UART3_DSM:
190  return INPUT_TYPE_DSM;
191  case HwOmnibusF3::UART3_HOTTSUMD:
192  return INPUT_TYPE_HOTTSUMD;
193  case HwOmnibusF3::UART3_HOTTSUMH:
194  return INPUT_TYPE_HOTTSUMH;
195  case HwOmnibusF3::UART3_SBUS:
196  return INPUT_TYPE_SBUS;
197  case HwOmnibusF3::UART3_SBUSNONINVERTED:
199  case HwOmnibusF3::UART3_IBUS:
200  return INPUT_TYPE_IBUS;
201  case HwOmnibusF3::UART3_SRXL:
202  return INPUT_TYPE_SRXL;
203  case HwOmnibusF3::UART3_TBSCROSSFIRE:
205  default:
206  break;
207  }
208 
209  switch (settings.Uart1) {
210  case HwOmnibusF3::UART1_DSM:
211  return INPUT_TYPE_DSM;
212  case HwOmnibusF3::UART1_SBUS:
213  return INPUT_TYPE_SBUS;
214  case HwOmnibusF3::UART1_SBUSNONINVERTED:
216  case HwOmnibusF3::UART1_IBUS:
217  return INPUT_TYPE_IBUS;
218  case HwOmnibusF3::UART1_SRXL:
219  return INPUT_TYPE_SRXL;
220  case HwOmnibusF3::UART1_HOTTSUMD:
221  return INPUT_TYPE_HOTTSUMD;
222  case HwOmnibusF3::UART1_HOTTSUMH:
223  return INPUT_TYPE_HOTTSUMH;
224  case HwOmnibusF3::UART1_TBSCROSSFIRE:
226  default:
227  break;
228  }
229 
230  switch (settings.Uart2) {
231  case HwOmnibusF3::UART2_DSM:
232  return INPUT_TYPE_DSM;
233  case HwOmnibusF3::UART2_SBUS:
234  return INPUT_TYPE_SBUS;
235  case HwOmnibusF3::UART2_SBUSNONINVERTED:
237  case HwOmnibusF3::UART2_IBUS:
238  return INPUT_TYPE_IBUS;
239  case HwOmnibusF3::UART2_SRXL:
240  return INPUT_TYPE_SRXL;
241  case HwOmnibusF3::UART2_HOTTSUMD:
242  return INPUT_TYPE_HOTTSUMD;
243  case HwOmnibusF3::UART2_HOTTSUMH:
244  return INPUT_TYPE_HOTTSUMH;
245  case HwOmnibusF3::UART2_TBSCROSSFIRE:
247  default:
248  break;
249  }
250 
251  return INPUT_TYPE_UNKNOWN;
252 }
253 
255 {
256  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
257  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
258  HwOmnibusF3 *hwOmnibusF3 = HwOmnibusF3::GetInstance(uavoManager);
259  Q_ASSERT(hwOmnibusF3);
260  if (!hwOmnibusF3)
261  return 0;
262 
263  HwOmnibusF3::DataFields settings = hwOmnibusF3->getData();
264 
265  switch (settings.GyroRange) {
266  case HwOmnibusF3::GYRORANGE_250:
267  return 250;
268  case HwOmnibusF3::GYRORANGE_500:
269  return 500;
270  case HwOmnibusF3::GYRORANGE_1000:
271  return 1000;
272  case HwOmnibusF3::GYRORANGE_2000:
273  return 2000;
274  default:
275  break;
276  }
277 
278  return 500;
279 }
280 
282 {
283  return QStringList() << "V"
284  << "I";
285 }
286 
288 {
289  switch (annunc) {
291  case ANNUNCIATOR_ALARM:
292  case ANNUNCIATOR_BUZZER:
293  case ANNUNCIATOR_RGB:
294  return true;
295  case ANNUNCIATOR_DAC:
296  break;
297  }
298  return false;
299 }
virtual ~OmnibusF3()
Definition: omnibusf3.cpp:62
OmnibusF3()
OmnibusF3::OmnibusF3 This is the OmnibusF3 board definition.
Definition: omnibusf3.cpp:44
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
QVector< QVector< qint32 > > channelBanks
The channel groups that are driven by timers.
Definition: iboardtype.h:287
virtual bool setInputType(Core::IBoardType::InputType type)
Definition: omnibusf3.cpp:122
virtual QPixmap getBoardPicture()
getBoardPicture
Definition: omnibusf3.cpp:93
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 QString boardDescription()
Definition: omnibusf3.cpp:71
The USBInfo struct.
Definition: iboardtype.h:62
void addFirmwareUSBInfo(USBInfo info)
Definition: iboardtype.h:277
virtual bool queryCapabilities(BoardCapabilities capability)
Return which capabilities this board has.
Definition: omnibusf3.cpp:77
void addBootloaderUSBInfo(USBInfo info)
Definition: iboardtype.h:278
virtual QStringList getAdcNames()
Definition: omnibusf3.cpp:281
virtual Core::IBoardType::InputType getInputType()
OmnibusF3::getInputType fetch the currently selected input type.
Definition: omnibusf3.cpp:175
virtual bool hasAnnunciator(AnnunciatorType annunc)
Check if the board has the given type of annunciator.
Definition: omnibusf3.cpp:287
virtual int queryMaxGyroRate()
Query the board for the currently set max rate of the gyro.
Definition: omnibusf3.cpp:254
virtual QString getHwUAVO()
Definition: omnibusf3.cpp:112
virtual bool isInputConfigurationSupported(Core::IBoardType::InputType type)
Determine if this board supports configuring the receiver.
Definition: omnibusf3.cpp:99
virtual QString shortName()
Definition: omnibusf3.cpp:66