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

Add moretext char[150] extension to statustext message #12937

Open
wants to merge 3 commits into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -37,7 +37,7 @@ const MAV_MISSION_TYPE GCS_MAVLINK::supported_mission_types[] = {
*/
void GCS::send_textv(MAV_SEVERITY severity, const char *fmt, va_list arg_list)
{
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1];
char text[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+MAVLINK_MSG_STATUSTEXT_FIELD_MORETEXT_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);
}
@@ -1762,7 +1762,7 @@ void GCS_MAVLINK::send_ahrs()
void GCS::send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text)
{
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
if (strlen(text) > MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN) {
if (strlen(text) > (MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN + MAVLINK_MSG_STATUSTEXT_FIELD_MORETEXT_LEN)) {
AP_HAL::panic("Statustext (%s) too long", text);
}
#endif
@@ -1791,6 +1791,9 @@ void GCS::send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const cha

statustext.msg.severity = severity;
strncpy(statustext.msg.text, text, sizeof(statustext.msg.text));
if (strlen(text) > sizeof(statustext.msg.text)) {
strncpy(statustext.msg.moretext, &text[50], sizeof(statustext.msg.moretext));
}

WITH_SEMAPHORE(_statustext_sem);

@@ -1836,7 +1839,7 @@ void GCS::service_statustext(void)
mavlink_channel_t chan_index = (mavlink_channel_t)(MAVLINK_COMM_0+i);
if (HAVE_PAYLOAD_SPACE(chan_index, STATUSTEXT)) {
// we have space so send then clear that channel bit on the mask
mavlink_msg_statustext_send(chan_index, statustext->msg.severity, statustext->msg.text);
mavlink_msg_statustext_send(chan_index, statustext->msg.severity, statustext->msg.text, statustext->msg.moretext);
statustext->bitmask &= ~chan_bit;
}
}
@@ -1860,6 +1863,23 @@ void GCS::send_message(enum ap_message id)

void GCS::update_send()
{
static uint32_t last_send;
const uint32_t now = AP_HAL::millis();
static uint32_t count = 0;
if (now - last_send > 100) {
gcs().send_text(MAV_SEVERITY_INFO, "%u", count);

char buffer[300];
uint8_t i;
for (i=0; i<count;i++) {
buffer[i] = '0' + i % 10;
}
buffer[i] = '\0';
gcs().send_text(MAV_SEVERITY_INFO, "%s", buffer);
last_send = now;
count++;
}

if (!initialised_missionitemprotocol_objects) {
initialised_missionitemprotocol_objects = true;
// once-only initialisation of MissionItemProtocol objects:
Submodule mavlink updated 1 files
+2 −0 message_definitions/v1.0/common.xml
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.