Output more information in MSP_BOARD_INFO (#5206)

* Append the target name to the response of MSP_BOARD_INFO

This allows MSP clients to retrieve the actual target name, which
is useful for e.g. automatically upgrading the firmware on a board
without asking the user to select the target manually or to present
a warning dialog if we detect the user has chosen the wrong target.

* Output wether a board uses VCP in MSP_BOARD_INFO

This allows the configurator to detect if the board uses VCP
without using an external list of boards.

* Use a single bit to output wether the board uses VCP

This lets us use the remaining 7 bits for other flags.
Also, output if the board has softserial support using the next
bit.
This commit is contained in:
Alberto García Hierro 2018-03-03 22:38:30 +00:00 committed by Michael Keller
parent 43d8f67db2
commit 88dcaa95ef
1 changed files with 17 additions and 0 deletions

View File

@ -412,6 +412,7 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
break;
case MSP_BOARD_INFO:
{
sbufWriteData(dst, systemConfig()->boardIdentifier, BOARD_IDENTIFIER_LENGTH);
#ifdef USE_HARDWARE_REVISION_DETECTION
sbufWriteU16(dst, hardwareRevision);
@ -427,7 +428,23 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
sbufWriteU8(dst, 0); // 0 == FC
#endif
#endif
// Board communication capabilities (uint8)
// Bit 0: 1 iff the board has VCP
// Bit 1: 1 iff the board supports software serial
uint8_t commCapabilities = 0;
#ifdef USE_VCP
commCapabilities |= 1 << 0;
#endif
#if defined(USE_SOFTSERIAL1) || defined(USE_SOFTSERIAL2)
commCapabilities |= 1 << 1;
#endif
sbufWriteU8(dst, commCapabilities);
// Target name with explicit length
sbufWriteU8(dst, strlen(targetName));
sbufWriteData(dst, targetName, strlen(targetName));
break;
}
case MSP_BUILD_INFO:
sbufWriteData(dst, buildDate, BUILD_DATE_LENGTH);