mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
mavlink: keep trying to find to broadcast
This should help the Snapdragon to connect if the network is not yet up by the time the mainapp starts. It will retry to find a network and broadcast once it finds one.
This commit is contained in:
@@ -885,13 +885,20 @@ Mavlink::send_message(const uint8_t msgid, const void *msg, uint8_t component_ID
|
||||
if ((_mode != MAVLINK_MODE_ONBOARD) &&
|
||||
(!get_client_source_initialized()
|
||||
|| (hrt_elapsed_time(&tstatus.heartbeat_time) > 3 * 1000 * 1000))
|
||||
&& (msgid == MAVLINK_MSG_ID_HEARTBEAT)
|
||||
&& _broadcast_address_found) {
|
||||
&& (msgid == MAVLINK_MSG_ID_HEARTBEAT)) {
|
||||
|
||||
int bret = sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_bcast_addr, sizeof(_bcast_addr));
|
||||
if (!_broadcast_address_found) {
|
||||
// Try to initialize UDP and broadcast address again.
|
||||
init_udp();
|
||||
}
|
||||
|
||||
if (bret <= 0) {
|
||||
PX4_WARN("sending broadcast failed, errno: %d: %s", errno, strerror(errno));
|
||||
if (_broadcast_address_found) {
|
||||
|
||||
int bret = sendto(_socket_fd, buf, packet_len, 0, (struct sockaddr *)&_bcast_addr, sizeof(_bcast_addr));
|
||||
|
||||
if (bret <= 0) {
|
||||
PX4_WARN("sending broadcast failed, errno: %d: %s", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user