1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

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

View file

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

View file

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