1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 01:05:27 +03:00

Fixed printing of reset DMA options in 'diff'. (#8303)

Fixed printing of reset DMA options in 'diff'.
This commit is contained in:
Michael Keller 2019-05-20 20:02:04 +12:00 committed by mikeller
parent 2550221e12
commit 8824317749

View file

@ -4792,7 +4792,7 @@ static void printTimerDmaoptDetails(const ioTag_t ioTag, const timerHardware_t *
}
}
static void printTimerDmaopt(const timerIOConfig_t *currentConfig, const timerIOConfig_t *defaultConfig, unsigned index, dumpFlags_t dumpMask, bool defaultIsUsed[])
static void printTimerDmaopt(const timerIOConfig_t *currentConfig, const timerIOConfig_t *defaultConfig, unsigned index, dumpFlags_t dumpMask, bool tagsInUse[])
{
const ioTag_t ioTag = currentConfig[index].ioTag;
@ -4804,19 +4804,22 @@ static void printTimerDmaopt(const timerIOConfig_t *currentConfig, const timerIO
const dmaoptValue_t dmaopt = currentConfig[index].dmaopt;
dmaoptValue_t defaultDmaopt = DMA_OPT_UNUSED;
bool equalsDefault = defaultDmaopt == dmaopt;
if (defaultConfig) {
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
if (defaultConfig[i].ioTag == ioTag) {
defaultDmaopt = defaultConfig[index].dmaopt;
defaultIsUsed[index] = true;
defaultDmaopt = defaultConfig[i].dmaopt;
// We need to check timer as well here to get 'default' DMA options for non-default timers printed, because setting the timer resets the DMA option.
equalsDefault = (defaultDmaopt == dmaopt) && (defaultConfig[i].index == currentConfig[index].index || dmaopt == DMA_OPT_UNUSED);
tagsInUse[index] = true;
break;
}
}
}
const bool equalsDefault = defaultDmaopt == dmaopt;
if (defaultConfig) {
printTimerDmaoptDetails(ioTag, timer, defaultDmaopt, equalsDefault, dumpMask, cliDefaultPrintLinef);
}
@ -4847,14 +4850,14 @@ static void printDmaopt(dumpFlags_t dumpMask)
defaultConfig = NULL;
}
bool defaultIsUsed[MAX_TIMER_PINMAP_COUNT] = { false };
bool tagsInUse[MAX_TIMER_PINMAP_COUNT] = { false };
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
printTimerDmaopt(currentConfig, defaultConfig, i, dumpMask, defaultIsUsed);
printTimerDmaopt(currentConfig, defaultConfig, i, dumpMask, tagsInUse);
}
if (defaultConfig) {
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
if (!defaultIsUsed[i] && defaultConfig[i].ioTag && defaultConfig[i].dmaopt != DMA_OPT_UNUSED) {
if (!tagsInUse[i] && defaultConfig[i].ioTag && defaultConfig[i].dmaopt != DMA_OPT_UNUSED) {
const timerHardware_t *timer = timerGetByTagAndIndex(defaultConfig[i].ioTag, defaultConfig[i].index);
printTimerDmaoptDetails(defaultConfig[i].ioTag, timer, defaultConfig[i].dmaopt, false, dumpMask, cliDefaultPrintLinef);
@ -5157,7 +5160,7 @@ static void printTimer(dumpFlags_t dumpMask)
defaultConfig = NULL;
}
bool defaultIsUsed[MAX_TIMER_PINMAP_COUNT] = { false };
bool tagsInUse[MAX_TIMER_PINMAP_COUNT] = { false };
for (unsigned int i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
const ioTag_t ioTag = currentConfig[i].ioTag;
@ -5172,7 +5175,7 @@ static void printTimer(dumpFlags_t dumpMask)
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
if (defaultConfig[i].ioTag == ioTag) {
defaultTimerIndex = defaultConfig[i].index;
defaultIsUsed[i] = true;
tagsInUse[i] = true;
break;
}
@ -5190,7 +5193,7 @@ static void printTimer(dumpFlags_t dumpMask)
if (defaultConfig) {
for (unsigned i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
if (!defaultIsUsed[i] && defaultConfig[i].ioTag) {
if (!tagsInUse[i] && defaultConfig[i].ioTag) {
printTimerDetails(defaultConfig[i].ioTag, defaultConfig[i].index, false, dumpMask, cliDefaultPrintLinef);
printTimerDetails(defaultConfig[i].ioTag, 0, false, dumpMask, cliDumpPrintLinef);