mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 04:15:44 +03:00
Fixes from review.
This commit is contained in:
parent
b4c44d8a46
commit
432f330e60
3 changed files with 19 additions and 19 deletions
|
@ -47,12 +47,12 @@ void initBoardInformation(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getManufacturerId(void)
|
const char *getManufacturerId(void)
|
||||||
{
|
{
|
||||||
return manufacturerId;
|
return manufacturerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getBoardName(void)
|
const char *getBoardName(void)
|
||||||
{
|
{
|
||||||
return boardName;
|
return boardName;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ bool boardInformationIsSet(void)
|
||||||
return boardInformationSet;
|
return boardInformationSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setManufacturerId(char *newManufacturerId)
|
bool setManufacturerId(const char *newManufacturerId)
|
||||||
{
|
{
|
||||||
if (!boardInformationSet) {
|
if (!boardInformationSet) {
|
||||||
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
strncpy(manufacturerId, newManufacturerId, MAX_MANUFACTURER_ID_LENGTH);
|
||||||
|
@ -73,7 +73,7 @@ bool setManufacturerId(char *newManufacturerId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setBoardName(char *newBoardName)
|
bool setBoardName(const char *newBoardName)
|
||||||
{
|
{
|
||||||
if (!boardInformationSet) {
|
if (!boardInformationSet) {
|
||||||
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
|
strncpy(boardName, newBoardName, MAX_BOARD_NAME_LENGTH);
|
||||||
|
@ -100,7 +100,7 @@ bool persistBoardInformation(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_SIGNATURE)
|
#if defined(USE_SIGNATURE)
|
||||||
uint8_t *getSignature(void)
|
const uint8_t *getSignature(void)
|
||||||
{
|
{
|
||||||
return signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ bool signatureIsSet(void)
|
||||||
return signatureSet;
|
return signatureSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setSignature(uint8_t *newSignature)
|
bool setSignature(const uint8_t *newSignature)
|
||||||
{
|
{
|
||||||
if (!signatureSet) {
|
if (!signatureSet) {
|
||||||
memcpy(signature, newSignature, SIGNATURE_LENGTH);
|
memcpy(signature, newSignature, SIGNATURE_LENGTH);
|
||||||
|
|
|
@ -2323,11 +2323,7 @@ static void cliMcuId(char *cmdline)
|
||||||
{
|
{
|
||||||
UNUSED(cmdline);
|
UNUSED(cmdline);
|
||||||
|
|
||||||
cliPrint("mcu_id 0x");
|
cliPrintLinef("mcu_id %08x%08x%08x", U_ID_0, U_ID_1, U_ID_2);
|
||||||
cliPrintf("%08x", U_ID_0);
|
|
||||||
cliPrintf("%08x", U_ID_1);
|
|
||||||
cliPrintf("%08x", U_ID_2);
|
|
||||||
cliPrintLinefeed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printFeature(uint8_t dumpMask, const featureConfig_t *featureConfig, const featureConfig_t *featureConfigDefault)
|
static void printFeature(uint8_t dumpMask, const featureConfig_t *featureConfig, const featureConfig_t *featureConfigDefault)
|
||||||
|
|
|
@ -464,12 +464,12 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
|
||||||
// Board name with explicit length
|
// Board name with explicit length
|
||||||
char *value = getBoardName();
|
char *value = getBoardName();
|
||||||
sbufWriteU8(dst, strlen(value));
|
sbufWriteU8(dst, strlen(value));
|
||||||
sbufWriteData(dst, value, strlen(value));
|
sbufWriteString(dst, value);
|
||||||
|
|
||||||
// Manufacturer id with explicit length
|
// Manufacturer id with explicit length
|
||||||
value = getManufacturerId();
|
value = getManufacturerId();
|
||||||
sbufWriteU8(dst, strlen(value));
|
sbufWriteU8(dst, strlen(value));
|
||||||
sbufWriteData(dst, value, strlen(value));
|
sbufWriteString(dst, value);
|
||||||
|
|
||||||
#if defined(USE_SIGNATURE)
|
#if defined(USE_SIGNATURE)
|
||||||
// Signature
|
// Signature
|
||||||
|
@ -2078,16 +2078,20 @@ static mspResult_e mspProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
||||||
#if defined(USE_BOARD_INFO)
|
#if defined(USE_BOARD_INFO)
|
||||||
case MSP_SET_BOARD_INFO:
|
case MSP_SET_BOARD_INFO:
|
||||||
if (!boardInformationIsSet()) {
|
if (!boardInformationIsSet()) {
|
||||||
char boardName[MAX_BOARD_NAME_LENGTH + 1] = {0};
|
|
||||||
char manufacturerId[MAX_MANUFACTURER_ID_LENGTH + 1] = {0};
|
|
||||||
uint8_t length = sbufReadU8(src);
|
uint8_t length = sbufReadU8(src);
|
||||||
for (unsigned int i = 0; i < length; i++) {
|
char boardName[MAX_BOARD_NAME_LENGTH + 1];
|
||||||
boardName[i] = sbufReadU8(src);
|
sbufReadData(src, boardName, MIN(length, MAX_BOARD_NAME_LENGTH));
|
||||||
|
if (length > MAX_BOARD_NAME_LENGTH) {
|
||||||
|
sbufAdvance(src, length - MAX_BOARD_NAME_LENGTH);
|
||||||
}
|
}
|
||||||
|
boardName[length] = '\0';
|
||||||
length = sbufReadU8(src);
|
length = sbufReadU8(src);
|
||||||
for (unsigned int i = 0; i < length; i++) {
|
char manufacturerId[MAX_MANUFACTURER_ID_LENGTH + 1];
|
||||||
manufacturerId[i] = sbufReadU8(src);
|
sbufReadData(src, manufacturerId, MIN(length, MAX_MANUFACTURER_ID_LENGTH));
|
||||||
|
if (length > MAX_MANUFACTURER_ID_LENGTH) {
|
||||||
|
sbufAdvance(src, length - MAX_MANUFACTURER_ID_LENGTH);
|
||||||
}
|
}
|
||||||
|
manufacturerId[length] = '\0';
|
||||||
|
|
||||||
setBoardName(boardName);
|
setBoardName(boardName);
|
||||||
setManufacturerId(manufacturerId);
|
setManufacturerId(manufacturerId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue