52 #include "actuatorsettings.h"
57 , m_controllerType(NULL)
58 , m_vehicleType(VEHICLE_UNKNOWN)
59 , m_inputType(Core::IBoardType::INPUT_TYPE_UNKNOWN)
60 , m_escType(ESC_UNKNOWN)
61 , m_calibrationPerformed(false)
62 , m_restartNeeded(false)
63 , m_autoLaunched(autoLaunched)
64 , m_connectionManager(nullptr)
66 connect(
this, &QWizard::rejected,
this, &SetupWizard::boardIgnorePrompt);
67 setWindowTitle(tr(
"dRonin Setup Wizard"));
68 setOption(QWizard::IndependentPages,
false);
69 for (quint16
i = 0;
i < ActuatorSettings::CHANNELMAX_NUMELEM;
i++) {
72 setWizardStyle(QWizard::ModernStyle);
73 setMinimumSize(600, 500);
80 switch (currentId()) {
82 return PAGE_CONTROLLER;
84 case PAGE_CONTROLLER: {
91 const QString gcsHash = utilMngr->
getGcsHash();
92 if (!fwHash.length() || fwHash != gcsHash) {
95 return PAGE_BOARDTYPE_UNKNOWN;
102 return PAGE_BOARDTYPE_UNKNOWN;
108 return PAGE_INPUT_NOT_SUPPORTED;
110 case PAGE_VEHICLES: {
116 return PAGE_FIXEDWING;
125 return PAGE_NOTYETIMPLEMENTED;
133 saveHardwareSettings();
136 return PAGE_VEHICLES;
139 return PAGE_VEHICLES;
144 case PAGE_BIAS_CALIBRATION:
145 return PAGE_OUTPUT_CALIBRATION;
147 case PAGE_OUTPUT_CALIBRATION:
153 return PAGE_BIAS_CALIBRATION;
155 return PAGE_NOTYETIMPLEMENTED;
160 case PAGE_INPUT_NOT_SUPPORTED:
163 return PAGE_VEHICLES;
165 case PAGE_BOARDTYPE_UNKNOWN:
166 case PAGE_NOTYETIMPLEMENTED:
176 QString summary =
"";
178 summary.append(
"<b>").append(tr(
"Controller type: ")).append(
"</b>");
183 summary.append(tr(
"Unknown"));
185 summary.append(
"<br>");
186 summary.append(
"<b>").append(tr(
"Vehicle type: ")).append(
"</b>");
189 summary.append(tr(
"Multirotor"));
191 summary.append(
"<br>");
192 summary.append(
"<b>").append(tr(
"Vehicle sub type: ")).append(
"</b>");
195 summary.append(tr(
"Tricopter"));
198 summary.append(tr(
"Quadcopter X"));
201 summary.append(tr(
"Quadcopter +"));
204 summary.append(tr(
"Hexacopter"));
207 summary.append(tr(
"Hexacopter Coax (Y6)"));
210 summary.append(tr(
"Hexacopter X"));
213 summary.append(tr(
"Octocopter"));
216 summary.append(tr(
"Octocopter Coax X"));
219 summary.append(tr(
"Octocopter Coax +"));
222 summary.append(tr(
"Octocopter V"));
225 summary.append(tr(
"Unknown"));
231 summary.append(tr(
"Fixed wing"));
234 summary.append(tr(
"Helicopter"));
237 summary.append(tr(
"Surface vehicle"));
240 summary.append(tr(
"Unknown"));
243 summary.append(
"<br>");
244 summary.append(
"<b>").append(tr(
"Input type: ")).append(
"</b>");
247 summary.append(tr(
"PWM (One cable per channel)"));
250 summary.append(tr(
"PPM (One cable for all channels)"));
253 summary.append(tr(
"Futaba S.Bus"));
256 summary.append(tr(
"Futaba S.Bus Non-inverted"));
259 summary.append(tr(
"Spektrum satellite (DSM)"));
262 summary.append(tr(
"Graupner HoTT (SUMD)"));
265 summary.append(tr(
"Graupner HoTT (SUMH)"));
268 summary.append(tr(
"FlySky I-Bus"));
271 summary.append(tr(
"Multiplex SRXL"));
274 summary.append(tr(
"Team BlackSheep Crossfire"));
277 summary.append(tr(
"Unknown"));
280 summary.append(
"<br>");
281 summary.append(
"<b>").append(tr(
"ESC type: ")).append(
"</b>");
284 summary.append(tr(
"Legacy ESC (50 Hz)"));
287 summary.append(tr(
"Rapid ESC (400 Hz)"));
290 summary.append(tr(
"Oneshot125 (SyncPwm + 125-250us)"));
293 summary.append(tr(
"Oneshot42 (SyncPWM + 42-83us"));
296 summary.append(tr(
"Dshot300"));
299 summary.append(tr(
"Dshot600"));
302 summary.append(tr(
"Dshot1200"));
305 summary.append(tr(
"Unknown"));
317 void SetupWizard::createPages()
322 setPage(PAGE_MULTI,
new MultiPage(
this));
324 setPage(PAGE_HELI,
new HeliPage(
this));
326 setPage(PAGE_INPUT,
new InputPage(
this));
332 setPage(PAGE_SAVE,
new SavePage(
this));
338 setStartId(PAGE_START);
340 connect(button(QWizard::CustomButton1), &QAbstractButton::clicked,
this,
341 &SetupWizard::customBackClicked);
342 setButtonText(QWizard::CustomButton1, buttonText(QWizard::BackButton));
344 button_layout << QWizard::Stretch << QWizard::CustomButton1 << QWizard::NextButton
345 << QWizard::CancelButton << QWizard::FinishButton;
346 setButtonLayout(button_layout);
347 connect(
this, &QWizard::currentIdChanged,
this, &SetupWizard::pageChanged);
350 void SetupWizard::customBackClicked()
352 if (currentId() == PAGE_OUTPUT_CALIBRATION) {
359 void SetupWizard::pageChanged(
int currId)
361 button(QWizard::CustomButton1)->setVisible(currId != PAGE_START);
362 button(QWizard::CancelButton)->setVisible(currId != PAGE_END);
365 bool SetupWizard::saveHardwareSettings()
const
369 return helper.setupHardwareSettings();
372 void SetupWizard::boardIgnorePrompt()
377 QMessageBox prompt(QMessageBox::Question, tr(
"Setup Wizard Cancelled"),
378 tr(
"Would you like to prevent the setup wizard from automatically opening"
379 " for the remainder of this session?"), QMessageBox::Yes | QMessageBox::No,
this);
380 if (prompt.exec() == QMessageBox::No)
386 qWarning() <<
"Can't get UAVObjectUtilManager";
391 qInfo() <<
"Setup wizard will be ignored for this board";
SetupWizard::ESC_TYPE getESCType() const
SetupWizard::VEHICLE_TYPE getVehicleType() const
Core plugin system that manages the plugins, their life cycle and their registered objects...
QString getFirmwareHash()
void boardIgnored(QByteArray uuid)
SetupWizard(bool autoLaunched=false, QWidget *parent=nullptr)
bool isRestartNeeded() const
Core::IBoardType * getControllerType() const
virtual bool isInputConfigurationSupported(InputType type=INPUT_TYPE_ANY)
Determine if this board supports configuring the receiver.
The BoardtypeUnknown class tells the user this board type is unknown and unsupported.
SetupWizard::VEHICLE_SUB_TYPE getVehicleSubType() const
Core::IBoardType::InputType getInputType() const
virtual QString shortName()=0
The VehicleConfigurationHelper class provides an interface between the settings selected in the wizar...
QByteArray getBoardCPUSerial()
The InputPageNotSupported class Inform the user that they must manually configure input first...