Fixed 'showdefaults' option for CLI 'dump' / 'diff'.
This commit is contained in:
parent
411ffe06a8
commit
2afc011b16
|
@ -1407,26 +1407,26 @@ static void *getValuePointer(const clivalue_t *value)
|
|||
|
||||
static void dumpPgValue(const clivalue_t *value, uint8_t dumpMask)
|
||||
{
|
||||
const char *format = "set %s = ";
|
||||
const cliCurrentAndDefaultConfig_t *config = getCurrentAndDefaultConfigs(value->pgn);
|
||||
if (config->currentConfig == NULL || config->defaultConfig == NULL) {
|
||||
// has not been set up properly
|
||||
cliPrintf("VALUE %s ERROR\r\n", value->name);
|
||||
return;
|
||||
}
|
||||
|
||||
const char *format = "set %s = ";
|
||||
const char *defaultFormat = "#set %s = ";
|
||||
const int valueOffset = getValueOffset(value);
|
||||
switch (dumpMask & (DO_DIFF | SHOW_DEFAULTS)) {
|
||||
case DO_DIFF:
|
||||
if (valuePtrEqualsDefault(value->type, (uint8_t*)config->currentConfig + valueOffset, (uint8_t*)config->defaultConfig + valueOffset)) {
|
||||
break;
|
||||
const bool equalsDefault = valuePtrEqualsDefault(value->type, (uint8_t*)config->currentConfig + valueOffset, (uint8_t*)config->defaultConfig + valueOffset);
|
||||
if (((dumpMask & DO_DIFF) == 0) || !equalsDefault) {
|
||||
if (dumpMask & SHOW_DEFAULTS && !equalsDefault) {
|
||||
cliPrintf(defaultFormat, value->name);
|
||||
printValuePointer(value, (uint8_t*)config->defaultConfig + valueOffset, 0);
|
||||
cliPrint("\r\n");
|
||||
}
|
||||
// drop through, since not equal to default
|
||||
case 0:
|
||||
case SHOW_DEFAULTS:
|
||||
cliPrintf(format, value->name);
|
||||
printValuePointer(value, (uint8_t*)config->currentConfig + valueOffset, 0);
|
||||
cliPrint("\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue