1
0
Fork 0
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:
borisbstyle 2015-09-17 00:32:11 +02:00
parent 3510b96430
commit f50bec0700

View file

@ -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;