From b7b53399abd712476255c3b62099e04c65ba116d Mon Sep 17 00:00:00 2001 From: Vasyl Demianov Date: Fri, 2 Dec 2022 03:55:00 +0200 Subject: [PATCH] MSP messages to get and set PID and rate profile names. (#12020) * MSP messages to get and set PID and rate profile names. * Use MSP2_SET_TEXT and MSP2_GET_TEXT messages instead separate ones. --- src/main/msp/msp.c | 16 ++++++++++++++++ src/main/msp/msp_protocol_v2_betaflight.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/main/msp/msp.c b/src/main/msp/msp.c index 404a1cea1e..31be178d4b 100644 --- a/src/main/msp/msp.c +++ b/src/main/msp/msp.c @@ -2533,6 +2533,14 @@ static mspResult_e mspFcProcessOutCommandWithArg(mspDescriptor_t srcDesc, int16_ textVar = pilotConfigMutable()->craftName; break; + case MSP2TEXT_PID_PROFILE_NAME: + textVar = currentPidProfile->profileName; + break; + + case MSP2TEXT_RATE_PROFILE_NAME: + textVar = currentControlRateProfile->profileName; + break; + default: return MSP_RESULT_ERROR; } @@ -3927,6 +3935,14 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, textVar = pilotConfigMutable()->craftName; break; + case MSP2TEXT_PID_PROFILE_NAME: + textVar = currentPidProfile->profileName; + break; + + case MSP2TEXT_RATE_PROFILE_NAME: + textVar = currentControlRateProfile->profileName; + break; + default: return MSP_RESULT_ERROR; } diff --git a/src/main/msp/msp_protocol_v2_betaflight.h b/src/main/msp/msp_protocol_v2_betaflight.h index 8214bd6e29..f59d4a6128 100644 --- a/src/main/msp/msp_protocol_v2_betaflight.h +++ b/src/main/msp/msp_protocol_v2_betaflight.h @@ -30,3 +30,5 @@ // MSP2_SET_TEXT and MSP2_GET_TEXT variable types #define MSP2TEXT_PILOT_NAME 1 #define MSP2TEXT_CRAFT_NAME 2 +#define MSP2TEXT_PID_PROFILE_NAME 3 +#define MSP2TEXT_RATE_PROFILE_NAME 4