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

Method for adding defaults using defines for resources. (#12342)

* Method for adding defaults using defines for resources.

* As we will always be using the fullTimerHardware, we just need to configure the pin mapping.

This is done in the config.h as

#define TIMER_PIN_MAPPING   \
    TIMER_PIN_MAP(0, PA0, 1, 0) \
    TIMER_PIN_MAP(0, PA1, 1, 0)

timerHardware[] dependencies to be removed in another PR

* Adding missing pin definitions (removing dependency on timerHardware)

* Typo

* In case MOTOR1_PIN is not defined, but a motor is configured
This commit is contained in:
J Blackman 2023-02-12 14:06:49 +11:00 committed by GitHub
parent bb875cd0d6
commit 19f22f5120
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 72 additions and 39 deletions

View file

@ -294,10 +294,14 @@ void init(void)
targetConfiguration();
#endif
#ifdef USE_BRUSHED_ESC_AUTODETECT
#if defined(USE_BRUSHED_ESC_AUTODETECT)
// Opportunistically use the first motor pin of the default configuration for detection.
// We are doing this as with some boards, timing seems to be important, and the later detection will fail.
ioTag_t motorIoTag = timerioTagGetByUsage(TIM_USE_MOTOR, 0);
#if defined(MOTOR1_PIN)
ioTag_t motorIoTag = IO_TAG(MOTOR1_PIN);
#else
ioTag_t motorIoTag = IO_TAG_NONE;
#endif
if (motorIoTag) {
detectBrushedESC(motorIoTag);
@ -427,7 +431,7 @@ void init(void)
dbgPinInit();
#endif
#ifdef USE_BRUSHED_ESC_AUTODETECT
#if defined(USE_BRUSHED_ESC_AUTODETECT)
// Now detect again with the actually configured pin for motor 1, if it is not the default pin.
ioTag_t configuredMotorIoTag = motorConfig()->dev.ioTags[0];