mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 05:45:31 +03:00
Fixed detection of brushless / brushed motors.
This commit is contained in:
parent
29db27584f
commit
acf759b82e
11 changed files with 44 additions and 27 deletions
|
@ -261,7 +261,13 @@ void init(void)
|
|||
#endif
|
||||
|
||||
#ifdef USE_BRUSHED_ESC_AUTODETECT
|
||||
detectBrushedESC();
|
||||
// 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 (motorIoTag) {
|
||||
detectBrushedESC(motorIoTag);
|
||||
}
|
||||
#endif
|
||||
|
||||
initEEPROM();
|
||||
|
@ -280,6 +286,15 @@ void init(void)
|
|||
|
||||
systemState |= SYSTEM_STATE_CONFIG_LOADED;
|
||||
|
||||
#ifdef 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];
|
||||
|
||||
if (configuredMotorIoTag && configuredMotorIoTag != motorIoTag) {
|
||||
detectBrushedESC(configuredMotorIoTag);
|
||||
}
|
||||
#endif
|
||||
|
||||
//i2cSetOverclock(masterConfig.i2c_overclock);
|
||||
|
||||
debugMode = systemConfig()->debug_mode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue