Plane: convert to using static send_statustext

- no more MSG_STATUSTEXT
- TODO: replace calls to gcs_send_text and gcs_send_text_fmt to GCS_MAVLINK::send_statustext()
This commit is contained in:
Tom Pittenger 2016-02-23 12:54:46 -08:00 committed by Andrew Tridgell
parent 0372b52378
commit 6399d00950
2 changed files with 7 additions and 34 deletions

View File

@ -583,15 +583,6 @@ void Plane::send_current_waypoint(mavlink_channel_t chan)
mavlink_msg_mission_current_send(chan, mission.get_current_nav_index());
}
void Plane::send_statustext(mavlink_channel_t chan)
{
mavlink_statustext_t *s = &gcs[chan-MAVLINK_COMM_0].pending_status;
mavlink_msg_statustext_send(
chan,
s->severity,
s->text);
}
// are we still delaying telemetry to try to avoid Xbee bricking?
bool Plane::telemetry_delayed(mavlink_channel_t chan)
{
@ -730,9 +721,8 @@ bool GCS_MAVLINK::try_send_message(enum ap_message id)
break;
case MSG_STATUSTEXT:
CHECK_PAYLOAD_SIZE(STATUSTEXT);
plane.send_statustext(chan);
break;
// depreciated, use GCS_MAVLINK::send_statustext*
return false;
#if GEOFENCE_ENABLED == ENABLED
case MSG_FENCE_STATUS:
@ -2032,14 +2022,7 @@ void Plane::gcs_update(void)
void Plane::gcs_send_text(MAV_SEVERITY severity, const char *str)
{
for (uint8_t i=0; i<num_gcs; i++) {
if (gcs[i].initialised) {
gcs[i].send_text(severity, str);
}
}
#if LOGGING_ENABLED == ENABLED
DataFlash.Log_Write_Message(str);
#endif
GCS_MAVLINK::send_statustext(severity, 0xFF, str);
}
/*
@ -2049,22 +2032,12 @@ void Plane::gcs_send_text(MAV_SEVERITY severity, const char *str)
*/
void Plane::gcs_send_text_fmt(MAV_SEVERITY severity, const char *fmt, ...)
{
char str[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN] {};
va_list arg_list;
gcs[0].pending_status.severity = (uint8_t)severity;
va_start(arg_list, fmt);
hal.util->vsnprintf((char *)gcs[0].pending_status.text,
sizeof(gcs[0].pending_status.text), fmt, arg_list);
hal.util->vsnprintf((char *)str, sizeof(str), fmt, arg_list);
va_end(arg_list);
#if LOGGING_ENABLED == ENABLED
DataFlash.Log_Write_Message(gcs[0].pending_status.text);
#endif
gcs[0].send_message(MSG_STATUSTEXT);
for (uint8_t i=1; i<num_gcs; i++) {
if (gcs[i].initialised) {
gcs[i].pending_status = gcs[0].pending_status;
gcs[i].send_message(MSG_STATUSTEXT);
}
}
GCS_MAVLINK::send_statustext(severity, 0xFF, str);
}
/*
@ -2088,4 +2061,5 @@ void Plane::gcs_send_airspeed_calibration(const Vector3f &vg)
void Plane::gcs_retry_deferred(void)
{
gcs_send_message(MSG_RETRY_DEFERRED);
GCS_MAVLINK::service_statustext();
}

View File

@ -748,7 +748,6 @@ private:
void send_rpm(mavlink_channel_t chan);
void send_rangefinder(mavlink_channel_t chan);
void send_current_waypoint(mavlink_channel_t chan);
void send_statustext(mavlink_channel_t chan);
bool telemetry_delayed(mavlink_channel_t chan);
void gcs_send_message(enum ap_message id);
void gcs_send_mission_item_reached_message(uint16_t mission_index);