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/>.
23 #include "build/build_config.h"
25 #include "common/utils.h"
27 #include "drivers/pitotmeter/pitotmeter.h"
28 #include "drivers/pitotmeter/pitotmeter_fake.h"
31 static float fakePressure
;
32 static float fakeTemperature
;
33 static float fakeAirspeed
;
35 static bool fakePitotStart(pitotDev_t
*pitot
)
41 void fakePitotSet(float pressure
, float temperature
)
43 fakePressure
= pressure
;
44 fakeTemperature
= temperature
;
47 void fakePitotSetAirspeed(float airSpeed
)
49 fakeAirspeed
= airSpeed
;
52 float fakePitotGetAirspeed(void)
57 bool fakePitotRead(pitotDev_t
*pitot
)
59 pitot
->calculate(pitot
, &fakePressure
, &fakeTemperature
);
63 static void fakePitotCalculate(pitotDev_t
*pitot
, float *pressure
, float *temperature
)
67 *pressure
= fakePressure
; // Pa
69 *temperature
= fakeTemperature
; // K
72 bool fakePitotDetect(pitotDev_t
*pitot
)
74 fakePressure
= 0; // 0Pa
75 fakeTemperature
= 273; // 0C
78 pitot
->calibThreshold
= 0.00001f
;
79 pitot
->start
= fakePitotStart
;
80 pitot
->get
= fakePitotRead
;
81 pitot
->calculate
= fakePitotCalculate
;