1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-39 Moved reboot page to directly after Rx config page.

Added partial save to support changed hardware settings.
Made it possible to skip leveling procedure.
Changed some texts.
Changed isRebootRequired() criteria.
This commit is contained in:
Fredrik Arvidsson 2012-09-23 21:58:37 +02:00
parent 5ecf04fb15
commit 3ef26a633a
9 changed files with 44 additions and 29 deletions

View File

@ -90,6 +90,7 @@ void FlashPage::enableButtons(bool enable)
void FlashPage::saveProgress(int total, int current, QString description)
{
qDebug() << "Progress " << current << "(" << total << ")";
if(ui->saveProgressBar->maximum() != total) {
ui->saveProgressBar->setMaximum(total);
}

View File

@ -62,7 +62,7 @@ bool InputPage::validatePage()
else {
getWizard()->setInputType(SetupWizard::INPUT_PWM);
}
getWizard()->setRestartNeeded(restartNeeded(getWizard()->getInputType()));
getWizard()->setRestartNeeded(getWizard()->isRestartNeeded() || restartNeeded(getWizard()->getInputType()));
return true;
}

View File

@ -54,8 +54,8 @@ bool LevellingPage::validatePage()
bool LevellingPage::isComplete() const
{
return const_cast<LevellingPage *>(this)->getWizard()->isLevellingPerformed() &&
ui->levelButton->isEnabled();
//const_cast<LevellingPage *>(this)->getWizard()->isLevellingPerformed() &&
return ui->levelButton->isEnabled();
}
void LevellingPage::enableButtons(bool enable)

View File

@ -46,10 +46,12 @@ RebootPage::~RebootPage()
void RebootPage::initializePage()
{
connect(&m_timer, SIGNAL(timeout()), this, SLOT(toggleLabel()));
m_timer.setInterval(500);
m_timer.setSingleShot(false);
m_timer.start();
if(!m_timer.isActive()) {
connect(&m_timer, SIGNAL(timeout()), this, SLOT(toggleLabel()));
m_timer.setInterval(500);
m_timer.setSingleShot(false);
m_timer.start();
}
}
bool RebootPage::validatePage()
@ -62,5 +64,4 @@ void RebootPage::toggleLabel()
m_toggl = !m_toggl;
ui->yellowLabel->setVisible(m_toggl);
ui->redLabel->setVisible(!m_toggl);
qDebug() << "Toggle = " << m_toggl;
}

View File

@ -42,7 +42,7 @@ p, li { white-space: pre-wrap; }
<x>50</x>
<y>180</y>
<width>501</width>
<height>71</height>
<height>101</height>
</rect>
</property>
<property name="text">
@ -50,7 +50,7 @@ p, li { white-space: pre-wrap; }
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;The configuration created by the wizard contains settings that require a reboot of your controller. Please power cycle the controller before continuing. To power cycle the controller remove all batteries and the usb cable for at least 30 seconds.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; color:#000000;&quot;&gt;The configuration created by the wizard contains settings that require a reboot of your controller. Please power cycle the controller before continuing. To power cycle the controller remove all batteries and the usb cable for at least 30 seconds. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>

View File

@ -96,6 +96,14 @@ int SetupWizard::nextId() const
case PAGE_MULTI:
return PAGE_OUTPUT;
case PAGE_INPUT:
if(isRestartNeeded()) {
saveHardwareSettings();
return PAGE_REBOOT;
}
else {
return PAGE_VEHICLES;
}
case PAGE_REBOOT:
return PAGE_VEHICLES;
case PAGE_OUTPUT:
return PAGE_SUMMARY;
@ -106,13 +114,6 @@ int SetupWizard::nextId() const
case PAGE_SUMMARY:
return PAGE_LEVELLING;
case PAGE_FLASH:
if(isRestartNeeded()) {
return PAGE_REBOOT;
}
else {
return PAGE_END;
}
case PAGE_REBOOT:
return PAGE_END;
case PAGE_NOTYETIMPLEMENTED:
return PAGE_END;
@ -271,3 +272,9 @@ void SetupWizard::createPages()
setStartId(PAGE_START);
}
bool SetupWizard::saveHardwareSettings() const
{
VehicleConfigurationHelper helper(const_cast<SetupWizard *>(this));
return helper.setupHardwareSettings();
}

View File

@ -85,6 +85,7 @@ private:
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION,
PAGE_FLASH, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END};
void createPages();
bool saveHardwareSettings() const;
CONTROLLER_TYPE m_controllerType;
VEHICLE_TYPE m_vehicleType;

View File

@ -55,11 +55,11 @@ bool VehicleConfigurationHelper::setupVehicle(bool save)
clearModifiedObjects();
resetVehicleConfig();
resetGUIData();
if(!saveChangesToController(save))
{
if(!saveChangesToController(save)) {
return false;
}
m_progress = 0;
applyHardwareConfiguration();
applyVehicleConfiguration();
applyActuatorConfiguration();
@ -69,12 +69,19 @@ bool VehicleConfigurationHelper::setupVehicle(bool save)
applyManualControlDefaults();
bool result = saveChangesToController(save);
if(result) {
emit saveProgress(PROGRESS_STEPS, ++m_progress, tr("Done!"));
}
else {
emit saveProgress(PROGRESS_STEPS, ++m_progress, tr("Failed!"));
}
emit saveProgress(m_modifiedObjects.count() + 1, ++m_progress, result ? tr("Done!") : tr("Failed!"));
return result;
}
bool VehicleConfigurationHelper::setupHardwareSettings(bool save)
{
m_progress = 0;
clearModifiedObjects();
applyHardwareConfiguration();
applyManualControlDefaults();
bool result = saveChangesToController(save);
emit saveProgress(m_modifiedObjects.count() + 1, ++m_progress, result ? tr("Done!") : tr("Failed!"));
return result;
}
@ -429,7 +436,7 @@ bool VehicleConfigurationHelper::saveChangesToController(bool save)
QString objDescription = objPair->second;
if(UAVObject::GetGcsAccess(obj->getMetadata()) != UAVObject::ACCESS_READONLY && obj->isSettings()) {
emit saveProgress(PROGRESS_STEPS, ++m_progress, objDescription);
emit saveProgress(m_modifiedObjects.count() + 1, ++m_progress, objDescription);
m_currentTransactionObjectID = obj->getObjID();
@ -490,7 +497,6 @@ bool VehicleConfigurationHelper::saveChangesToController(bool save)
qDebug() << "Finished saving modified objects to controller. Success = " << m_transactionOK;
clearModifiedObjects();
return m_transactionOK;
}

View File

@ -61,6 +61,7 @@ class VehicleConfigurationHelper : public QObject
public:
VehicleConfigurationHelper(VehicleConfigurationSource* configSource);
bool setupVehicle(bool save = true);
bool setupHardwareSettings(bool save = true);
static const qint16 LEGACY_ESC_FREQUENCE;
static const qint16 RAPID_ESC_FREQUENCE;
@ -72,8 +73,6 @@ private:
static const int MIXER_TYPE_MOTOR = 1;
static const int MIXER_TYPE_SERVO = 2;
static const int PROGRESS_STEPS = 11;
VehicleConfigurationSource *m_configSource;
UAVObjectManager *m_uavoManager;