From f87e768ce677063e0bb07aea279d945d76087c88 Mon Sep 17 00:00:00 2001 From: Bas Delfos Date: Tue, 7 Nov 2017 20:54:45 +0100 Subject: [PATCH] Receive RSSI value via MSP/SmartPort --- src/main/fc/fc_msp.c | 11 +++++++++++ src/main/msp/msp_protocol.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index c8315d48c0..1a77b291ee 100644 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -1974,6 +1974,17 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src) break; #endif + case MSP_TX_INFO: + { + uint8_t rssi_tx = sbufReadU8(src); + // Ignore rssi from MSP when RSSI channel or RSSIPWM feature is enabled + if (rxConfig()->rssi_channel == 0 && !featureConfigured(FEATURE_RSSI_ADC)) { + // Range of rssi_tx is [1;100]. rssi should be in [0;1023]; + rssi = (uint16_t)((rssi_tx / 100.0f) * 1023.0f); + } + } + break; + default: // we do not know how to handle the (valid) message, indicate error MSP $M! return MSP_RESULT_ERROR; diff --git a/src/main/msp/msp_protocol.h b/src/main/msp/msp_protocol.h index 8028add4a5..63c5b4691b 100644 --- a/src/main/msp/msp_protocol.h +++ b/src/main/msp/msp_protocol.h @@ -230,6 +230,8 @@ #define MSP_BEEPER_CONFIG 184 #define MSP_SET_BEEPER_CONFIG 185 +#define MSP_TX_INFO 186 + // // Multwii original MSP commands //