Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
- Set base sublink ID to 0
- changed RSSI dB to uint8 as 16 is not needed
- Added constraint to ensure that RSSI % is between 0 and 100
  • Loading branch information
MrD-RC committed Nov 3, 2024
1 parent b48d7c8 commit 1028753
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2916,12 +2916,12 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)

#ifdef USE_RX_MSP
case MSP2_COMMON_SET_MSP_RC_LINK_STATS:
if (dataSize >= 8) {
if (dataSize >= 7) {
uint8_t sublinkID = sbufReadU8(src); // Sublink ID
sbufReadU8(src); // Valid link (Failsafe backup)
if (sublinkID == 1) {
if (sublinkID == 0) {
setRSSIFromMSP_RC(sbufReadU8(src)); // RSSI %
rxLinkStatistics.uplinkRSSI = -sbufReadU16(src);
rxLinkStatistics.uplinkRSSI = -sbufReadU8(src);
rxLinkStatistics.downlinkLQ = sbufReadU8(src);
rxLinkStatistics.uplinkLQ = sbufReadU8(src);
rxLinkStatistics.uplinkSNR = sbufReadI8(src);
Expand All @@ -2934,7 +2934,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
if (dataSize >= 15) {
uint8_t sublinkID = sbufReadU8(src);

if (sublinkID == 1) {
if (sublinkID == 0) {
rxLinkStatistics.uplinkTXPower = sbufReadU16(src);
rxLinkStatistics.downlinkTXPower = sbufReadU16(src);

Expand Down
2 changes: 1 addition & 1 deletion src/main/rx/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ void setRSSIFromMSP_RC(uint8_t newMspRssi)
}

if (activeRssiSource == RSSI_SOURCE_MSP) {
rssi = constrain(scaleRange(newMspRssi, 0, 100, 0, RSSI_MAX_VALUE), 0, RSSI_MAX_VALUE);
rssi = constrain(scaleRange(constrain(newMspRssi, 0, 100), 0, 100, 0, RSSI_MAX_VALUE), 0, RSSI_MAX_VALUE);
lastMspRssiUpdateUs = micros();
}
}
Expand Down

0 comments on commit 1028753

Please sign in to comment.