Commit 26122dca authored by lm's avatar lm

Merge branch 'dev-mac' of github.com:pixhawk/qgroundcontrol into v10release

parents 1827000b e2261020
...@@ -183,14 +183,14 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) ...@@ -183,14 +183,14 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
unsigned int decodeState = mavlink_parse_char(link->getId(), (uint8_t)(b.at(position)), &message, &status); unsigned int decodeState = mavlink_parse_char(link->getId(), (uint8_t)(b.at(position)), &message, &status);
if (decodeState == 1) { if (decodeState == 1) {
#ifdef MAVLINK_MESSAGE_LENGTHS //#ifdef MAVLINK_MESSAGE_LENGTHS
const uint8_t message_lengths[] = MAVLINK_MESSAGE_LENGTHS; // const uint8_t message_lengths[] = MAVLINK_MESSAGE_LENGTHS;
if (message.msgid >= sizeof(message_lengths) || // if (message.msgid >= sizeof(message_lengths) ||
message.len != message_lengths[message.msgid]) { // message.len != message_lengths[message.msgid]) {
qDebug() << "MAVLink message " << message.msgid << " length incorrect (was " << message.len << " expected " << message_lengths[message.msgid] << ")"; // qDebug() << "MAVLink message " << message.msgid << " length incorrect (was " << message.len << " expected " << message_lengths[message.msgid] << ")";
continue; // continue;
} // }
#endif //#endif
// Log data // Log data
if (m_loggingEnabled && m_logfile) { if (m_loggingEnabled && m_logfile) {
const int len = MAVLINK_MAX_PACKET_LEN+sizeof(quint64); const int len = MAVLINK_MAX_PACKET_LEN+sizeof(quint64);
......
...@@ -827,26 +827,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -827,26 +827,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
case MAVLINK_MSG_ID_DEBUG: case MAVLINK_MSG_ID_DEBUG:
emit valueChanged(uasId, QString("debug ") + QString::number(mavlink_msg_debug_get_ind(&message)), "raw", mavlink_msg_debug_get_value(&message), MG::TIME::getGroundTimeNow()); emit valueChanged(uasId, QString("debug ") + QString::number(mavlink_msg_debug_get_ind(&message)), "raw", mavlink_msg_debug_get_value(&message), MG::TIME::getGroundTimeNow());
break; break;
case MAVLINK_MSG_ID_ATTITUDE_CONTROLLER_OUTPUT: case MAVLINK_MSG_ID_ROLL_PITCH_YAW_THRUST_SETPOINT:
{ {
mavlink_attitude_controller_output_t out; mavlink_roll_pitch_yaw_thrust_setpoint_t out;
mavlink_msg_attitude_controller_output_decode(&message, &out); mavlink_msg_roll_pitch_yaw_thrust_setpoint_decode(&message, &out);
quint64 time = MG::TIME::getGroundTimeNowUsecs(); quint64 time = getUnixTime(out.time_ms*1000);
emit attitudeThrustSetPointChanged(this, out.roll/127.0f, out.pitch/127.0f, out.yaw/127.0f, (uint8_t)out.thrust, time); emit attitudeThrustSetPointChanged(this, out.roll, out.pitch, out.yaw, out.thrust, time);
emit valueChanged(uasId, "att control roll", "raw", out.roll, time/1000.0f); emit valueChanged(uasId, "att control roll", "rad", out.roll, time);
emit valueChanged(uasId, "att control pitch", "raw", out.pitch, time/1000.0f); emit valueChanged(uasId, "att control pitch", "rad", out.pitch, time);
emit valueChanged(uasId, "att control yaw", "raw", out.yaw, time/1000.0f); emit valueChanged(uasId, "att control yaw", "rad", out.yaw, time);
} emit valueChanged(uasId, "att control thrust", "0-1", out.thrust, time);
break;
case MAVLINK_MSG_ID_POSITION_CONTROLLER_OUTPUT:
{
mavlink_position_controller_output_t out;
mavlink_msg_position_controller_output_decode(&message, &out);
quint64 time = MG::TIME::getGroundTimeNow();
//emit positionSetPointsChanged(uasId, out.x/127.0f, out.y/127.0f, out.z/127.0f, out.yaw, time);
emit valueChanged(uasId, "pos control x", "raw", out.x, time);
emit valueChanged(uasId, "pos control y", "raw", out.y, time);
emit valueChanged(uasId, "pos control z", "raw", out.z, time);
} }
break; break;
case MAVLINK_MSG_ID_WAYPOINT_COUNT: case MAVLINK_MSG_ID_WAYPOINT_COUNT:
......
...@@ -55,6 +55,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active) ...@@ -55,6 +55,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
disconnect(mav, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); disconnect(mav, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
disconnect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); disconnect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString)));
disconnect(mav, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); disconnect(mav, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
disconnect(mav, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(receiveTextMessage(int,int,int,QString)));
} }
// Connect new system // Connect new system
...@@ -63,6 +64,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active) ...@@ -63,6 +64,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
connect(active, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); connect(active, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
connect(active, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); connect(active, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString)));
connect(active, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); connect(active, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
connect(active, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(receiveTextMessage(int,int,int,QString)));
// Update all values once // Update all values once
nameLabel->setText(mav->getUASName()); nameLabel->setText(mav->getUASName());
...@@ -81,6 +83,7 @@ void QGCToolBar::createCustomWidgets() ...@@ -81,6 +83,7 @@ void QGCToolBar::createCustomWidgets()
stateLabel = new QLabel("------", this); stateLabel = new QLabel("------", this);
wpLabel = new QLabel("---", this); wpLabel = new QLabel("---", this);
distlabel = new QLabel("--- ---- m", this); distlabel = new QLabel("--- ---- m", this);
messageLabel = new QLabel("No system messages.", this);
//symbolButton->setIcon(":"); //symbolButton->setIcon(":");
symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px; background-color: none; }"); symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px; background-color: none; }");
addWidget(symbolButton); addWidget(symbolButton);
...@@ -89,6 +92,7 @@ void QGCToolBar::createCustomWidgets() ...@@ -89,6 +92,7 @@ void QGCToolBar::createCustomWidgets()
addWidget(stateLabel); addWidget(stateLabel);
addWidget(wpLabel); addWidget(wpLabel);
addWidget(distlabel); addWidget(distlabel);
addWidget(messageLabel);
toggleLoggingAction = new QAction(QIcon(":"), "Start Logging", this); toggleLoggingAction = new QAction(QIcon(":"), "Start Logging", this);
logReplayAction = new QAction(QIcon(":"), "Start Replay", this); logReplayAction = new QAction(QIcon(":"), "Start Replay", this);
...@@ -154,6 +158,14 @@ void QGCToolBar::setSystemType(UASInterface* uas, unsigned int systemType) ...@@ -154,6 +158,14 @@ void QGCToolBar::setSystemType(UASInterface* uas, unsigned int systemType)
} }
} }
void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QString text)
{
Q_UNUSED(uasid);
Q_UNUSED(componentid);
Q_UNUSED(severity);
messageLabel->setText(text);
}
QGCToolBar::~QGCToolBar() QGCToolBar::~QGCToolBar()
{ {
delete toggleLoggingAction; delete toggleLoggingAction;
......
...@@ -50,6 +50,8 @@ public slots: ...@@ -50,6 +50,8 @@ public slots:
void updateName(const QString& name); void updateName(const QString& name);
/** @brief Set the MAV system type */ /** @brief Set the MAV system type */
void setSystemType(UASInterface* uas, unsigned int systemType); void setSystemType(UASInterface* uas, unsigned int systemType);
/** @brief Received system text message */
void receiveTextMessage(int uasid, int componentid, int severity, QString text);
protected: protected:
void createCustomWidgets(); void createCustomWidgets();
...@@ -63,7 +65,7 @@ protected: ...@@ -63,7 +65,7 @@ protected:
QLabel* stateLabel; QLabel* stateLabel;
QLabel* wpLabel; QLabel* wpLabel;
QLabel* distlabel; QLabel* distlabel;
QLabel* messageLabel;
}; };
#endif // QGCTOOLBAR_H #endif // QGCTOOLBAR_H
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