Skip to content
Snippets Groups Projects
Commit 8b7bc4ad authored by Don Gagne's avatar Don Gagne
Browse files

Notify user of vehicle boot errors

parent 0b539643
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "UASMessageHandler.h"
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
...@@ -752,14 +753,37 @@ void ParameterLoader::_checkInitialLoadComplete(void) ...@@ -752,14 +753,37 @@ void ParameterLoader::_checkInitialLoadComplete(void)
} }
} }
// Check for any errors during vehicle boot
UASMessageHandler* msgHandler = UASMessageHandler::instance();
if (msgHandler->getErrorCount()) {
QString errors;
msgHandler->lockAccess();
foreach (UASMessage* msg, msgHandler->messages()) {
if (msg->severityIsError()) {
errors += msg->getText();
errors += "\n";
}
}
msgHandler->unlockAccess();
QGCMessageBox::critical("Vehicle startup errors",
QString("Errors were detected during vehicle startup:\n"
"%1"
"You should resolve these prior to flight.").arg(errors));
}
// Warn of parameter load failure
if (initialLoadFailures) { if (initialLoadFailures) {
QGCMessageBox::critical("Parameter Load Failure", QGCMessageBox::critical("Parameter Load Failure",
QString("QGroundControl was unable to retrieve the full set of parameters from the vehicle. " "QGroundControl was unable to retrieve the full set of parameters from the vehicle. "
"This will cause QGroundControl to be unable to display it's full user interface. " "This will cause QGroundControl to be unable to display it's full user interface. "
"This usually indicates an error in the vehicle's firmware. " "If you are using modified firmware, you may need to resolve any vehicle startup errors to resolve the issue. "
"Please upgrade your firmware to the latest version if possible. " "If you are using standard firmware, you may need to upgrade to a newer version to resolve the issue.");
"If that doesn't work, notify the firmware developers of this error. " qCWarning(ParameterLoaderLog) << "The following parameter indices could not be loaded after the maximum number of retries: " << indexList;
"The following parameter indices could not be loaded after the maximum number of retries: %1.").arg(indexList));
} else { } else {
// No failed parameters, ok to signal ready // No failed parameters, ok to signal ready
_parametersReady = true; _parametersReady = true;
...@@ -767,4 +791,4 @@ void ParameterLoader::_checkInitialLoadComplete(void) ...@@ -767,4 +791,4 @@ void ParameterLoader::_checkInitialLoadComplete(void)
_setupGroupMap(); _setupGroupMap();
emit parametersReady(); emit parametersReady();
} }
} }
\ No newline at end of file
...@@ -38,6 +38,19 @@ UASMessage::UASMessage(int componentid, int severity, QString text) ...@@ -38,6 +38,19 @@ UASMessage::UASMessage(int componentid, int severity, QString text)
_text = text; _text = text;
} }
bool UASMessage::severityIsError()
{
switch (_severity) {
case MAV_SEVERITY_EMERGENCY:
case MAV_SEVERITY_ALERT:
case MAV_SEVERITY_CRITICAL:
case MAV_SEVERITY_ERROR:
return true;
default:
return false;
}
}
IMPLEMENT_QGC_SINGLETON(UASMessageHandler, UASMessageHandler) IMPLEMENT_QGC_SINGLETON(UASMessageHandler, UASMessageHandler)
UASMessageHandler::UASMessageHandler(QObject *parent) UASMessageHandler::UASMessageHandler(QObject *parent)
......
...@@ -63,6 +63,11 @@ public: ...@@ -63,6 +63,11 @@ public:
* @brief Get (html) formatted text (in the form: "[11:44:21.137 - COMP:50] Info: [pm] sending list") * @brief Get (html) formatted text (in the form: "[11:44:21.137 - COMP:50] Info: [pm] sending list")
*/ */
QString getFormatedText() { return _formatedText; } QString getFormatedText() { return _formatedText; }
/**
* @return true: This message is a of a severity which is considered an error
*/
bool severityIsError();
private: private:
UASMessage(int componentid, int severity, QString text); UASMessage(int componentid, int severity, QString text);
void _setFormatedText(const QString formatedText) { _formatedText = formatedText; } void _setFormatedText(const QString formatedText) { _formatedText = formatedText; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment