From 6f3afb2df163e15fb354dc806d8f3b5f26e09a31 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Fri, 7 Aug 2015 13:37:34 +0200 Subject: [PATCH] Enable full 1khz sampling on F1 boards (no acc mode) --- src/main/drivers/gyro_sync.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/drivers/gyro_sync.c b/src/main/drivers/gyro_sync.c index 946aff507b..ccb6bfd9a0 100644 --- a/src/main/drivers/gyro_sync.c +++ b/src/main/drivers/gyro_sync.c @@ -52,15 +52,15 @@ void gyroUpdateSampleRate(uint32_t looptime, uint8_t lpf) { gyroSamplePeriod = 125; if(!sensors(SENSOR_ACC)) { - minLooptime = 500; // Max refresh 2khz + minLooptime = 500; // Max refresh 2khz } else { - minLooptime = 625; // Max refresh 1,6khz + minLooptime = 625; // Max refresh 1,6khz } } else { gyroSamplePeriod = 1000; - minLooptime = 1000; + minLooptime = 1000; // Full sampling } #elif STM32F10X if (lpf == INV_FILTER_256HZ_NOLPF2) { @@ -75,7 +75,12 @@ void gyroUpdateSampleRate(uint32_t looptime, uint8_t lpf) { } else { gyroSamplePeriod = 1000; - minLooptime = 2000; + if(!sensors(SENSOR_ACC)) { + minLooptime = 1000; // Full sampling without ACC + } + else { + minLooptime = 2000; + } } #endif looptime = constrain(looptime, minLooptime, 4000);