Merge pull request #6784 from jflyper/bfdev-fix-generic-timer-channel-number-one-origin

GENERIC Fix origins for timer channel list
This commit is contained in:
Michael Keller 2018-10-01 00:44:06 +13:00 committed by GitHub
commit a8d874a458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -4109,7 +4109,7 @@ static void printTimer(uint8_t dumpMask)
cliDumpPrintLinef(dumpMask, false, format,
IO_GPIOPortIdxByTag(ioTag) + 'A',
IO_GPIOPinIdxByTag(ioTag),
timerIndex
timerIndex - 1
);
}
}
@ -4160,13 +4160,13 @@ static void cliTimer(char *cmdline)
if (pch) {
if (strcasecmp(pch, "list") == 0) {
/* output the list of available options */
uint8_t index = 1;
uint8_t index = 0;
for (unsigned i = 0; i < USABLE_TIMER_CHANNEL_COUNT; i++) {
if (timerHardware[i].tag == ioTag) {
cliPrintLinef("# %d. TIM%d CH%d",
index,
timerGetTIMNumber(timerHardware[i].tim),
CC_INDEX_FROM_CHANNEL(timerHardware[i].channel)
CC_INDEX_FROM_CHANNEL(timerHardware[i].channel) + 1
);
index++;
}
@ -4175,7 +4175,7 @@ static void cliTimer(char *cmdline)
} else if (strcasecmp(pch, "none") == 0) {
goto success;
} else {
timerIndex = atoi(pch);
timerIndex = atoi(pch) + 1;
}
} else {
goto error;

View File

@ -27,8 +27,6 @@
#ifdef USE_TIMER_MGMT
#define MAX_TIMER_PINMAP_COUNT 10
typedef struct timerIOConfig_s {
ioTag_t ioTag;
uint8_t index;
@ -36,4 +34,4 @@ typedef struct timerIOConfig_s {
PG_DECLARE_ARRAY(timerIOConfig_t, MAX_TIMER_PINMAP_COUNT, timerIOConfig);
#endif
#endif

View File

@ -269,3 +269,9 @@
#define MSC_BUTTON_IPU true
#endif
#endif
#ifdef USE_TIMER_MGMT
#ifndef MAX_TIMER_PINMAP_COUNT
#define MAX_TIMER_PINMAP_COUNT 21 // Largest known for F405RG (OMNINXT)
#endif
#endif