dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
pikoblx.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 "pikoblx.h"
30 
31 #include <QIcon>
32 
36 #include "board_usb_ids.h"
37 
38 #include "hwpikoblx.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 = 0xA2;
53 
54  // Define the bank of channels that are connected to a given timer
55  channelBanks.resize(6);
56  channelBanks[0] = QVector<int>() << 1 << 2 << 3 << 4;
57  channelBanks[1] = QVector<int>() << 5 << 6;
58  channelBanks[2] = QVector<int>() << 7;
59  channelBanks[3] = QVector<int>() << 8;
60 }
61 
63 {
64 }
65 
67 {
68  return QString("pikoblx");
69 }
70 
72 {
73  return QString("pikoblx 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 QIcon(":/dronin/images/pikoblx.svg").pixmap(QSize(735, 718));
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 "HwPikoBLX";
115 }
116 
123 {
124  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
125  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
126  HwPikoBLX *HwPikoBLX = HwPikoBLX::GetInstance(uavoManager);
127  Q_ASSERT(HwPikoBLX);
128  if (!HwPikoBLX)
129  return false;
130 
131  HwPikoBLX::DataFields settings = HwPikoBLX->getData();
132 
133  switch (type) {
134  case INPUT_TYPE_PPM:
135  settings.RxPort = HwPikoBLX::RXPORT_PPM;
136  break;
137  case INPUT_TYPE_HOTTSUMD:
138  settings.RxPort = HwPikoBLX::RXPORT_HOTTSUMD;
139  break;
140  case INPUT_TYPE_HOTTSUMH:
141  settings.RxPort = HwPikoBLX::RXPORT_HOTTSUMD;
142  break;
143  case INPUT_TYPE_SBUS:
144  settings.RxPort = HwPikoBLX::RXPORT_SBUS;
145  break;
147  settings.RxPort = HwPikoBLX::RXPORT_SBUSNONINVERTED;
148  break;
149  case INPUT_TYPE_IBUS:
150  settings.RxPort = HwPikoBLX::RXPORT_IBUS;
151  break;
152  case INPUT_TYPE_SRXL:
153  settings.RxPort = HwPikoBLX::RXPORT_SRXL;
154  break;
155  case INPUT_TYPE_DSM:
156  settings.RxPort = HwPikoBLX::RXPORT_DSM;
157  break;
159  settings.RxPort = HwPikoBLX::RXPORT_TBSCROSSFIRE;
160  break;
161  default:
162  return false;
163  }
164 
165  // Apply these changes
166  HwPikoBLX->setData(settings);
167 
168  return true;
169 }
170 
176 {
177  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
178  UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
179  HwPikoBLX *HwPikoBLX = HwPikoBLX::GetInstance(uavoManager);
180  Q_ASSERT(HwPikoBLX);
181  if (!HwPikoBLX)
182  return INPUT_TYPE_UNKNOWN;
183 
184  HwPikoBLX::DataFields settings = HwPikoBLX->getData();
185 
186  switch (settings.RxPort) {
187  case HwPikoBLX::RXPORT_PPM:
188  return INPUT_TYPE_PPM;
189  case HwPikoBLX::RXPORT_DSM:
190  return INPUT_TYPE_DSM;
191  case HwPikoBLX::RXPORT_HOTTSUMD:
192  return INPUT_TYPE_HOTTSUMD;
193  case HwPikoBLX::RXPORT_HOTTSUMH:
194  return INPUT_TYPE_HOTTSUMH;
195  case HwPikoBLX::RXPORT_SBUS:
196  return INPUT_TYPE_SBUS;
197  case HwPikoBLX::RXPORT_SBUSNONINVERTED:
199  case HwPikoBLX::RXPORT_IBUS:
200  return INPUT_TYPE_IBUS;
201  case HwPikoBLX::RXPORT_SRXL:
202  return INPUT_TYPE_SRXL;
203  case HwPikoBLX::RXPORT_TBSCROSSFIRE:
205  default:
206  break;
207  }
208 
209  switch (settings.Uart1) {
210  case HwPikoBLX::UART1_DSM:
211  return INPUT_TYPE_DSM;
212  case HwPikoBLX::UART1_SBUS:
213  return INPUT_TYPE_SBUS;
214  case HwPikoBLX::UART1_SBUSNONINVERTED:
216  case HwPikoBLX::UART1_IBUS:
217  return INPUT_TYPE_IBUS;
218  case HwPikoBLX::UART1_SRXL:
219  return INPUT_TYPE_SRXL;
220  case HwPikoBLX::UART1_HOTTSUMD:
221  return INPUT_TYPE_HOTTSUMD;
222  case HwPikoBLX::UART1_HOTTSUMH:
223  return INPUT_TYPE_HOTTSUMH;
224  case HwPikoBLX::UART1_TBSCROSSFIRE:
226  default:
227  break;
228  }
229 
230  switch (settings.Uart2) {
231  case HwPikoBLX::UART2_DSM:
232  return INPUT_TYPE_DSM;
233  case HwPikoBLX::UART2_SBUS:
234  return INPUT_TYPE_SBUS;
235  case HwPikoBLX::UART2_SBUSNONINVERTED:
237  case HwPikoBLX::UART2_IBUS:
238  return INPUT_TYPE_IBUS;
239  case HwPikoBLX::UART2_SRXL:
240  return INPUT_TYPE_SRXL;
241  case HwPikoBLX::UART2_HOTTSUMD:
242  return INPUT_TYPE_HOTTSUMD;
243  case HwPikoBLX::UART2_HOTTSUMH:
244  return INPUT_TYPE_HOTTSUMH;
245  case HwPikoBLX::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  HwPikoBLX *hwPikoBLX = HwPikoBLX::GetInstance(uavoManager);
259  Q_ASSERT(hwPikoBLX);
260  if (!hwPikoBLX)
261  return 0;
262 
263  HwPikoBLX::DataFields settings = hwPikoBLX->getData();
264 
265  switch (settings.GyroRange) {
266  case HwPikoBLX::GYRORANGE_250:
267  return 250;
268  case HwPikoBLX::GYRORANGE_500:
269  return 500;
270  case HwPikoBLX::GYRORANGE_1000:
271  return 1000;
272  case HwPikoBLX::GYRORANGE_2000:
273  return 2000;
274  default:
275  break;
276  }
277 
278  return 500;
279 }
280 
281 QStringList PikoBLX::getAdcNames()
282 {
283  return QStringList() << "I"
284  << "V";
285 }
286 
288 {
289  switch (annunc) {
291  case ANNUNCIATOR_ALARM:
292  case ANNUNCIATOR_BUZZER:
293  return true;
294  case ANNUNCIATOR_RGB:
295  case ANNUNCIATOR_DAC:
296  break;
297  }
298  return false;
299 }
virtual bool queryCapabilities(BoardCapabilities capability)
Return which capabilities this board has.
Definition: pikoblx.cpp:77
virtual QStringList getAdcNames()
Definition: pikoblx.cpp:281
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
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 ~PikoBLX()
Definition: pikoblx.cpp:62
virtual QString boardDescription()
Definition: pikoblx.cpp:71
The USBInfo struct.
Definition: iboardtype.h:62
virtual bool setInputType(Core::IBoardType::InputType type)
Definition: pikoblx.cpp:122
void addFirmwareUSBInfo(USBInfo info)
Definition: iboardtype.h:277
virtual int queryMaxGyroRate()
Query the board for the currently set max rate of the gyro.
Definition: pikoblx.cpp:254
void addBootloaderUSBInfo(USBInfo info)
Definition: iboardtype.h:278
virtual Core::IBoardType::InputType getInputType()
PikoBLX::getInputType fetch the currently selected input type.
Definition: pikoblx.cpp:175
virtual QString getHwUAVO()
Definition: pikoblx.cpp:112
virtual bool hasAnnunciator(AnnunciatorType annunc)
Check if the board has the given type of annunciator.
Definition: pikoblx.cpp:287
virtual bool isInputConfigurationSupported(Core::IBoardType::InputType type)
Determine if this board supports configuring the receiver.
Definition: pikoblx.cpp:99
virtual QString shortName()
Definition: pikoblx.cpp:66
PikoBLX()
PikoBLX::PikoBLX This is the PikoBLX board definition.
Definition: pikoblx.cpp:44
virtual QPixmap getBoardPicture()
getBoardPicture
Definition: pikoblx.cpp:93