|
|
|
@ -572,18 +572,26 @@ GCS_MAVLINK::update(void)
@@ -572,18 +572,26 @@ GCS_MAVLINK::update(void)
|
|
|
|
|
send_message(MSG_NEXT_PARAM); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!waypoint_receiving && !waypoint_sending) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint32_t tnow = millis(); |
|
|
|
|
|
|
|
|
|
if (waypoint_receiving && |
|
|
|
|
waypoint_request_i <= (unsigned)g.waypoint_total) { |
|
|
|
|
waypoint_request_i <= (unsigned)g.waypoint_total && |
|
|
|
|
tnow > waypoint_timelast_request + 500) { |
|
|
|
|
waypoint_timelast_request = tnow; |
|
|
|
|
send_message(MSG_NEXT_WAYPOINT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// stop waypoint sending if timeout |
|
|
|
|
if (waypoint_sending && (millis() - waypoint_timelast_send) > waypoint_send_timeout){ |
|
|
|
|
if (waypoint_sending && (tnow - waypoint_timelast_send) > waypoint_send_timeout){ |
|
|
|
|
waypoint_sending = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// stop waypoint receiving if timeout |
|
|
|
|
if (waypoint_receiving && (millis() - waypoint_timelast_receive) > waypoint_receive_timeout){ |
|
|
|
|
if (waypoint_receiving && (tnow - waypoint_timelast_receive) > waypoint_receive_timeout){ |
|
|
|
|
waypoint_receiving = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1151,6 +1159,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1151,6 +1159,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
waypoint_receiving = true; |
|
|
|
|
waypoint_sending = false; |
|
|
|
|
waypoint_request_i = 0; |
|
|
|
|
waypoint_timelast_request = 0; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1296,6 +1305,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -1296,6 +1305,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
|
|
|
|
|
// update waypoint receiving state machine |
|
|
|
|
waypoint_timelast_receive = millis(); |
|
|
|
|
waypoint_timelast_request = 0; |
|
|
|
|
waypoint_request_i++; |
|
|
|
|
|
|
|
|
|
if (waypoint_request_i > (uint16_t)g.waypoint_total){ |
|
|
|
|