mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 11:23:06 +08:00
mavlink: HEARTBEAT stream check free tx buf before send
This commit is contained in:
committed by
Lorenz Meier
parent
e06d218ff2
commit
dcb897307d
@@ -452,19 +452,23 @@ protected:
|
||||
|
||||
bool send() override
|
||||
{
|
||||
// always send the heartbeat, independent of the update status of the topics
|
||||
vehicle_status_s status{};
|
||||
_status_sub.copy(&status);
|
||||
if (_mavlink->get_free_tx_buf() >= get_size()) {
|
||||
// always send the heartbeat, independent of the update status of the topics
|
||||
vehicle_status_s status{};
|
||||
_status_sub.copy(&status);
|
||||
|
||||
uint8_t base_mode = 0;
|
||||
uint32_t custom_mode = 0;
|
||||
uint8_t system_status = 0;
|
||||
get_mavlink_mode_state(&status, &system_status, &base_mode, &custom_mode);
|
||||
uint8_t base_mode = 0;
|
||||
uint32_t custom_mode = 0;
|
||||
uint8_t system_status = 0;
|
||||
get_mavlink_mode_state(&status, &system_status, &base_mode, &custom_mode);
|
||||
|
||||
mavlink_msg_heartbeat_send(_mavlink->get_channel(), _mavlink->get_system_type(), MAV_AUTOPILOT_PX4,
|
||||
base_mode, custom_mode, system_status);
|
||||
mavlink_msg_heartbeat_send(_mavlink->get_channel(), _mavlink->get_system_type(), MAV_AUTOPILOT_PX4,
|
||||
base_mode, custom_mode, system_status);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user