Commit 2fa21491 authored by Don Gagne's avatar Don Gagne

No longer tries to reconnect after reboot

parent 886b40b5
......@@ -51,7 +51,7 @@ QGCView {
onCompleted: {
if (controller.showCustomConfigPanel) {
panel.showDialog(customConfigDialog, "Custom Airframe Config", 50, StandardButton.Reset)
panel.showDialog(customConfigDialogComponent, "Custom Airframe Config", 50, StandardButton.Reset)
}
}
}
......@@ -62,23 +62,45 @@ QGCView {
}
Component {
id: customConfigDialog
id: customConfigDialogComponent
QGCLabel {
id: customConfigPanel
anchors.fill: parent
wrapMode: Text.WordWrap
text: "Your vehicle is using a custom airframe configuration. " +
"This configuration can only be modified through the Parameter Editor.\n\n" +
"If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above."
signal hideDialog
QGCViewDialog {
id: customConfigDialog
Fact { id: sys_autostart; name: "SYS_AUTOSTART" }
function accept() {
sys_autostart.value = 0
customConfigPanel.hideDialog()
customConfigDialog.hideDialog()
}
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: "Your vehicle is using a custom airframe configuration. " +
"This configuration can only be modified through the Parameter Editor.\n\n" +
"If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above."
}
}
}
Component {
id: applyRestartDialogComponent
QGCViewDialog {
id: applyRestartDialog
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
}
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: "Clicking Apply will save the changes you have made to your aiframe configuration. " +
"Your vehicle will also be rebooted in order to complete the process. " +
"After your vehicle reboots, you can reconnect it to QGroundControl."
}
}
}
......@@ -117,7 +139,7 @@ QGCView {
anchors.right: parent.right
text: "Apply and Restart"
onClicked: { controller.changeAutostart() }
onClicked: panel.showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
}
Item {
......
......@@ -101,24 +101,26 @@ void AirframeComponentController::changeAutostart(void)
return;
}
qgcApp()->setOverrideCursor(Qt::WaitCursor);
_autopilot->getParameterFact("SYS_AUTOSTART")->setValue(_autostartId);
_autopilot->getParameterFact("SYS_AUTOCONFIG")->setValue(1);
qgcApp()->setOverrideCursor(Qt::WaitCursor);
// Wait for the parameters to flow through system
qgcApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
QGC::SLEEP::sleep(1);
qgcApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
// Reboot board and reconnect
// Reboot board
_uas->executeCommand(MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, 1, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
qgcApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
QGC::SLEEP::sleep(1);
qgcApp()->processEvents(QEventLoop::ExcludeUserInputEvents);
LinkManager::instance()->disconnectAll();
qgcApp()->reconnectAfterWait(5);
qgcApp()->restoreOverrideCursor();
}
AirframeType::AirframeType(const QString& name, const QString& imageResource, QObject* parent) :
......
......@@ -655,32 +655,6 @@ void QGCApplication::_loadCurrentStyle(void)
restoreOverrideCursor();
}
void QGCApplication::reconnectAfterWait(int waitSeconds)
{
LinkManager* linkManager = LinkManager::instance();
Q_ASSERT(linkManager);
Q_ASSERT(linkManager->getLinks().count() == 1);
LinkInterface* link = linkManager->getLinks()[0];
// Save the link configuration so we can restart the link laster
_reconnectLinkConfig = LinkConfiguration::duplicateSettings(linkManager->getLinks()[0]->getLinkConfiguration());
// Disconnect and wait
linkManager->disconnectLink(link);
QTimer::singleShot(waitSeconds * 1000, this, &QGCApplication::_reconnect);
}
void QGCApplication::_reconnect(void)
{
Q_ASSERT(_reconnectLinkConfig);
qgcApp()->restoreOverrideCursor();
LinkManager::instance()->createConnectedLink(_reconnectLinkConfig);
_reconnectLinkConfig = NULL;
}
void QGCApplication::reportMissingFact(const QString& name)
{
_missingFacts += name;
......
......@@ -96,9 +96,6 @@ public:
/// Set the current UI style
void setStyle(bool styleIsDark);
/// Disconnects the current link and waits for the specified number of seconds before reconnecting.
void reconnectAfterWait(int waitSeconds);
/// Used to report a missing Fact. Warning will be displayed to user. Method may be called
/// multiple times.
void reportMissingFact(const QString& name);
......@@ -143,7 +140,6 @@ public:
static QGCApplication* _app; ///< Our own singleton. Should be reference directly by qgcApp
private slots:
void _reconnect(void);
void _missingFactsDisplay(void);
private:
......@@ -167,8 +163,6 @@ private:
static const char* _lightStyleFile;
bool _styleIsDark; ///< true: dark style, false: light style
LinkConfiguration* _reconnectLinkConfig; ///< Configuration to reconnect for reconnectAfterWait
static const int _missingFactDelayedDisplayTimerTimeout = 1000; ///< Timeout to wait for next missing fact to come in before display
QTimer _missingFactDelayedDisplayTimer; ///< Timer use to delay missing fact display
QStringList _missingFacts; ///< List of missing facts to be displayed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment