mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 20:10:18 +03:00
Fix origins for timer channel list
Selection is zero origin Channel number is one origin for user I/O
This commit is contained in:
parent
c2747eed94
commit
0ff2d864b4
3 changed files with 11 additions and 7 deletions
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue