64 #define frac(f) (f - (int)f) 85 if (!subscription_data) {
94 if (subscription_data) {
96 subscription_data =
nullptr;
105 static const uint8_t c = 0x5E;
106 write(uart, &c,
sizeof(c));
114 const uint8_t x5E[] = { 0x5D, 0x3E };
115 const uint8_t x5D[] = { 0x5D, 0x3D };
119 write(uart, x5E,
sizeof(x5E));
123 write(uart, x5D,
sizeof(x5D));
127 write(uart, &value,
sizeof(value));
138 uint16_t udata =
data;
191 float dm_deg = (int) dec;
192 return (dm_deg * 100.0
f) + (dec - dm_deg) * 60;
206 float course = 0, lat = 0, lon = 0, speed = 0, alt = 0;
207 char lat_ns = 0, lon_ew = 0;
218 lat_ns = (gpos.
lat < 0) ?
'S' :
'N';
220 lon_ew = (gpos.
lon < 0) ?
'W' :
'E';
228 struct tm *tm_gps = gmtime(&time_gps);
230 sec = tm_gps->tm_sec;
266 struct tm *tm_gps = gmtime(&time_gps);
267 uint16_t hour_min = (tm_gps->tm_min << 8) | (tm_gps->tm_hour & 0xff);
279 bool data_ready =
false;
280 static int dcount = 0;
281 static uint8_t type = 0;
282 static uint8_t
data[11];
290 for (
int i = 0; i < nbytes; i++) {
293 if (sbuf[i] == 0x7E) {
300 if (sbuf[i] != 0x7E) {
312 data[dcount++] = sbuf[i];
324 if (sbuf[i] != 0x7E) {
bool frsky_parse_host(uint8_t *sbuf, int nbytes, struct adc_linkquality *v)
uORB::SubscriptionData< sensor_combined_s > sensor_combined_sub
uint16_t get_telemetry_flight_mode(int px4_flight_mode)
Map the PX4 flight mode (vehicle_status_s::nav_state) to the telemetry flight mode.
static struct frsky_subscription_data_s * subscription_data
Definition of geo / math functions to perform geodesic calculations.
uORB::SubscriptionData< battery_status_s > battery_status_sub
static void frsky_send_byte(int uart, uint8_t value)
Sends one byte, performing byte-stuffing if necessary.
void frsky_send_frame3(int uart)
Sends frame 3 (every 5000ms): GPS date & time.
uORB::SubscriptionData< vehicle_gps_position_s > vehicle_gps_position_sub
float accelerometer_m_s2[3]
uORB::SubscriptionData< vehicle_status_s > vehicle_status_sub
High-resolution timer with callouts and timekeeping.
void frsky_update_topics()
#define ORB_ID(_name)
Generates a pointer to the uORB metadata structure for a given topic.
uORB::SubscriptionData< vehicle_global_position_s > vehicle_global_position_sub
#define FRSKY_ID_GPS_LONG_EW
#define FRSKY_ID_GPS_ALT_BP
static void frsky_send_data(int uart, uint8_t id, int16_t data)
Sends one data id/value pair.
#define FRSKY_ID_GPS_ALT_AP
#define FRSKY_ID_GPS_SPEED_AP
bool frsky_init()
Initializes the uORB subscriptions.
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
#define FRSKY_ID_GPS_COURS_AP
static float frsky_format_gps(float dec)
Formats the decimal latitude/longitude to the required degrees/minutes.
#define FRSKY_ID_GPS_LAT_AP
#define FRSKY_ID_GPS_DAY_MONTH
#define FRSKY_ID_GPS_HOUR_MIN
static void write(bootloader_app_shared_t *pshared)
void frsky_send_frame1(int uart)
Sends frame 1 (every 200ms): acceleration values, barometer altitude, temperature, battery voltage & current.
#define FRSKY_ID_BARO_ALT_AP
#define FRSKY_ID_GPS_LONG_BP
#define FRSKY_ID_GPS_COURS_BP
#define FRSKY_ID_GPS_YEAR
#define FRSKY_ID_BARO_ALT_BP
static void frsky_send_startstop(int uart)
Sends a 0x5E start/stop byte.
#define FRSKY_ID_GPS_LAT_BP
#define FRSKY_ID_GPS_SPEED_BP
void frsky_send_frame2(int uart)
Sends frame 2 (every 1000ms): GPS course, latitude, longitude, ground speed, GPS altitude, remaining battery level.
#define FRSKY_ID_GPS_LONG_AP
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).
#define FRSKY_ID_GPS_LAT_NS
uORB::SubscriptionData< vehicle_air_data_s > vehicle_air_data_sub