diff --git a/src/main/cli/cli.c b/src/main/cli/cli.c index c770ea4cc2..eae7a8153d 100644 --- a/src/main/cli/cli.c +++ b/src/main/cli/cli.c @@ -5412,6 +5412,23 @@ static void cliTimer(char *cmdline) return; } else if (strcasecmp(pch, "none") == 0) { timerIndex = TIMER_INDEX_UNDEFINED; + } else if (strncasecmp(pch, "af", 2) == 0) { + unsigned alternateFunction = atoi(&pch[2]); + + const timerHardware_t *timer; + for (unsigned index = 0; (timer = timerGetByTagAndIndex(ioTag, index + 1)); index++) { + if (timer->alternateFunction == alternateFunction) { + timerIndex = index; + + break; + } + } + + if (!timer) { + cliPrintErrorLinef("INVALID ALTERNATE FUNCTION FOR %c%02d: '%s'", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), pch); + + return; + } } else { timerIndex = atoi(pch); @@ -5906,7 +5923,7 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks), #endif #ifdef USE_TIMER_MGMT - CLI_COMMAND_DEF("timer", "show/set timers", "<> | list | [