Copter: make scheduler track whether it has called the delay callback

This commit is contained in:
Peter Barker 2018-05-08 16:17:08 +10:00 committed by Andrew Tridgell
parent a78fe0896f
commit dee40f3fe5
2 changed files with 2 additions and 7 deletions

View File

@ -572,9 +572,6 @@ private:
AP_Avoidance_Copter avoidance_adsb{ahrs, adsb};
#endif
// use this to prevent recursion during sensor init
bool in_mavlink_delay;
// last valid RC input time
uint32_t last_radio_update_ms;

View File

@ -569,7 +569,7 @@ GCS_MAVLINK_Copter::data_stream_send(void)
if (gcs().out_of_time()) return;
if (copter.in_mavlink_delay) {
if (hal.scheduler->in_delay_callback()) {
// don't send any other stream types while in the delay callback
return;
}
@ -1713,9 +1713,8 @@ void GCS_MAVLINK_Copter::handleMessage(mavlink_message_t* msg)
void Copter::mavlink_delay_cb()
{
static uint32_t last_1hz, last_50hz, last_5s;
if (!gcs().chan(0).initialised || in_mavlink_delay) return;
if (!gcs().chan(0).initialised) return;
in_mavlink_delay = true;
DataFlash.EnableWrites(false);
uint32_t tnow = millis();
@ -1738,7 +1737,6 @@ void Copter::mavlink_delay_cb()
check_usb_mux();
DataFlash.EnableWrites(true);
in_mavlink_delay = false;
}
/*