1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Remove sensor_barometer.c's dependency on mw.h/board.h.

This also cleans the code - No magic numbers, clearly defines states,
config variables grouped together, avoiding some global variable use.
This commit is contained in:
Dominic Clifton 2014-04-22 23:46:25 +01:00
parent c08d0ac1b3
commit e2550ee5e1
8 changed files with 120 additions and 62 deletions

View file

@ -1,10 +1,27 @@
#pragma once
#define BARO_SAMPLE_COUNT_MAX 48
typedef struct barometerConfig_s {
uint8_t baro_sample_count; // size of baro filter array
float baro_noise_lpf; // additional LPF to reduce baro noise
float baro_cf_vel; // apply Complimentary Filter to keep the calculated velocity based on baro velocity (i.e. near real velocity)
float baro_cf_alt; // apply CF to use ACC for height estimation
} barometerConfig_t;
typedef enum {
BAROMETER_ACTION_NOT_READY = 0,
BAROMETER_ACTION_OBTAINED_SAMPLES,
BAROMETER_ACTION_PERFORMED_CALCULATION
} barometerAction_e;
extern int32_t BaroAlt;
#ifdef BARO
void baroSetCalibrationCycles(uint16_t calibrationCyclesRequired);
void baroCommon(void);
int baroUpdate(void);
int32_t baroCalculateAltitude(void);
void useBarometerConfig(barometerConfig_t *barometerConfigToUse);
bool isBaroCalibrationComplete(void);
void baroSetCalibrationCycles(uint16_t calibrationCyclesRequired);
barometerAction_e baroUpdate(uint32_t currentTime);
int32_t baroCalculateAltitude(void);
void performBaroCalibrationCycle(void);
#endif