Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCS_MAVLink: add mask to send_textv, use it for the GCS_MAVLINK send_… #13009

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/GCS_MAVLink/GCS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const MAV_MISSION_TYPE GCS_MAVLINK::supported_mission_types[] = {
/*
send a text message to all GCS
*/
void GCS::send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list)
void GCS::send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list, uint8_t mask)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment on this mask is

{
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
hal.util->vsnprintf(text, sizeof(text), fmt, arg_list);
send_statustext(severity, GCS_MAVLINK::active_channel_mask() | GCS_MAVLINK::streaming_channel_mask(), text);
send_statustext(severity, mask, text);
}

void GCS::send_text(MAV_SEVERITY severity, const char *fmt, ...)
Expand Down
6 changes: 5 additions & 1 deletion libraries/GCS_MAVLink/GCS.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,11 @@ class GCS
void send_to_active_channels(uint32_t msgid, const char *pkt);

void send_text(MAV_SEVERITY severity, const char *fmt, ...) FMT_PRINTF(3, 4);
void send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list);
void send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list, uint8_t mask);
void send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list) {
// if no mask is supplied we send to active and streaming channels
send_textv(severity, fmt, arg_list, uint8_t(GCS_MAVLINK::active_channel_mask() | GCS_MAVLINK::streaming_channel_mask()));
}
virtual void send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text);
void service_statustext(void);
virtual GCS_MAVLINK *chan(const uint8_t ofs) = 0;
Expand Down
4 changes: 1 addition & 3 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,10 @@ void GCS_MAVLINK::handle_param_value(const mavlink_message_t &msg)

void GCS_MAVLINK::send_text(MAV_SEVERITY severity, const char *fmt, ...) const
{
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
va_list arg_list;
va_start(arg_list, fmt);
hal.util->vsnprintf(text, sizeof(text), fmt, arg_list);
gcs().send_textv(severity, fmt, arg_list, (1<<chan));
va_end(arg_list);
gcs().send_statustext(severity, (1<<chan), text);
}

void GCS_MAVLINK::handle_radio_status(const mavlink_message_t &msg, bool log_radio)
Expand Down