vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / io / adsb.h
blob86eefd8aac1cab2b54657fbd4d74a1260a1081e1
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 <stdint.h>
21 #include "common/time.h"
22 #include "fc/runtime_config.h"
24 #define ADSB_CALL_SIGN_MAX_LENGTH 9
25 #define ADSB_MAX_SECONDS_KEEP_INACTIVE_PLANE_IN_LIST 10
27 typedef struct {
28 bool valid;
29 int32_t dir; // centidegrees direction to plane, pivot is inav FC
30 uint32_t dist; // CM distance to plane, pivot is inav FC
31 int32_t verticalDistance; // CM, vertical distance to plane, pivot is inav FC
32 } adsbVehicleCalculatedValues_t;
34 typedef struct {
35 uint32_t icao; // ICAO address
36 int32_t lat; // Latitude, expressed as degrees * 1E7
37 int32_t lon; // Longitude, expressed as degrees * 1E7
38 int32_t alt; // Barometric/Geometric Altitude (ASL), in cm
39 uint16_t heading; // Course over ground in centidegrees
40 uint16_t flags; // Flags to indicate various statuses including valid data fields
41 uint8_t altitudeType; // Type from ADSB_ALTITUDE_TYPE enum
42 char callsign[ADSB_CALL_SIGN_MAX_LENGTH]; // The callsign, 8 chars + NULL
43 uint8_t emitterType; // Type from ADSB_EMITTER_TYPE enum
44 uint8_t tslc; // Time since last communication in seconds
45 } adsbVehicleValues_t;
47 typedef struct {
48 adsbVehicleValues_t vehicleValues;
49 adsbVehicleCalculatedValues_t calculatedVehicleValues;
50 uint8_t ttl;
51 } adsbVehicle_t;
55 typedef struct {
56 uint32_t vehiclesMessagesTotal;
57 } adsbVehicleStatus_t;
59 void adsbNewVehicle(adsbVehicleValues_t* vehicleValuesLocal);
60 adsbVehicle_t * findVehicleClosest(void);
61 adsbVehicle_t * findVehicle(uint8_t index);
62 uint8_t getActiveVehiclesCount(void);
63 void adsbTtlClean(timeUs_t currentTimeUs);
64 adsbVehicleStatus_t* getAdsbStatus(void);
65 adsbVehicleValues_t* getVehicleForFill(void);
66 bool enviromentOkForCalculatingDistaceBearing(void);
67 void recalculateVehicle(adsbVehicle_t* vehicle);