Browse Source

Only emit signals for valid ranges

QGC4.4
Lorenz Meier 11 years ago
parent
commit
a47942f54c
  1. 16
      src/uas/UAS.cc

16
src/uas/UAS.cc

@ -1005,13 +1005,21 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) @@ -1005,13 +1005,21 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
const unsigned int portWidth = 8; // XXX magic number
emit remoteControlRSSIChanged(channels.rssi/255.0f);
if (channels.chan1_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 0, channels.chan1_raw);
if (channels.chan2_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 1, channels.chan2_raw);
if (channels.chan3_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 2, channels.chan3_raw);
if (channels.chan4_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 3, channels.chan4_raw);
if (channels.chan5_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 4, channels.chan5_raw);
if (channels.chan6_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 5, channels.chan6_raw);
if (channels.chan7_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 6, channels.chan7_raw);
if (channels.chan8_raw != UINT16_MAX)
emit remoteControlChannelRawChanged(channels.port * portWidth + 7, channels.chan8_raw);
}
break;
@ -1023,13 +1031,21 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) @@ -1023,13 +1031,21 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
const unsigned int portWidth = 8; // XXX magic number
emit remoteControlRSSIChanged(channels.rssi/255.0f);
if (channels.chan1_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 0, channels.chan1_scaled/10000.0f);
if (channels.chan2_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 1, channels.chan2_scaled/10000.0f);
if (channels.chan3_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 2, channels.chan3_scaled/10000.0f);
if (channels.chan4_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 3, channels.chan4_scaled/10000.0f);
if (channels.chan5_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 4, channels.chan5_scaled/10000.0f);
if (channels.chan6_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 5, channels.chan6_scaled/10000.0f);
if (channels.chan7_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 6, channels.chan7_scaled/10000.0f);
if (channels.chan8_scaled != UINT16_MAX)
emit remoteControlChannelScaledChanged(channels.port * portWidth + 7, channels.chan8_scaled/10000.0f);
}
break;

Loading…
Cancel
Save