mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
mavlink: use RADIO_STATUS to regulate parameter sending
This commit is contained in:
parent
bcae99e34a
commit
d53fcb0bab
@ -1476,6 +1476,9 @@ Mavlink::update_radio_status(const radio_status_s &radio_status)
|
||||
/* this indicates spare bandwidth, increase by 2.5% */
|
||||
_radio_status_mult *= 1.025f;
|
||||
}
|
||||
|
||||
/* Constrain radio status multiplier between 1% and 100% to allow recovery */
|
||||
_radio_status_mult = math::constrain(_radio_status_mult, 0.01f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -518,6 +518,8 @@ public:
|
||||
|
||||
static hrt_abstime &get_first_start_time() { return _first_start_time; }
|
||||
|
||||
bool radio_status_critical() const { return _radio_status_critical; }
|
||||
|
||||
private:
|
||||
int _instance_id{0};
|
||||
|
||||
|
||||
@ -329,7 +329,8 @@ MavlinkParametersManager::send()
|
||||
int i = 0;
|
||||
|
||||
// Send while burst is not exceeded, we still have buffer space and still something to send
|
||||
while ((i++ < max_num_to_send) && (_mavlink->get_free_tx_buf() >= get_size()) && send_params()) {}
|
||||
while ((i++ < max_num_to_send) && (_mavlink->get_free_tx_buf() >= get_size()) && !_mavlink->radio_status_critical()
|
||||
&& send_params()) {}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -390,7 +391,8 @@ MavlinkParametersManager::send_untransmitted()
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while ((_mavlink->get_free_tx_buf() >= get_size()) && (_param_update_index < (int) param_count()));
|
||||
} while ((_mavlink->get_free_tx_buf() >= get_size()) && !_mavlink->radio_status_critical()
|
||||
&& (_param_update_index < (int) param_count()));
|
||||
|
||||
// Flag work as done once all params have been sent
|
||||
if (_param_update_index >= (int) param_count()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user