Merge pull request #10492 from iNavFlight/MrD_Update-OSD.md-for-8.0
[inav.git] / src / main / sensors / pitotmeter.h
blobaed924f8e4c21eb3ce71f85659505c87a935f0dc
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 PITOT_DLVR = 7,
35 } pitotSensor_e;
37 #define PITOT_MAX PITOT_FAKE
38 #define PITOT_SAMPLE_COUNT_MAX 48
40 typedef struct pitotmeterConfig_s {
41 uint8_t pitot_hardware; // Pitotmeter hardware to use
42 uint16_t pitot_lpf_milli_hz; // additional LPF to reduce pitot noise in [0.001Hz]
43 float pitot_scale; // scale value
44 } pitotmeterConfig_t;
46 PG_DECLARE(pitotmeterConfig_t, pitotmeterConfig);
48 typedef struct pito_s {
49 pitotDev_t dev;
50 float airSpeed;
52 zeroCalibrationScalar_t zeroCalibration;
53 pt1Filter_t lpfState;
54 timeUs_t lastMeasurementUs;
55 timeMs_t lastSeenHealthyMs;
57 float pressureZero;
58 float pressure;
59 float temperature;
60 } pitot_t;
62 #ifdef USE_PITOT
64 extern pitot_t pitot;
66 bool pitotInit(void);
67 bool pitotIsCalibrationComplete(void);
68 void pitotStartCalibration(void);
69 void pitotUpdate(void);
70 float getAirspeedEstimate(void);
71 bool pitotIsHealthy(void);
73 #endif