From aee939f891a9069985c0f19894bae190badbac3d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 21 Aug 2017 12:32:42 +1000 Subject: [PATCH] Plane: move gcs_out_of_time into GCS object --- ArduPlane/GCS_Mavlink.cpp | 24 ++++++++++++------------ ArduPlane/Plane.h | 3 --- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index 091d289d24..1c922418cd 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -427,7 +427,7 @@ bool GCS_MAVLINK_Plane::try_send_message(enum ap_message id) // wants to fire then don't send a mavlink message. We want to // prioritise the main flight control loop over communications if (!plane.in_mavlink_delay && plane.scheduler.time_available_usec() < 200) { - plane.gcs_out_of_time = true; + gcs().set_out_of_time(true); return false; } @@ -725,7 +725,7 @@ const AP_Param::GroupInfo GCS_MAVLINK::var_info[] = { void GCS_MAVLINK_Plane::data_stream_send(void) { - plane.gcs_out_of_time = false; + gcs().set_out_of_time(false); if (!plane.in_mavlink_delay) { plane.DataFlash.handle_log_send(*this); @@ -733,7 +733,7 @@ GCS_MAVLINK_Plane::data_stream_send(void) send_queued_parameters(); - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (plane.in_mavlink_delay) { #if HIL_SUPPORT @@ -753,7 +753,7 @@ GCS_MAVLINK_Plane::data_stream_send(void) return; } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_RAW_SENSORS)) { send_message(MSG_RAW_IMU1); @@ -761,7 +761,7 @@ GCS_MAVLINK_Plane::data_stream_send(void) send_message(MSG_RAW_IMU3); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_EXTENDED_STATUS)) { send_message(MSG_EXTENDED_STATUS1); @@ -776,7 +776,7 @@ GCS_MAVLINK_Plane::data_stream_send(void) send_message(MSG_POSITION_TARGET_GLOBAL_INT); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_POSITION)) { // sent with GPS read @@ -784,20 +784,20 @@ GCS_MAVLINK_Plane::data_stream_send(void) send_message(MSG_LOCAL_POSITION); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_RAW_CONTROLLER)) { send_message(MSG_SERVO_OUT); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_RC_CHANNELS)) { send_message(MSG_SERVO_OUTPUT_RAW); send_message(MSG_RADIO_IN); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_EXTRA1)) { send_message(MSG_ATTITUDE); @@ -811,13 +811,13 @@ GCS_MAVLINK_Plane::data_stream_send(void) send_message(MSG_LANDING); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_EXTRA2)) { send_message(MSG_VFR_HUD); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_EXTRA3)) { send_message(MSG_AHRS); @@ -839,7 +839,7 @@ GCS_MAVLINK_Plane::data_stream_send(void) send_message(MSG_VIBRATION); } - if (plane.gcs_out_of_time) return; + if (gcs().out_of_time()) return; if (stream_trigger(STREAM_ADSB)) { send_message(MSG_ADSB_VEHICLE); diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index ec47819f9b..c7551b3bd9 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -794,9 +794,6 @@ private: // use this to prevent recursion during sensor init bool in_mavlink_delay = false; - // true if we are out of time in our event timeslice - bool gcs_out_of_time = false; - // time that rudder arming has been running uint32_t rudder_arm_timer;