Skip to content

Commit

Permalink
Update fc_msp.c
Browse files Browse the repository at this point in the history
- Add RSSI
- Allow extended versions of future MSP2_COMMON_SET_MSP_RC_LINK_STATS and MSP2_COMMON_SET_MSP_RC_INFO still work with older (from now) INAV versions. Except for the new data.
  • Loading branch information
MrD-RC committed Nov 3, 2024
1 parent 80c47fa commit a9f327f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/fc/fc_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2916,11 +2916,11 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)

#ifdef USE_RX_MSP
case MSP2_COMMON_SET_MSP_RC_LINK_STATS:
if (dataSize == 7) {
if (dataSize >= 7) {

This comment has been minimized.

Copy link
@olliw42

olliw42 Nov 3, 2024

I think th dataSize is still incorrect
this one will work but the message as defined by the reads to sbufReadUxx reads 8 bytes

This comment has been minimized.

Copy link
@MrD-RC

MrD-RC Nov 3, 2024

Author Collaborator

Yep, I missed that

uint8_t sublinkID = sbufReadU8(src); // Sublink ID
sbufReadU8(src); // Valid link (Failsafe backup)
if (sublinkID == 1) {
sbufReadU8(src); // RSSI %
setRSSIFromMSP(sbufReadU8(src)); // RSSI %
rxLinkStatistics.uplinkRSSI = -sbufReadU16(src);
rxLinkStatistics.downlinkLQ = sbufReadU8(src);
rxLinkStatistics.uplinkLQ = sbufReadU8(src);
Expand All @@ -2931,7 +2931,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
break;

case MSP2_COMMON_SET_MSP_RC_INFO:
if (dataSize == 15) {
if (dataSize >= 15) {

This comment has been minimized.

Copy link
@olliw42

olliw42 Nov 3, 2024

I think the dataSize is still incorrect
this message as defined by the reads to sbufReadUxx reads 13 bytes, so this here either shoudl be 13 or the "-1"'s in teh two for's should go.
IMHO

This comment has been minimized.

Copy link
@MrD-RC

MrD-RC Nov 3, 2024

Author Collaborator

This one looks fine to me. There is 10 bytes for the char arrays (band and mode). Plus 5 bytes of integers above the char arrays.

This comment has been minimized.

Copy link
@MrD-RC

MrD-RC Nov 3, 2024

Author Collaborator

Sorry, didn't see the - 1 in the for loops. Thank GitHub Copilot for that fuckup.

uint8_t sublinkID = sbufReadU8(src);

if (sublinkID == 1) {
Expand Down

0 comments on commit a9f327f

Please sign in to comment.