mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Added #define for imu debug output (+16 squashed commit)
Squashed local commits: from : e4265d4a13f63f82d5cf55eea2c091622f96660b up to (inc): 72416dc74745fa8bae1aded79aa4b9ed0e389076
This commit is contained in:
parent
c6f5b98a79
commit
45a4f11f92
21 changed files with 823 additions and 188 deletions
|
@ -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 {
|
||||
|
@ -687,6 +691,13 @@ void processRx(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
|
||||
|
@ -732,13 +743,26 @@ void loop(void)
|
|||
if (masterConfig.looptime == 0 || (int32_t)(currentTime - loopTime) >= 0) {
|
||||
loopTime = currentTime + masterConfig.looptime;
|
||||
|
||||
imuUpdate(¤tProfile->accelerometerTrims);
|
||||
imuUpdate(¤tProfile->accelerometerTrims, masterConfig.acc_for_fast_looptime);
|
||||
|
||||
// Measure loop rate just after reading the sensors
|
||||
currentTime = micros();
|
||||
cycleTime = (int32_t)(currentTime - previousTime);
|
||||
previousTime = currentTime;
|
||||
|
||||
#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
|
||||
|
||||
// Gyro Low Pass
|
||||
if (currentProfile->pidProfile.gyro_cut_hz) {
|
||||
int axis;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue