Commit e1864d0b authored by Don Gagne's avatar Don Gagne

Filter out calibration messages

parent bdc3dff8
...@@ -41,7 +41,7 @@ bool UASMessage::severityIsError() ...@@ -41,7 +41,7 @@ bool UASMessage::severityIsError()
UASMessageHandler::UASMessageHandler(QGCApplication* app) UASMessageHandler::UASMessageHandler(QGCApplication* app)
: QGCTool(app) : QGCTool(app)
, _activeUAS(NULL) , _activeVehicle(NULL)
, _activeComponent(-1) , _activeComponent(-1)
, _multiComp(false) , _multiComp(false)
, _errorCount(0) , _errorCount(0)
...@@ -87,27 +87,28 @@ void UASMessageHandler::clearMessages() ...@@ -87,27 +87,28 @@ void UASMessageHandler::clearMessages()
void UASMessageHandler::_activeVehicleChanged(Vehicle* vehicle) void UASMessageHandler::_activeVehicleChanged(Vehicle* vehicle)
{ {
// If we were already attached to an autopilot, disconnect it. // If we were already attached to an autopilot, disconnect it.
if (_activeUAS) if (_activeVehicle) {
{ disconnect(_activeVehicle->uas(), &UASInterface::textMessageReceived, this, &UASMessageHandler::handleTextMessage);
disconnect(_activeUAS, &UASInterface::textMessageReceived, this, &UASMessageHandler::handleTextMessage); _activeVehicle = NULL;
_activeUAS = NULL;
clearMessages(); clearMessages();
emit textMessageReceived(NULL); emit textMessageReceived(NULL);
} }
// And now if there's an autopilot to follow, set up the UI.
if (vehicle)
{
UAS* uas = vehicle->uas();
// And now if there's an autopilot to follow, set up the UI.
if (vehicle) {
// Connect to the new UAS. // Connect to the new UAS.
clearMessages(); clearMessages();
_activeUAS = uas; _activeVehicle = vehicle;
connect(uas, &UASInterface::textMessageReceived, this, &UASMessageHandler::handleTextMessage); connect(_activeVehicle->uas(), &UASInterface::textMessageReceived, this, &UASMessageHandler::handleTextMessage);
} }
} }
void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString text) void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString text)
{ {
// Hack to prevent calibration messages from cluttering things up
if (_activeVehicle->px4Firmware() && text.startsWith(QStringLiteral("[cal] "))) {
return;
}
// Color the output depending on the message severity. We have 3 distinct cases: // Color the output depending on the message severity. We have 3 distinct cases:
// 1: If we have an ERROR or worse, make it bigger, bolder, and highlight it red. // 1: If we have an ERROR or worse, make it bigger, bolder, and highlight it red.
......
...@@ -144,7 +144,7 @@ private slots: ...@@ -144,7 +144,7 @@ private slots:
void _activeVehicleChanged(Vehicle* vehicle); void _activeVehicleChanged(Vehicle* vehicle);
private: private:
UASInterface* _activeUAS; Vehicle* _activeVehicle;
int _activeComponent; int _activeComponent;
bool _multiComp; bool _multiComp;
QVector<UASMessage*> _messages; QVector<UASMessage*> _messages;
......
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