mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 13:25:30 +03:00
Fix: CRSFv3 uplink RSSI percentage scaling to match internal 0...1023 range
This commit is contained in:
parent
12a4016ff0
commit
11a6f73e09
1 changed files with 7 additions and 7 deletions
|
@ -278,7 +278,7 @@ static void handleCrsfLinkStatisticsTxFrame(const crsfLinkStatisticsTx_t* statsP
|
||||||
lastLinkStatisticsFrameUs = currentTimeUs;
|
lastLinkStatisticsFrameUs = currentTimeUs;
|
||||||
int16_t rssiDbm = -1 * stats.uplink_RSSI;
|
int16_t rssiDbm = -1 * stats.uplink_RSSI;
|
||||||
if (rssiSource == RSSI_SOURCE_RX_PROTOCOL_CRSF) {
|
if (rssiSource == RSSI_SOURCE_RX_PROTOCOL_CRSF) {
|
||||||
const uint16_t rssiPercentScaled = stats.uplink_RSSI_percentage;
|
const uint16_t rssiPercentScaled = scaleRange(stats.uplink_RSSI_percentage, 0, 100, 0, RSSI_MAX_VALUE);
|
||||||
setRssi(rssiPercentScaled, RSSI_SOURCE_RX_PROTOCOL_CRSF);
|
setRssi(rssiPercentScaled, RSSI_SOURCE_RX_PROTOCOL_CRSF);
|
||||||
}
|
}
|
||||||
#ifdef USE_RX_RSSI_DBM
|
#ifdef USE_RX_RSSI_DBM
|
||||||
|
@ -634,13 +634,13 @@ bool crsfRxInit(const rxConfig_t *rxConfig, rxRuntimeState_t *rxRuntimeState)
|
||||||
CRSF_PORT_OPTIONS | (rxConfig->serialrx_inverted ? SERIAL_INVERTED : 0)
|
CRSF_PORT_OPTIONS | (rxConfig->serialrx_inverted ? SERIAL_INVERTED : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rssiSource == RSSI_SOURCE_NONE) {
|
if (rssiSource == RSSI_SOURCE_NONE) {
|
||||||
rssiSource = RSSI_SOURCE_RX_PROTOCOL_CRSF;
|
rssiSource = RSSI_SOURCE_RX_PROTOCOL_CRSF;
|
||||||
}
|
}
|
||||||
#ifdef USE_RX_LINK_QUALITY_INFO
|
#ifdef USE_RX_LINK_QUALITY_INFO
|
||||||
if (linkQualitySource == LQ_SOURCE_NONE) {
|
if (linkQualitySource == LQ_SOURCE_NONE) {
|
||||||
linkQualitySource = LQ_SOURCE_RX_PROTOCOL_CRSF;
|
linkQualitySource = LQ_SOURCE_RX_PROTOCOL_CRSF;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return serialPort != NULL;
|
return serialPort != NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue