[mavlink] NULL terminated strings instead of len field

This commit is contained in:
Christophe De Wagter
2015-11-21 21:20:30 +01:00
parent adb2b6c2a4
commit a8a3a7d226
@@ -50,9 +50,12 @@ void mavlink_send_block(uint16_t seq)
static const char *blocks[] = FP_BLOCKS;
char block_name[50];
strncpy(block_name, blocks[seq], 49); // String containing the name of the block
uint8_t len = strlen(blocks[seq]); // Length of the block name
uint8_t _terminate = strlen(blocks[seq]); // Length of the block name
if (_terminate > 49)
_terminate = 49;
block_name[_terminate] = 0;
mavlink_msg_script_item_send(MAVLINK_COMM_0, mission_mgr.rem_sysid, mission_mgr.rem_compid,
seq, len, block_name);
seq, block_name);
MAVLinkSendMessage();
MAVLINK_DEBUG("Sent BLOCK_ITEM message: seq %i, name %s\n", seq, block_name);
} else {