1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00

Fix compatibility for name field (#11980)

This commit is contained in:
haslinghuis 2022-11-14 05:08:16 +01:00 committed by GitHub
parent 7e2daacc6c
commit 2216b42dbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -1151,6 +1151,15 @@ static bool mspProcessOutCommand(mspDescriptor_t srcDesc, int16_t cmdMSP, sbuf_t
}
break;
case MSP_NAME:
{
const int nameLen = strlen(pilotConfig()->craftName);
for (int i = 0; i < nameLen; i++) {
sbufWriteU8(dst, pilotConfig()->craftName[i]);
}
}
break;
#ifdef USE_SERVOS
case MSP_SERVO:
sbufWriteData(dst, &servo, MAX_SUPPORTED_SERVOS * 2);
@ -3813,6 +3822,16 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
break;
#endif
case MSP_SET_NAME:
memset(pilotConfigMutable()->craftName, 0, ARRAYLEN(pilotConfig()->craftName));
for (unsigned int i = 0; i < MIN(MAX_NAME_LENGTH, dataSize); i++) {
pilotConfigMutable()->craftName[i] = sbufReadU8(src);
}
#ifdef USE_OSD
osdAnalyzeActiveElements();
#endif
break;
#ifdef USE_RTC_TIME
case MSP_SET_RTC:
{

View file

@ -101,6 +101,9 @@
#define MSP_BOARD_INFO 4 //out message
#define MSP_BUILD_INFO 5 //out message
#define MSP_NAME 10 //out message Returns user set board name - betaflight
#define MSP_SET_NAME 11 //in message Sets board name - betaflight
//
// MSP commands for Cleanflight original features
//