mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Only wait for ESC to recognise DSHOT signal once at startup (#14408)
* Only wait for ESC to recognise DSHOT signal once at startup * Use cmpTimeMs to compare time expressed in ms
This commit is contained in:
parent
77ceea93e4
commit
dd0a37b41c
2 changed files with 15 additions and 1 deletions
|
@ -149,7 +149,20 @@ static bool allMotorsAreIdle(void)
|
|||
|
||||
bool dshotStreamingCommandsAreEnabled(void)
|
||||
{
|
||||
return motorIsEnabled() && motorGetMotorEnableTimeMs() && millis() > motorGetMotorEnableTimeMs() + DSHOT_PROTOCOL_DETECTION_DELAY_MS;
|
||||
static bool firstCommand = true;
|
||||
bool goodMotorDetectDelay;
|
||||
|
||||
if (firstCommand) {
|
||||
goodMotorDetectDelay = motorGetMotorEnableTimeMs() && (cmpTimeMs(millis(), motorGetMotorEnableTimeMs()) > DSHOT_PROTOCOL_DETECTION_DELAY_MS);
|
||||
|
||||
if (goodMotorDetectDelay) {
|
||||
firstCommand = false;
|
||||
}
|
||||
} else {
|
||||
goodMotorDetectDelay = true;
|
||||
}
|
||||
|
||||
return motorIsEnabled() && goodMotorDetectDelay;
|
||||
}
|
||||
|
||||
static bool dshotCommandsAreEnabled(dshotCommandType_e commandType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue