Make ONE_G definition const and move to utils.ino

This commit is contained in:
Oleg Kalachev 2025-01-09 11:24:40 +03:00
parent 404ceed851
commit c8109af04f
5 changed files with 5 additions and 5 deletions

View File

@ -11,6 +11,7 @@
#define RATES_LFP_ALPHA 0.2 // cutoff frequency ~ 40 Hz #define RATES_LFP_ALPHA 0.2 // cutoff frequency ~ 40 Hz
LowPassFilter<Vector> ratesFilter(RATES_LFP_ALPHA); LowPassFilter<Vector> ratesFilter(RATES_LFP_ALPHA);
extern const float ONE_G;
void estimate() { void estimate() {
applyGyro(); applyGyro();

View File

@ -18,8 +18,6 @@
#define RC_CHANNEL_ARMED 4 #define RC_CHANNEL_ARMED 4
#define RC_CHANNEL_MODE 5 #define RC_CHANNEL_MODE 5
#define ONE_G 9.80665
float t = NAN; // current step time, s float t = NAN; // current step time, s
float dt; // time delta from previous step, s float dt; // time delta from previous step, s
float loopRate; // loop rate, Hz float loopRate; // loop rate, Hz

View File

@ -12,6 +12,8 @@ Vector accBias;
Vector gyroBias; Vector gyroBias;
Vector accScale(1, 1, 1); Vector accScale(1, 1, 1);
extern const float ONE_G;
void setupIMU() { void setupIMU() {
Serial.println("Setup IMU"); Serial.println("Setup IMU");
bool status = IMU.begin(); bool status = IMU.begin();

View File

@ -7,6 +7,8 @@
#include <soc/soc.h> #include <soc/soc.h>
#include <soc/rtc_cntl_reg.h> #include <soc/rtc_cntl_reg.h>
const float ONE_G = 9.80665;
float mapf(long x, long in_min, long in_max, float out_min, float out_max) { float mapf(long x, long in_min, long in_max, float out_min, float out_max) {
return (float)(x - in_min) * (out_max - out_min) / (float)(in_max - in_min) + out_min; return (float)(x - in_min) * (out_max - out_min) / (float)(in_max - in_min) + out_min;
} }

View File

@ -11,11 +11,8 @@
#include "wifi.h" #include "wifi.h"
#define RC_CHANNELS 16 #define RC_CHANNELS 16
#define WIFI_ENABLED 1 #define WIFI_ENABLED 1
#define ONE_G 9.80665
float t = NAN; float t = NAN;
float dt; float dt;
float loopRate; float loopRate;