mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Gyro_sync without interrupt // Automatic looptime
This commit is contained in:
parent
3510b96430
commit
f50bec0700
1 changed files with 1 additions and 18 deletions
|
@ -738,23 +738,6 @@ void filterRc(void){
|
|||
}
|
||||
}
|
||||
|
||||
// Function for loop trigger
|
||||
bool runLoop(uint32_t loopTime) {
|
||||
bool loopTrigger = false;
|
||||
|
||||
if (masterConfig.syncGyroToLoop) {
|
||||
if (gyroSyncCheckUpdate() || (int32_t)(currentTime - (loopTime + GYRO_WATCHDOG_DELAY)) >= 0) {
|
||||
loopTrigger = true;
|
||||
}
|
||||
}
|
||||
|
||||
else if ((int32_t)(currentTime - loopTime) >= 0){
|
||||
loopTrigger = true;
|
||||
}
|
||||
|
||||
return loopTrigger;
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
static uint32_t loopTime;
|
||||
|
@ -801,7 +784,7 @@ void loop(void)
|
|||
}
|
||||
|
||||
currentTime = micros();
|
||||
if (runLoop(loopTime)) {
|
||||
if ((!masterConfig.syncGyroToLoop && masterConfig.looptime == 0) || ((int32_t)(currentTime - loopTime) >= 0)) {
|
||||
|
||||
loopTime = currentTime + targetLooptime;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue