From a0fb426a346998cfb3d0ad17b249a2fb4d76154f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 10 Aug 2016 08:27:51 +1000 Subject: [PATCH] Plane: fixes for Fraky_Telem API changes --- ArduPlane/GCS_Mavlink.cpp | 6 ++++++ ArduPlane/system.cpp | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index bedf3871ff..7e6bf5dd53 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -344,6 +344,12 @@ void Plane::send_extended_status1(mavlink_channel_t chan) 0, // comm drops %, 0, // comm drops in pkts, 0, 0, 0, 0); + +#if FRSKY_TELEM_ENABLED == ENABLED + // give mask of error flags to Frsky_Telemetry + uint32_t sensors_error_flags = (control_sensors_health ^ control_sensors_enabled) & control_sensors_present; + frsky_telemetry.update_sensor_status_flags(sensors_error_flags); +#endif } void Plane::send_location(mavlink_channel_t chan) diff --git a/ArduPlane/system.cpp b/ArduPlane/system.cpp index 344022af4c..9d0ad35c9f 100644 --- a/ArduPlane/system.cpp +++ b/ArduPlane/system.cpp @@ -160,7 +160,7 @@ void Plane::init_ardupilot() // setup frsky #if FRSKY_TELEM_ENABLED == ENABLED // setup frsky, and pass a number of parameters to the library - frsky_telemetry.init(serial_manager, (uint8_t *)&control_mode); + frsky_telemetry.init(serial_manager); #endif mavlink_system.sysid = g.sysid_this_mav; @@ -356,6 +356,10 @@ void Plane::set_mode(enum FlightMode mode, mode_reason_t reason) previous_mode_reason = control_mode_reason; control_mode_reason = reason; +#if FRSKY_TELEM_ENABLED == ENABLED + frsky_telemetry.update_control_mode(control_mode); +#endif + if (previous_mode == AUTOTUNE && control_mode != AUTOTUNE) { // restore last gains autotune_restore();