1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 09:16:07 +03:00

Merge branch 'quat_fsm_vfm_clean_yaw_hack_squash' into betaflight

Conflicts:
	src/main/mw.c
	src/main/target/CC3D/target.h
This commit is contained in:
ProDrone 2015-09-19 14:59:47 +02:00
commit 47afa51bd7
21 changed files with 806 additions and 172 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 {
@ -756,6 +760,13 @@ bool runLoop(uint32_t loopTime) {
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
@ -802,8 +813,8 @@ void loop(void)
if (runLoop(loopTime)) {
loopTime = currentTime + targetLooptime;
imuUpdate(&currentProfile->accelerometerTrims, masterConfig.acc_for_fast_looptime);
imuUpdate(&currentProfile->accelerometerTrims);
// Measure loop rate just after reading the sensors
currentTime = micros();
@ -811,6 +822,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
if (currentProfile->pidProfile.gyro_cut_hz) {
filterGyro();