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

Add timer info to CLI 'timer' command.

This commit is contained in:
mikeller 2019-05-20 00:18:01 +12:00
parent b1d1fba775
commit f169176022

View file

@ -5230,11 +5230,22 @@ static void printTimerDetails(const ioTag_t ioTag, const unsigned timerIndex, co
const char *emptyFormat = "timer %c%02d NONE"; const char *emptyFormat = "timer %c%02d NONE";
if (timerIndex > 0) { if (timerIndex > 0) {
printValue(dumpMask, equalsDefault, format, const bool printDetails = printValue(dumpMask, equalsDefault, format,
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPortIdxByTag(ioTag) + 'A',
IO_GPIOPinIdxByTag(ioTag), IO_GPIOPinIdxByTag(ioTag),
timerIndex - 1 timerIndex - 1
); );
if (printDetails) {
const timerHardware_t *timer = timerGetByTagAndIndex(ioTag, timerIndex);
printValue(dumpMask, false,
"# pin %c%02d: TIM%d CH%d%s (AF%d)",
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag),
timerGetTIMNumber(timer->tim),
CC_INDEX_FROM_CHANNEL(timer->channel) + 1,
timer->output & TIMER_OUTPUT_N_CHANNEL ? "N" : "",
timer->alternateFunction
);
}
} else { } else {
printValue(dumpMask, equalsDefault, emptyFormat, printValue(dumpMask, equalsDefault, emptyFormat,
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPortIdxByTag(ioTag) + 'A',
@ -5366,10 +5377,12 @@ static void cliTimer(char *cmdline)
/* output the list of available options */ /* output the list of available options */
const timerHardware_t *timer; const timerHardware_t *timer;
for (unsigned index = 0; (timer = timerGetByTagAndIndex(ioTag, index + 1)); index++) { for (unsigned index = 0; (timer = timerGetByTagAndIndex(ioTag, index + 1)); index++) {
cliPrintLinef("# %d: TIM%d CH%d", cliPrintLinef("# %d: TIM%d CH%d%s (AF%d)",
index, index,
timerGetTIMNumber(timer->tim), timerGetTIMNumber(timer->tim),
CC_INDEX_FROM_CHANNEL(timer->channel) + 1 CC_INDEX_FROM_CHANNEL(timer->channel) + 1,
timer->output & TIMER_OUTPUT_N_CHANNEL ? "N" : "",
timer->alternateFunction
); );
} }