mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
LP-291 msp_send_analog(): Use OPLinkStatus.RSSI if applicable
This commit is contained in:
parent
26d63ee7ac
commit
5d72a9671c
@ -446,12 +446,33 @@ static void msp_send_analog(struct msp_bridge *m)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// OPLink supports RSSI reported in dBm, but updates different value in ReceiverStatus.Quality (link_quality - function of lost, repaired and good packet count).
|
||||
// We use same method as in Receiver module to decide if oplink is used for control:
|
||||
// Check for Throttle channel group, if this belongs to oplink, we will use oplink rssi instead of ReceiverStatus.Quality.
|
||||
|
||||
ManualControlSettingsChannelGroupsData channelGroups;
|
||||
ManualControlSettingsChannelGroupsGet(&channelGroups);
|
||||
|
||||
if(channelGroups.Throttle == MANUALCONTROLSETTINGS_CHANNELGROUPS_OPLINK)
|
||||
{
|
||||
int8_t rssi;
|
||||
OPLinkStatusRSSIGet(&rssi);
|
||||
|
||||
// oplink rssi - low: -127 noise floor (set by software when link is completely lost)
|
||||
// max: various articles found on web quote -10 as maximum received signal power expressed in dBm.
|
||||
// MSP values have no units, and OSD rssi display requires calibration anyway, so we will translate -127 to -10 -> 0-1023
|
||||
|
||||
data.status.rssi = ((127 + rssi) * 1023) / (127 - 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t quality;
|
||||
ReceiverStatusQualityGet(&quality);
|
||||
|
||||
// MSP RSSI's range is 0-1023
|
||||
|
||||
data.status.rssi = (quality * 1023) / 100;
|
||||
}
|
||||
|
||||
if (data.status.rssi > 1023) {
|
||||
data.status.rssi = 1023;
|
||||
@ -545,7 +566,7 @@ static void msp_send_comp_gps(struct msp_bridge *m)
|
||||
}
|
||||
|
||||
msp_send(m, MSP_COMP_GPS, data.buf, sizeof(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void msp_send_altitude(struct msp_bridge *m)
|
||||
@ -566,7 +587,7 @@ static void msp_send_altitude(struct msp_bridge *m)
|
||||
data.baro.alt = (int32_t)roundf(baro.Altitude * 100.0f);
|
||||
|
||||
msp_send(m, MSP_ALTITUDE, data.buf, sizeof(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PIOS_EXCLUDE_ADVANCED_FEATURES */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user