1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 00:05:33 +03:00

Merge remote-tracking branch 'prodrone/betaflight' into alphaflight

This commit is contained in:
borisbstyle 2015-09-19 16:44:11 +02:00
commit 0ea5a99e2b
22 changed files with 808 additions and 184 deletions

View file

@ -20,6 +20,8 @@
#include <stdint.h>
#include <math.h>
#include "debug.h"
#include "platform.h"
#include "common/maths.h"
@ -80,6 +82,8 @@
#include "config/config_profile.h"
#include "config/config_master.h"
#define DEBUG_CYCLE_TIME
// June 2013 V2.2-dev
enum {
@ -726,6 +730,13 @@ void filterRc(void){
void loop(void)
{
static uint32_t loopTime;
#ifdef DEBUG_CYCLE_TIME
static uint32_t minCycleTime = 0xffffffff;
static uint32_t maxCycleTime = 0;
static uint32_t clearTime = 0;
#endif
#if defined(BARO) || defined(SONAR)
static bool haveProcessedAnnexCodeOnce = false;
#endif
@ -772,8 +783,8 @@ void loop(void)
if (gyroSyncCheckUpdate() || (int32_t)(currentTime - (loopTime + GYRO_WATCHDOG_DELAY)) >= 0) {
loopTime = currentTime + targetLooptime;
imuUpdate(&currentProfile->accelerometerTrims, masterConfig.acc_for_fast_looptime);
imuUpdate(&currentProfile->accelerometerTrims);
// Measure loop rate just after reading the sensors
currentTime = micros();
@ -781,6 +792,18 @@ void loop(void)
previousTime = currentTime;
dT = (float)cycleTime * 0.000001f;
#ifdef DEBUG_CYCLE_TIME
if (currentTime > clearTime) {
clearTime = currentTime + (uint32_t)20000000;
minCycleTime = 0xffffffff;
maxCycleTime = 0;
}
if (cycleTime < minCycleTime) minCycleTime = cycleTime;
if (cycleTime > maxCycleTime) maxCycleTime = cycleTime;
debug[0] = cycleTime;
debug[1] = minCycleTime;
debug[2] = maxCycleTime;
#endif
filterApply7TapFIR(gyroADC);