Dedicated task for GPS Rescue (#11972)
[betaflight.git] / src / main / flight / gps_rescue.h
blob53c639b8a65eb709fd39ebf8716f8d9b753924a7
1 /*
2 * This file is part of Betaflight.
4 * Betaflight 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 * Betaflight 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 Betaflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #include "common/axis.h"
22 #include "pg/pg.h"
24 #define TASK_GPS_RESCUE_RATE_HZ 100 // synced to altitude task rate
26 typedef struct gpsRescue_s {
27 uint16_t angle; // degrees
28 uint16_t initialAltitudeM; // meters
29 uint16_t descentDistanceM; // meters
30 uint16_t rescueGroundspeed; // centimeters per second
31 uint8_t throttleP, throttleI, throttleD;
32 uint8_t yawP;
33 uint16_t throttleMin;
34 uint16_t throttleMax;
35 uint16_t throttleHover;
36 uint8_t minSats;
37 uint8_t velP, velI, velD;
38 uint16_t minRescueDth; // meters
39 uint8_t sanityChecks;
40 uint8_t allowArmingWithoutFix;
41 uint8_t useMag;
42 uint8_t targetLandingAltitudeM; // meters
43 uint8_t altitudeMode;
44 uint16_t ascendRate;
45 uint16_t descendRate;
46 uint16_t rescueAltitudeBufferM; // meters
47 uint8_t rollMix;
48 } gpsRescueConfig_t;
50 PG_DECLARE(gpsRescueConfig_t, gpsRescueConfig);
52 extern float gpsRescueAngle[ANGLE_INDEX_COUNT]; // NOTE: ANGLES ARE IN CENTIDEGREES
54 void gpsRescueInit(void);
55 void gpsRescueUpdate(void);
56 void gpsRescueNewGpsData(void);
58 float gpsRescueGetYawRate(void);
59 float gpsRescueGetThrottle(void);
60 bool gpsRescueIsConfigured(void);
61 bool gpsRescueIsAvailable(void);
62 bool gpsRescueIsDisabled(void);
63 bool gpsRescueDisableMag(void);