Commit db612226 authored by dogmaphobic's avatar dogmaphobic

Restore critical messages in the main window.

parent a66ff761
...@@ -953,35 +953,6 @@ void ParameterLoader::_checkInitialLoadComplete(bool failIfNoDefaultComponent) ...@@ -953,35 +953,6 @@ void ParameterLoader::_checkInitialLoadComplete(bool failIfNoDefaultComponent)
// We aren't waiting for any more initial parameter updates, initial parameter loading is complete // We aren't waiting for any more initial parameter updates, initial parameter loading is complete
_initialLoadComplete = true; _initialLoadComplete = true;
// Check for any errors during vehicle boot
UASMessageHandler* msgHandler = qgcApp()->toolbox()->uasMessageHandler();
if (msgHandler->getErrorCountTotal()) {
QString errors;
bool firstError = true;
bool errorsFound = false;
msgHandler->lockAccess();
foreach (UASMessage* msg, msgHandler->messages()) {
if (msg->severityIsError()) {
if (!firstError) {
errors += "<br>";
}
errors += " - ";
errors += msg->getText();
firstError = false;
errorsFound = true;
}
}
msgHandler->showErrorsInToolbar();
msgHandler->unlockAccess();
if (errorsFound) {
QString errorMsg = QString("<b>Critical safety issue detected:</b><br>%1").arg(errors);
qgcApp()->showMessage(errorMsg);
}
}
// Check for index based load failures // Check for index based load failures
QString indexList; QString indexList;
bool initialLoadFailures = false; bool initialLoadFailures = false;
......
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
#include "FirmwarePlugin.h" #include "FirmwarePlugin.h"
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
#include <QDebug> #include <QDebug>
const char* guided_mode_not_supported_by_vehicle = "Guided mode not supported by Vehicle.";
bool FirmwarePlugin::isCapable(FirmwareCapabilities capabilities) bool FirmwarePlugin::isCapable(FirmwareCapabilities capabilities)
{ {
Q_UNUSED(capabilities); Q_UNUSED(capabilities);
...@@ -35,14 +37,14 @@ bool FirmwarePlugin::isCapable(FirmwareCapabilities capabilities) ...@@ -35,14 +37,14 @@ bool FirmwarePlugin::isCapable(FirmwareCapabilities capabilities)
QList<VehicleComponent*> FirmwarePlugin::componentsForVehicle(AutoPilotPlugin* vehicle) QList<VehicleComponent*> FirmwarePlugin::componentsForVehicle(AutoPilotPlugin* vehicle)
{ {
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
return QList<VehicleComponent*>(); return QList<VehicleComponent*>();
} }
QString FirmwarePlugin::flightMode(uint8_t base_mode, uint32_t custom_mode) const QString FirmwarePlugin::flightMode(uint8_t base_mode, uint32_t custom_mode) const
{ {
QString flightMode; QString flightMode;
struct Bit2Name { struct Bit2Name {
uint8_t baseModeBit; uint8_t baseModeBit;
const char* name; const char* name;
...@@ -54,9 +56,9 @@ QString FirmwarePlugin::flightMode(uint8_t base_mode, uint32_t custom_mode) cons ...@@ -54,9 +56,9 @@ QString FirmwarePlugin::flightMode(uint8_t base_mode, uint32_t custom_mode) cons
{ MAV_MODE_FLAG_AUTO_ENABLED, "Auto" }, { MAV_MODE_FLAG_AUTO_ENABLED, "Auto" },
{ MAV_MODE_FLAG_TEST_ENABLED, "Test" }, { MAV_MODE_FLAG_TEST_ENABLED, "Test" },
}; };
Q_UNUSED(custom_mode); Q_UNUSED(custom_mode);
if (base_mode == 0) { if (base_mode == 0) {
flightMode = "PreFlight"; flightMode = "PreFlight";
} else if (base_mode & MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) { } else if (base_mode & MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) {
...@@ -71,7 +73,7 @@ QString FirmwarePlugin::flightMode(uint8_t base_mode, uint32_t custom_mode) cons ...@@ -71,7 +73,7 @@ QString FirmwarePlugin::flightMode(uint8_t base_mode, uint32_t custom_mode) cons
} }
} }
} }
return flightMode; return flightMode;
} }
...@@ -80,9 +82,9 @@ bool FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_mode ...@@ -80,9 +82,9 @@ bool FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_mode
Q_UNUSED(flightMode); Q_UNUSED(flightMode);
Q_UNUSED(base_mode); Q_UNUSED(base_mode);
Q_UNUSED(custom_mode); Q_UNUSED(custom_mode);
qWarning() << "FirmwarePlugin::setFlightMode called on base class, not supported"; qWarning() << "FirmwarePlugin::setFlightMode called on base class, not supported";
return false; return false;
} }
...@@ -96,7 +98,7 @@ int FirmwarePlugin::manualControlReservedButtonCount(void) ...@@ -96,7 +98,7 @@ int FirmwarePlugin::manualControlReservedButtonCount(void)
bool FirmwarePlugin::adjustIncomingMavlinkMessage(Vehicle* vehicle, mavlink_message_t* message) bool FirmwarePlugin::adjustIncomingMavlinkMessage(Vehicle* vehicle, mavlink_message_t* message)
{ {
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(message); Q_UNUSED(message);
// Generic plugin does no message adjustment // Generic plugin does no message adjustment
return true; return true;
} }
...@@ -111,7 +113,7 @@ void FirmwarePlugin::adjustOutgoingMavlinkMessage(Vehicle* vehicle, mavlink_mess ...@@ -111,7 +113,7 @@ void FirmwarePlugin::adjustOutgoingMavlinkMessage(Vehicle* vehicle, mavlink_mess
void FirmwarePlugin::initializeVehicle(Vehicle* vehicle) void FirmwarePlugin::initializeVehicle(Vehicle* vehicle)
{ {
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
// Generic Flight Stack is by definition "generic", so no extra work // Generic Flight Stack is by definition "generic", so no extra work
} }
...@@ -155,7 +157,7 @@ void FirmwarePlugin::setGuidedMode(Vehicle* vehicle, bool guidedMode) ...@@ -155,7 +157,7 @@ void FirmwarePlugin::setGuidedMode(Vehicle* vehicle, bool guidedMode)
{ {
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(guidedMode); Q_UNUSED(guidedMode);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
bool FirmwarePlugin::isPaused(const Vehicle* vehicle) const bool FirmwarePlugin::isPaused(const Vehicle* vehicle) const
...@@ -169,21 +171,21 @@ void FirmwarePlugin::pauseVehicle(Vehicle* vehicle) ...@@ -169,21 +171,21 @@ void FirmwarePlugin::pauseVehicle(Vehicle* vehicle)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle) void FirmwarePlugin::guidedModeRTL(Vehicle* vehicle)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeLand(Vehicle* vehicle) void FirmwarePlugin::guidedModeLand(Vehicle* vehicle)
{ {
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel) void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel)
...@@ -191,7 +193,7 @@ void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel) ...@@ -191,7 +193,7 @@ void FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel)
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(altitudeRel); Q_UNUSED(altitudeRel);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord) void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord)
...@@ -199,7 +201,7 @@ void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordina ...@@ -199,7 +201,7 @@ void FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordina
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(gotoCoord); Q_UNUSED(gotoCoord);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
void FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeRel) void FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeRel)
...@@ -207,7 +209,7 @@ void FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeR ...@@ -207,7 +209,7 @@ void FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeR
// Not supported by generic vehicle // Not supported by generic vehicle
Q_UNUSED(vehicle); Q_UNUSED(vehicle);
Q_UNUSED(altitudeRel); Q_UNUSED(altitudeRel);
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by Vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
} }
const FirmwarePlugin::remapParamNameMajorVersionMap_t& FirmwarePlugin::paramNameRemapMajorVersionMap(void) const const FirmwarePlugin::remapParamNameMajorVersionMap_t& FirmwarePlugin::paramNameRemapMajorVersionMap(void) const
......
...@@ -43,6 +43,8 @@ QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog") ...@@ -43,6 +43,8 @@ QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog")
#define DEFAULT_LAT 38.965767f #define DEFAULT_LAT 38.965767f
#define DEFAULT_LON -120.083923f #define DEFAULT_LON -120.083923f
extern const char* guided_mode_not_supported_by_vehicle;
const char* Vehicle::_settingsGroup = "Vehicle%1"; // %1 replaced with mavlink system id const char* Vehicle::_settingsGroup = "Vehicle%1"; // %1 replaced with mavlink system id
const char* Vehicle::_joystickModeSettingsKey = "JoystickMode"; const char* Vehicle::_joystickModeSettingsKey = "JoystickMode";
const char* Vehicle::_joystickEnabledSettingsKey = "JoystickEnabled"; const char* Vehicle::_joystickEnabledSettingsKey = "JoystickEnabled";
...@@ -1465,7 +1467,7 @@ bool Vehicle::pauseVehicleSupported(void) const ...@@ -1465,7 +1467,7 @@ bool Vehicle::pauseVehicleSupported(void) const
void Vehicle::guidedModeRTL(void) void Vehicle::guidedModeRTL(void)
{ {
if (!guidedModeSupported()) { if (!guidedModeSupported()) {
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
return; return;
} }
_firmwarePlugin->guidedModeRTL(this); _firmwarePlugin->guidedModeRTL(this);
...@@ -1474,7 +1476,7 @@ void Vehicle::guidedModeRTL(void) ...@@ -1474,7 +1476,7 @@ void Vehicle::guidedModeRTL(void)
void Vehicle::guidedModeLand(void) void Vehicle::guidedModeLand(void)
{ {
if (!guidedModeSupported()) { if (!guidedModeSupported()) {
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
return; return;
} }
_firmwarePlugin->guidedModeLand(this); _firmwarePlugin->guidedModeLand(this);
...@@ -1483,7 +1485,7 @@ void Vehicle::guidedModeLand(void) ...@@ -1483,7 +1485,7 @@ void Vehicle::guidedModeLand(void)
void Vehicle::guidedModeTakeoff(double altitudeRel) void Vehicle::guidedModeTakeoff(double altitudeRel)
{ {
if (!guidedModeSupported()) { if (!guidedModeSupported()) {
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
return; return;
} }
setGuidedMode(true); setGuidedMode(true);
...@@ -1493,7 +1495,7 @@ void Vehicle::guidedModeTakeoff(double altitudeRel) ...@@ -1493,7 +1495,7 @@ void Vehicle::guidedModeTakeoff(double altitudeRel)
void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord) void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord)
{ {
if (!guidedModeSupported()) { if (!guidedModeSupported()) {
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
return; return;
} }
_firmwarePlugin->guidedModeGotoLocation(this, gotoCoord); _firmwarePlugin->guidedModeGotoLocation(this, gotoCoord);
...@@ -1502,7 +1504,7 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord) ...@@ -1502,7 +1504,7 @@ void Vehicle::guidedModeGotoLocation(const QGeoCoordinate& gotoCoord)
void Vehicle::guidedModeChangeAltitude(double altitudeRel) void Vehicle::guidedModeChangeAltitude(double altitudeRel)
{ {
if (!guidedModeSupported()) { if (!guidedModeSupported()) {
qgcApp()->showMessage(QStringLiteral("Guided mode not supported by vehicle.")); qgcApp()->showMessage(guided_mode_not_supported_by_vehicle);
return; return;
} }
_firmwarePlugin->guidedModeChangeAltitude(this, altitudeRel); _firmwarePlugin->guidedModeChangeAltitude(this, altitudeRel);
......
...@@ -278,6 +278,11 @@ MainWindow::MainWindow() ...@@ -278,6 +278,11 @@ MainWindow::MainWindow()
#ifndef __mobile__ #ifndef __mobile__
_loadVisibleWidgetsSettings(); _loadVisibleWidgetsSettings();
#endif #endif
//-- Enable message handler display of messages in main window
UASMessageHandler* msgHandler = qgcApp()->toolbox()->uasMessageHandler();
if(msgHandler) {
msgHandler->showErrorsInToolbar();
}
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
......
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