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

Fixed dump of resources in CLI.

This commit is contained in:
mikeller 2017-06-14 00:16:07 +12:00
parent a673d1be54
commit fd79841ffc

View file

@ -130,6 +130,8 @@ static uint8_t cliWriteBuffer[sizeof(*cliWriter) + 128];
static char cliBuffer[64];
static uint32_t bufferIndex = 0;
static bool configIsInCopy = false;
static const char* const emptyName = "-";
#ifndef USE_QUAD_MIXER_ONLY
@ -2761,15 +2763,15 @@ static void printResource(uint8_t dumpMask)
{
for (unsigned int i = 0; i < ARRAYLEN(resourceTable); i++) {
const char* owner = ownerNames[resourceTable[i].owner];
const pgRegistry_t* pg = pgFind(resourceTable[i].pgn);
const void *currentConfig;
const void *defaultConfig;
if (dumpMask & DO_DIFF || dumpMask & SHOW_DEFAULTS) {
const pgRegistry_t* pg = pgFind(resourceTable[i].pgn);
if (configIsInCopy) {
currentConfig = pg->copy;
defaultConfig = pg->address;
} else { // Not guaranteed to have initialised default configs in this case
currentConfig = pgFind(resourceTable[i].pgn)->address;
defaultConfig = currentConfig;
} else {
currentConfig = pg->address;
defaultConfig = NULL;
}
for (int index = 0; index < MAX_RESOURCE_INDEX(resourceTable[i].maxIndex); index++) {
@ -2978,6 +2980,8 @@ static void backupConfigs(void)
memcpy(pg->copy, pg->address, pg->size);
}
}
configIsInCopy = true;
}
static void restoreConfigs(void)
@ -2989,6 +2993,8 @@ static void restoreConfigs(void)
memcpy(pg->address, pg->copy, pg->size);
}
}
configIsInCopy = false;
}
static void printConfig(char *cmdline, bool doDiff)