osd batt cleanup
[inav.git] / src / main / sensors / pitotmeter.h
blob4f9bccb046cda6e74c03749a0730da58d540bd34
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "config/parameter_group.h"
21 #include "common/filter.h"
22 #include "common/calibration.h"
24 #include "drivers/pitotmeter/pitotmeter.h"
26 typedef enum {
27 PITOT_NONE = 0,
28 PITOT_AUTODETECT = 1,
29 PITOT_MS4525 = 2,
30 PITOT_ADC = 3,
31 PITOT_VIRTUAL = 4,
32 PITOT_FAKE = 5,
33 PITOT_MSP = 6,
34 } pitotSensor_e;
36 #define PITOT_MAX PITOT_FAKE
37 #define PITOT_SAMPLE_COUNT_MAX 48
39 typedef struct pitotmeterConfig_s {
40 uint8_t pitot_hardware; // Pitotmeter hardware to use
41 uint16_t pitot_lpf_milli_hz; // additional LPF to reduce pitot noise in [0.001Hz]
42 float pitot_scale; // scale value
43 } pitotmeterConfig_t;
45 PG_DECLARE(pitotmeterConfig_t, pitotmeterConfig);
47 typedef struct pito_s {
48 pitotDev_t dev;
49 float airSpeed;
51 zeroCalibrationScalar_t zeroCalibration;
52 pt1Filter_t lpfState;
53 timeUs_t lastMeasurementUs;
54 timeMs_t lastSeenHealthyMs;
56 float pressureZero;
57 float pressure;
58 } pitot_t;
60 #ifdef USE_PITOT
62 extern pitot_t pitot;
64 bool pitotInit(void);
65 bool pitotIsCalibrationComplete(void);
66 void pitotStartCalibration(void);
67 void pitotUpdate(void);
68 float getAirspeedEstimate(void);
69 bool pitotIsHealthy(void);
71 #endif