|
|
|
@ -52,19 +52,13 @@ GCS_MAVLINK::update(void)
@@ -52,19 +52,13 @@ GCS_MAVLINK::update(void)
|
|
|
|
|
_queued_send(); |
|
|
|
|
|
|
|
|
|
// stop waypoint sending if timeout |
|
|
|
|
if (global_data.waypoint_sending && |
|
|
|
|
millis() - global_data.waypoint_timelast_send > |
|
|
|
|
global_data.waypoint_send_timeout) |
|
|
|
|
{ |
|
|
|
|
if (global_data.waypoint_sending && (millis() - global_data.waypoint_timelast_send) > global_data.waypoint_send_timeout){ |
|
|
|
|
send_text(SEVERITY_LOW,"waypoint send timeout"); |
|
|
|
|
global_data.waypoint_sending = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// stop waypoint receiving if timeout |
|
|
|
|
if (global_data.waypoint_receiving && |
|
|
|
|
millis() - global_data.waypoint_timelast_receive > |
|
|
|
|
global_data.waypoint_receive_timeout) |
|
|
|
|
{ |
|
|
|
|
if (global_data.waypoint_receiving && (millis() - global_data.waypoint_timelast_receive) > global_data.waypoint_receive_timeout){ |
|
|
|
|
send_text(SEVERITY_LOW,"waypoint receive timeout"); |
|
|
|
|
global_data.waypoint_receiving = false; |
|
|
|
|
} |
|
|
|
@ -102,8 +96,7 @@ GCS_MAVLINK::data_stream_send(uint16_t freqMin, uint16_t freqMax)
@@ -102,8 +96,7 @@ GCS_MAVLINK::data_stream_send(uint16_t freqMin, uint16_t freqMax)
|
|
|
|
|
if (freqLoopMatch(global_data.streamRateExtra2,freqMin,freqMax)) // Use Extra 3 for additional HIL info |
|
|
|
|
send_message(MSG_VFR_HUD); |
|
|
|
|
|
|
|
|
|
if (freqLoopMatch(global_data.streamRateExtra3,freqMin,freqMax)) |
|
|
|
|
{ |
|
|
|
|
if (freqLoopMatch(global_data.streamRateExtra3,freqMin,freqMax)){ |
|
|
|
|
// Available datastream |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -197,8 +190,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -197,8 +190,7 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
|
|
|
|
|
// do action |
|
|
|
|
send_text(SEVERITY_LOW,"action received"); |
|
|
|
|
switch(packet.action) |
|
|
|
|
{ |
|
|
|
|
switch(packet.action){ |
|
|
|
|
|
|
|
|
|
case MAV_ACTION_LAUNCH: |
|
|
|
|
//set_mode(TAKEOFF); |
|
|
|
@ -290,11 +282,16 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -290,11 +282,16 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
// decode |
|
|
|
|
mavlink_waypoint_request_list_t packet; |
|
|
|
|
mavlink_msg_waypoint_request_list_decode(msg, &packet); |
|
|
|
|
if (mavlink_check_target(packet.target_system,packet.target_component)) break; |
|
|
|
|
|
|
|
|
|
if (mavlink_check_target(packet.target_system,packet.target_component)) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
// Start sending waypoints |
|
|
|
|
mavlink_msg_waypoint_count_send(chan,msg->sysid, |
|
|
|
|
msg->compid,g.waypoint_total + 1); // + home |
|
|
|
|
mavlink_msg_waypoint_count_send( |
|
|
|
|
chan,msg->sysid, |
|
|
|
|
msg->compid, |
|
|
|
|
g.waypoint_total + 1); // + home |
|
|
|
|
|
|
|
|
|
global_data.waypoint_timelast_send = millis(); |
|
|
|
|
global_data.waypoint_sending = true; |
|
|
|
|
global_data.waypoint_receiving = false; |
|
|
|
@ -520,7 +517,13 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -520,7 +517,13 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
if (global_data.waypoint_request_i > g.waypoint_total) |
|
|
|
|
{ |
|
|
|
|
uint8_t type = 0; // ok (0), error(1) |
|
|
|
|
mavlink_msg_waypoint_ack_send(chan,msg->sysid,msg->compid,type); |
|
|
|
|
|
|
|
|
|
mavlink_msg_waypoint_ack_send( |
|
|
|
|
chan, |
|
|
|
|
msg->sysid, |
|
|
|
|
msg->compid, |
|
|
|
|
type); |
|
|
|
|
|
|
|
|
|
send_text(SEVERITY_LOW,"flight plan received"); |
|
|
|
|
global_data.waypoint_receiving = false; |
|
|
|
|
// XXX ignores waypoint radius for individual waypoints, can |
|
|
|
@ -574,7 +577,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
@@ -574,7 +577,10 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Report back new value |
|
|
|
|
mavlink_msg_param_value_send(chan, (int8_t *)key, packet.param_value, |
|
|
|
|
mavlink_msg_param_value_send( |
|
|
|
|
chan, |
|
|
|
|
(int8_t *)key, |
|
|
|
|
packet.param_value, |
|
|
|
|
_count_parameters(), |
|
|
|
|
-1); // XXX we don't actually know what its index is... |
|
|
|
|
|
|
|
|
@ -748,14 +754,10 @@ GCS_MAVLINK::_queued_send()
@@ -748,14 +754,10 @@ GCS_MAVLINK::_queued_send()
|
|
|
|
|
AP_Var *vp; |
|
|
|
|
float value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// copy the current parameter and prepare to move to the next |
|
|
|
|
vp = _queued_parameter; |
|
|
|
|
_queued_parameter = _queued_parameter->next(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if the parameter can be cast to float, report it here and break out of the loop |
|
|
|
|
value = vp->cast_to_float(); |
|
|
|
|
if (!isnan(value)) { |
|
|
|
@ -763,7 +765,8 @@ GCS_MAVLINK::_queued_send()
@@ -763,7 +765,8 @@ GCS_MAVLINK::_queued_send()
|
|
|
|
|
char param_name[ONBOARD_PARAM_NAME_LENGTH]; /// XXX HACK |
|
|
|
|
vp->copy_name(param_name, sizeof(param_name)); |
|
|
|
|
|
|
|
|
|
mavlink_msg_param_value_send(chan, |
|
|
|
|
mavlink_msg_param_value_send( |
|
|
|
|
chan, |
|
|
|
|
(int8_t*)param_name, |
|
|
|
|
value, |
|
|
|
|
_count_parameters(), |
|
|
|
@ -783,12 +786,16 @@ GCS_MAVLINK::_queued_send()
@@ -783,12 +786,16 @@ GCS_MAVLINK::_queued_send()
|
|
|
|
|
|
|
|
|
|
// request waypoints one by one |
|
|
|
|
// XXX note that this is pan-interface |
|
|
|
|
if (global_data.waypoint_receiving && global_data.requested_interface == chan && |
|
|
|
|
global_data.waypoint_request_i <= g.waypoint_total && mavdelay > 15) // limits to 3.33 hz |
|
|
|
|
if (global_data.waypoint_receiving && |
|
|
|
|
(global_data.requested_interface == chan) && |
|
|
|
|
global_data.waypoint_request_i <= (g.waypoint_total && mavdelay > 15)) // limits to 3.33 hz |
|
|
|
|
{ |
|
|
|
|
mavlink_msg_waypoint_request_send(chan, |
|
|
|
|
mavlink_msg_waypoint_request_send( |
|
|
|
|
chan, |
|
|
|
|
global_data.waypoint_dest_sysid, |
|
|
|
|
global_data.waypoint_dest_compid ,global_data.waypoint_request_i); |
|
|
|
|
global_data.waypoint_dest_compid, |
|
|
|
|
global_data.waypoint_request_i); |
|
|
|
|
|
|
|
|
|
mavdelay = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|