Merge pull request #3276 from mikeller/fix_cli_dump_resources
Fixed dump of resources in CLI.
This commit is contained in:
commit
2e4184dc6d
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue