diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc
index 09d6fa96e433c92f897eb3217a73dc7da13a142f..d41e946be612593889b4866babd0f105146558b7 100644
--- a/src/comm/SerialLink.cc
+++ b/src/comm/SerialLink.cc
@@ -187,6 +187,7 @@ void SerialLink::readBytes()
const qint64 maxLength = 2048;
char data[maxLength];
qint64 numBytes = port->bytesAvailable();
+
if(numBytes > 0)
{
/* Read as much data in buffer as possible without overflow */
diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc
index 3b4f136189ef183b5cbed875b720ab93af2a6831..67a6bd56d6bf68455a1cdf6f87b1317f0812edcd 100644
--- a/src/uas/UAS.cc
+++ b/src/uas/UAS.cc
@@ -881,13 +881,12 @@ void UAS::readParametersFromStorage()
void UAS::enableAllDataTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
// 0 is a magic ID and will enable/disable the standard message set except for heartbeat
- stream.req_stream_id = 0;
+ stream.req_stream_id = MAV_DATA_STREAM_ALL;
// Select the update rate in Hz the message should be send
// All messages will be send with their default rate
stream.req_message_rate = 0;
@@ -902,17 +901,15 @@ void UAS::enableAllDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableRawSensorDataTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 1;
+ stream.req_stream_id = MAV_DATA_STREAM_RAW_SENSORS;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -926,17 +923,15 @@ void UAS::enableRawSensorDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableExtendedSystemStatusTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 2;
+ stream.req_stream_id = MAV_DATA_STREAM_EXTENDED_STATUS;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 10;
// Start / stop the message
@@ -950,17 +945,19 @@ void UAS::enableExtendedSystemStatusTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableRCChannelDataTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
- // Buffers to write data to
+#if defined(MAVLINK_ENABLED_UALBERTA_MESSAGES)
+ mavlink_message_t msg;
+ mavlink_msg_request_rc_channels_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, enabled);
+ sendMessage(msg);
+#else
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 3;
+ stream.req_stream_id = MAV_DATA_STREAM_RC_CHANNELS;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -974,21 +971,16 @@ void UAS::enableRCChannelDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#elif defined(MAVLINK_ENABLED_UALBERTA_MESSAGES)
- mavlink_message_t msg;
- mavlink_msg_request_rc_channels_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, enabled);
- sendMessage(msg);
#endif
}
void UAS::enableRawControllerDataTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 4;
+ stream.req_stream_id = MAV_DATA_STREAM_RAW_CONTROLLER;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -1002,17 +994,15 @@ void UAS::enableRawControllerDataTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableRawSensorFusionTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 5;
+ stream.req_stream_id = MAV_DATA_STREAM_RAW_SENSOR_FUSION;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -1026,17 +1016,15 @@ void UAS::enableRawSensorFusionTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enablePositionTransmission(bool enabled)
{
-#ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 6;
+ stream.req_stream_id = MAV_DATA_STREAM_POSITION;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -1050,17 +1038,15 @@ void UAS::enablePositionTransmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableExtra1Transmission(bool enabled)
{
- #ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 7;
+ stream.req_stream_id = MAV_DATA_STREAM_EXTRA1;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -1074,17 +1060,15 @@ void UAS::enableExtra1Transmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableExtra2Transmission(bool enabled)
{
- #ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 8;
+ stream.req_stream_id = MAV_DATA_STREAM_EXTRA2;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -1098,17 +1082,15 @@ void UAS::enableExtra2Transmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
void UAS::enableExtra3Transmission(bool enabled)
{
- #ifdef MAVLINK_ENABLED_PIXHAWK
// Buffers to write data to
mavlink_message_t msg;
mavlink_request_data_stream_t stream;
// Select the message to request from now on
- stream.req_stream_id = 9;
+ stream.req_stream_id = MAV_DATA_STREAM_EXTRA3;
// Select the update rate in Hz the message should be send
stream.req_message_rate = 200;
// Start / stop the message
@@ -1122,7 +1104,6 @@ void UAS::enableExtra3Transmission(bool enabled)
// Send message twice to increase chance of reception
sendMessage(msg);
sendMessage(msg);
-#endif
}
/**
diff --git a/src/ui/QGCSensorSettingsWidget.cc b/src/ui/QGCSensorSettingsWidget.cc
index 756dc3d8beb7e7ae681b4bbc82905e3f18757be4..28421163499eea0d60d136c74dacc655ad0c4f3b 100644
--- a/src/ui/QGCSensorSettingsWidget.cc
+++ b/src/ui/QGCSensorSettingsWidget.cc
@@ -37,7 +37,6 @@ QGCSensorSettingsWidget::QGCSensorSettingsWidget(UASInterface* uas, QWidget *par
ui(new Ui::QGCSensorSettingsWidget)
{
ui->setupUi(this);
-
connect(ui->sendRawCheckBox, SIGNAL(toggled(bool)), mav, SLOT(enableRawSensorDataTransmission(bool)));
connect(ui->sendControllerCheckBox, SIGNAL(toggled(bool)), mav, SLOT(enableRawControllerDataTransmission(bool)));
connect(ui->sendExtendedCheckBox, SIGNAL(toggled(bool)), mav, SLOT(enableExtendedSystemStatusTransmission(bool)));
diff --git a/src/ui/QGCSensorSettingsWidget.ui b/src/ui/QGCSensorSettingsWidget.ui
index 40be710d9afa9c9472a8f347ce6507a3e4c87f8f..117a68bb90a50bcc3e3fc3f6fcd57d62800ad8ba 100644
--- a/src/ui/QGCSensorSettingsWidget.ui
+++ b/src/ui/QGCSensorSettingsWidget.ui
@@ -98,13 +98,25 @@
-
+
+ true
+
RAW Sensor Data
+
+ false
+
+
+ false
+
-
+
+ true
+
RC Values