GCS_Param: correct sending of parameters of length 16
This commit is contained in:
parent
5ffb8bb546
commit
c6533723de
@ -304,8 +304,9 @@ void GCS_MAVLINK::handle_param_set(mavlink_message_t *msg)
|
||||
*/
|
||||
void GCS::send_parameter_value(const char *param_name, ap_var_type param_type, float param_value)
|
||||
{
|
||||
mavlink_param_value_t packet;
|
||||
strncpy(packet.param_id, param_name, ARRAY_SIZE(packet.param_id));
|
||||
mavlink_param_value_t packet{};
|
||||
const uint8_t to_copy = MIN(ARRAY_SIZE(packet.param_id), strlen(param_name));
|
||||
memcpy(packet.param_id, param_name, to_copy);
|
||||
packet.param_value = param_value;
|
||||
packet.param_type = mav_param_type(param_type);
|
||||
packet.param_count = AP_Param::count_parameters();
|
||||
|
Loading…
Reference in New Issue
Block a user