AP_RSSI: fixed build warnings

This commit is contained in:
Andrew Tridgell 2018-10-12 10:44:00 +11:00
parent 9e17275488
commit 672b4be3d2
1 changed files with 3 additions and 3 deletions

View File

@ -190,11 +190,11 @@ float AP_RSSI::read_pin_rssi()
// read the RSSI value from a PWM value on a RC channel
float AP_RSSI::read_channel_rssi()
{
RC_Channel *ch = rc().channel(rssi_channel-1);
if (ch == nullptr) {
RC_Channel *c = rc().channel(rssi_channel-1);
if (c == nullptr) {
return 0.0f;
}
uint16_t rssi_channel_value = ch->get_radio_in();
uint16_t rssi_channel_value = c->get_radio_in();
float channel_rssi = scale_and_constrain_float_rssi(rssi_channel_value, rssi_channel_low_pwm_value, rssi_channel_high_pwm_value);
return channel_rssi;
}