Skip to content
Snippets Groups Projects
Commit 727783fe authored by Julian Oes's avatar Julian Oes Committed by Lorenz Meier
Browse files

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.
parent 0ddf7207
No related branches found
No related tags found
No related merge requests found
......@@ -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 (_broadcast_address_found) {
if (bret <= 0) {
PX4_WARN("sending broadcast failed, errno: %d: %s", errno, strerror(errno));
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));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment