1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Flash - Fix incorrect gating on cli flash commands. (#12013)

* Flash - Fix incorrect gating on cli flash commands.

When compiling with USE_FLASH_CHIP and without USE_FLASHFS there were
compiler warnings.

* Fix typo in `flash_info` cli command output.
This commit is contained in:
Dominic Clifton 2022-11-22 18:05:10 +01:00 committed by GitHub
parent dc05fb6ea6
commit 8eb7209cdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2448,7 +2448,7 @@ static void cliSdInfo(const char *cmdName, char *cmdline)
#endif #endif
#ifdef USE_FLASHFS #ifdef USE_FLASH_CHIP
static void cliFlashInfo(const char *cmdName, char *cmdline) static void cliFlashInfo(const char *cmdName, char *cmdline)
{ {
UNUSED(cmdName); UNUSED(cmdName);
@ -2462,7 +2462,7 @@ static void cliFlashInfo(const char *cmdName, char *cmdline)
for (uint8_t index = 0; index < FLASH_MAX_PARTITIONS; index++) { for (uint8_t index = 0; index < FLASH_MAX_PARTITIONS; index++) {
const flashPartition_t *partition; const flashPartition_t *partition;
if (index == 0) { if (index == 0) {
cliPrintLine("Paritions:"); cliPrintLine("Partitions:");
} }
partition = flashPartitionFindByIndex(index); partition = flashPartitionFindByIndex(index);
if (!partition) { if (!partition) {
@ -2470,15 +2470,18 @@ static void cliFlashInfo(const char *cmdName, char *cmdline)
} }
cliPrintLinef(" %d: %s %u %u", index, flashPartitionGetTypeName(partition->type), partition->startSector, partition->endSector); cliPrintLinef(" %d: %s %u %u", index, flashPartitionGetTypeName(partition->type), partition->startSector, partition->endSector);
} }
#ifdef USE_FLASHFS
const flashPartition_t *flashPartition = flashPartitionFindByType(FLASH_PARTITION_TYPE_FLASHFS); const flashPartition_t *flashPartition = flashPartitionFindByType(FLASH_PARTITION_TYPE_FLASHFS);
cliPrintLinef("FlashFS size=%u, usedSize=%u", cliPrintLinef("FlashFS size=%u, usedSize=%u",
FLASH_PARTITION_SECTOR_COUNT(flashPartition) * layout->sectorSize, FLASH_PARTITION_SECTOR_COUNT(flashPartition) * layout->sectorSize,
flashfsGetOffset() flashfsGetOffset()
); );
#endif
} }
#endif // USE_FLASH_CHIP
#ifdef USE_FLASHFS
static void cliFlashErase(const char *cmdName, char *cmdline) static void cliFlashErase(const char *cmdName, char *cmdline)
{ {
UNUSED(cmdName); UNUSED(cmdName);
@ -6506,10 +6509,12 @@ const clicmd_t cmdTable[] = {
CLI_COMMAND_DEF("feature", "configure features", CLI_COMMAND_DEF("feature", "configure features",
"list\r\n" "list\r\n"
"\t<->[name]", cliFeature), "\t<->[name]", cliFeature),
#ifdef USE_FLASH_CHIP
#ifdef USE_FLASHFS #ifdef USE_FLASHFS
CLI_COMMAND_DEF("flash_erase", "erase flash chip", NULL, cliFlashErase), CLI_COMMAND_DEF("flash_erase", "erase flash chip", NULL, cliFlashErase),
#endif
CLI_COMMAND_DEF("flash_info", "show flash chip info", NULL, cliFlashInfo), CLI_COMMAND_DEF("flash_info", "show flash chip info", NULL, cliFlashInfo),
#ifdef USE_FLASH_TOOLS #if defined(USE_FLASH_TOOLS) && defined(USE_FLASHFS)
CLI_COMMAND_DEF("flash_read", NULL, "<length> <address>", cliFlashRead), CLI_COMMAND_DEF("flash_read", NULL, "<length> <address>", cliFlashRead),
CLI_COMMAND_DEF("flash_scan", "scan flash device for errors", NULL, cliFlashVerify), CLI_COMMAND_DEF("flash_scan", "scan flash device for errors", NULL, cliFlashVerify),
CLI_COMMAND_DEF("flash_write", NULL, "<address> <message>", cliFlashWrite), CLI_COMMAND_DEF("flash_write", NULL, "<address> <message>", cliFlashWrite),