diff --git a/libraries/GCS_MAVLink/include/ardupilotmega/version.h b/libraries/GCS_MAVLink/include/ardupilotmega/version.h index 5ef5003b0b..8d3b8ac693 100644 --- a/libraries/GCS_MAVLink/include/ardupilotmega/version.h +++ b/libraries/GCS_MAVLink/include/ardupilotmega/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Sat Oct 29 18:06:02 2011" +#define MAVLINK_BUILD_DATE "Sat Oct 29 18:27:32 2011" #define MAVLINK_WIRE_PROTOCOL_VERSION "0.9" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 101 diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_auth_key.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_auth_key.h index d7becd9952..c563fb7828 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_auth_key.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_auth_key.h @@ -40,7 +40,7 @@ static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t comp #else mavlink_auth_key_t packet; - memcpy(packet.key, key, sizeof(char)*32); + mav_array_memcpy(packet.key, key, sizeof(char)*32); memcpy(_MAV_PAYLOAD(msg), &packet, 32); #endif @@ -69,7 +69,7 @@ static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t #else mavlink_auth_key_t packet; - memcpy(packet.key, key, sizeof(char)*32); + mav_array_memcpy(packet.key, key, sizeof(char)*32); memcpy(_MAV_PAYLOAD(msg), &packet, 32); #endif @@ -108,7 +108,7 @@ static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char #else mavlink_auth_key_t packet; - memcpy(packet.key, key, sizeof(char)*32); + mav_array_memcpy(packet.key, key, sizeof(char)*32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, 32); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_change_operator_control.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_change_operator_control.h index f6842e9451..6292849bd0 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_change_operator_control.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_change_operator_control.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_i packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); memcpy(_MAV_PAYLOAD(msg), &packet, 28); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t sys packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); memcpy(_MAV_PAYLOAD(msg), &packet, 28); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t ch packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, 28); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_debug_vect.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_debug_vect.h index 196d539b39..5a1a070997 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_debug_vect.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_debug_vect.h @@ -58,7 +58,7 @@ static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t co packet.x = x; packet.y = y; packet.z = z; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 30); #endif @@ -97,7 +97,7 @@ static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8 packet.x = x; packet.y = y; packet.z = z; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 30); #endif @@ -146,7 +146,7 @@ static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const cha packet.x = x; packet.y = y; packet.z = z; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, 30); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_gps_status.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_gps_status.h index 099a03af8d..c0ed8c1a78 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_gps_status.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_gps_status.h @@ -63,11 +63,11 @@ static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t co #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20); - memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20); - memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20); - memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20); - memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20); memcpy(_MAV_PAYLOAD(msg), &packet, 101); #endif @@ -105,11 +105,11 @@ static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8 #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20); - memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20); - memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20); - memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20); - memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20); memcpy(_MAV_PAYLOAD(msg), &packet, 101); #endif @@ -157,11 +157,11 @@ static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t s #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20); - memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20); - memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20); - memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20); - memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20); + mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, 101); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_float.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_float.h index 0cd255286e..7b41755d21 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_float.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_float.h @@ -43,7 +43,7 @@ static inline uint16_t mavlink_msg_named_value_float_pack(uint8_t system_id, uin #else mavlink_named_value_float_t packet; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 14); #endif @@ -73,7 +73,7 @@ static inline uint16_t mavlink_msg_named_value_float_pack_chan(uint8_t system_id #else mavlink_named_value_float_t packet; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 14); #endif @@ -113,7 +113,7 @@ static inline void mavlink_msg_named_value_float_send(mavlink_channel_t chan, co #else mavlink_named_value_float_t packet; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT, (const char *)&packet, 14); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_int.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_int.h index 7d864eb69f..a484e6e1f1 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_int.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_named_value_int.h @@ -43,7 +43,7 @@ static inline uint16_t mavlink_msg_named_value_int_pack(uint8_t system_id, uint8 #else mavlink_named_value_int_t packet; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 14); #endif @@ -73,7 +73,7 @@ static inline uint16_t mavlink_msg_named_value_int_pack_chan(uint8_t system_id, #else mavlink_named_value_int_t packet; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 14); #endif @@ -113,7 +113,7 @@ static inline void mavlink_msg_named_value_int_send(mavlink_channel_t chan, cons #else mavlink_named_value_int_t packet; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, (const char *)&packet, 14); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_object_detection_event.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_object_detection_event.h index a2ec12ec3f..fc707cb739 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_object_detection_event.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_object_detection_event.h @@ -68,7 +68,7 @@ static inline uint16_t mavlink_msg_object_detection_event_pack(uint8_t system_id packet.quality = quality; packet.bearing = bearing; packet.distance = distance; - memcpy(packet.name, name, sizeof(char)*20); + mav_array_memcpy(packet.name, name, sizeof(char)*20); memcpy(_MAV_PAYLOAD(msg), &packet, 36); #endif @@ -113,7 +113,7 @@ static inline uint16_t mavlink_msg_object_detection_event_pack_chan(uint8_t syst packet.quality = quality; packet.bearing = bearing; packet.distance = distance; - memcpy(packet.name, name, sizeof(char)*20); + mav_array_memcpy(packet.name, name, sizeof(char)*20); memcpy(_MAV_PAYLOAD(msg), &packet, 36); #endif @@ -168,7 +168,7 @@ static inline void mavlink_msg_object_detection_event_send(mavlink_channel_t cha packet.quality = quality; packet.bearing = bearing; packet.distance = distance; - memcpy(packet.name, name, sizeof(char)*20); + mav_array_memcpy(packet.name, name, sizeof(char)*20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OBJECT_DETECTION_EVENT, (const char *)&packet, 36); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_param_request_read.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_param_request_read.h index 6968420ded..d84ed5f032 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_param_request_read.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_param_request_read.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, ui packet.target_system = target_system; packet.target_component = target_component; packet.param_index = param_index; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); memcpy(_MAV_PAYLOAD(msg), &packet, 19); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_i packet.target_system = target_system; packet.target_component = target_component; packet.param_index = param_index; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); memcpy(_MAV_PAYLOAD(msg), &packet, 19); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_param_request_read_send(mavlink_channel_t chan, u packet.target_system = target_system; packet.target_component = target_component; packet.param_index = param_index; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)&packet, 19); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_param_set.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_param_set.h index a2feed407b..2703b70765 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_param_set.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_param_set.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_param_set_pack(uint8_t system_id, uint8_t com packet.target_system = target_system; packet.target_component = target_component; packet.param_value = param_value; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); memcpy(_MAV_PAYLOAD(msg), &packet, 21); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_param_set_pack_chan(uint8_t system_id, uint8_ packet.target_system = target_system; packet.target_component = target_component; packet.param_value = param_value; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); memcpy(_MAV_PAYLOAD(msg), &packet, 21); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_param_set_send(mavlink_channel_t chan, uint8_t ta packet.target_system = target_system; packet.target_component = target_component; packet.param_value = param_value; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)&packet, 21); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_param_value.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_param_value.h index 8e1408790d..1ded094763 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_param_value.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_param_value.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_param_value_pack(uint8_t system_id, uint8_t c packet.param_value = param_value; packet.param_count = param_count; packet.param_index = param_index; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); memcpy(_MAV_PAYLOAD(msg), &packet, 23); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_param_value_pack_chan(uint8_t system_id, uint packet.param_value = param_value; packet.param_count = param_count; packet.param_index = param_index; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); memcpy(_MAV_PAYLOAD(msg), &packet, 23); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_param_value_send(mavlink_channel_t chan, const in packet.param_value = param_value; packet.param_count = param_count; packet.param_index = param_index; - memcpy(packet.param_id, param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet.param_id, param_id, sizeof(int8_t)*15); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_VALUE, (const char *)&packet, 23); #endif } diff --git a/libraries/GCS_MAVLink/include/common/mavlink_msg_statustext.h b/libraries/GCS_MAVLink/include/common/mavlink_msg_statustext.h index 1dbba58a8b..da6cd7a18c 100644 --- a/libraries/GCS_MAVLink/include/common/mavlink_msg_statustext.h +++ b/libraries/GCS_MAVLink/include/common/mavlink_msg_statustext.h @@ -43,7 +43,7 @@ static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t co #else mavlink_statustext_t packet; packet.severity = severity; - memcpy(packet.text, text, sizeof(int8_t)*50); + mav_array_memcpy(packet.text, text, sizeof(int8_t)*50); memcpy(_MAV_PAYLOAD(msg), &packet, 51); #endif @@ -73,7 +73,7 @@ static inline uint16_t mavlink_msg_statustext_pack_chan(uint8_t system_id, uint8 #else mavlink_statustext_t packet; packet.severity = severity; - memcpy(packet.text, text, sizeof(int8_t)*50); + mav_array_memcpy(packet.text, text, sizeof(int8_t)*50); memcpy(_MAV_PAYLOAD(msg), &packet, 51); #endif @@ -113,7 +113,7 @@ static inline void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t s #else mavlink_statustext_t packet; packet.severity = severity; - memcpy(packet.text, text, sizeof(int8_t)*50); + mav_array_memcpy(packet.text, text, sizeof(int8_t)*50); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, 51); #endif } diff --git a/libraries/GCS_MAVLink/include/common/testsuite.h b/libraries/GCS_MAVLink/include/common/testsuite.h index 2565fb8245..b3a94e96ea 100644 --- a/libraries/GCS_MAVLink/include/common/testsuite.h +++ b/libraries/GCS_MAVLink/include/common/testsuite.h @@ -268,7 +268,7 @@ static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t comp packet1.control_request = packet_in.control_request; packet1.version = packet_in.version; - memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25); + mav_array_memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25); memset(&packet2, 0, sizeof(packet2)); @@ -358,7 +358,7 @@ static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavli mavlink_auth_key_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - memcpy(packet1.key, packet_in.key, sizeof(char)*32); + mav_array_memcpy(packet1.key, packet_in.key, sizeof(char)*32); memset(&packet2, 0, sizeof(packet2)); @@ -589,7 +589,7 @@ static void mavlink_test_param_request_read(uint8_t system_id, uint8_t component packet1.target_component = packet_in.target_component; packet1.param_index = packet_in.param_index; - memcpy(packet1.param_id, packet_in.param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(int8_t)*15); memset(&packet2, 0, sizeof(packet2)); @@ -683,7 +683,7 @@ static void mavlink_test_param_value(uint8_t system_id, uint8_t component_id, ma packet1.param_count = packet_in.param_count; packet1.param_index = packet_in.param_index; - memcpy(packet1.param_id, packet_in.param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(int8_t)*15); memset(&packet2, 0, sizeof(packet2)); @@ -732,7 +732,7 @@ static void mavlink_test_param_set(uint8_t system_id, uint8_t component_id, mavl packet1.target_component = packet_in.target_component; packet1.param_value = packet_in.param_value; - memcpy(packet1.param_id, packet_in.param_id, sizeof(int8_t)*15); + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(int8_t)*15); memset(&packet2, 0, sizeof(packet2)); @@ -901,11 +901,11 @@ static void mavlink_test_gps_status(uint8_t system_id, uint8_t component_id, mav memset(&packet1, 0, sizeof(packet1)); packet1.satellites_visible = packet_in.satellites_visible; - memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(int8_t)*20); - memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(int8_t)*20); - memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(int8_t)*20); - memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(int8_t)*20); - memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(int8_t)*20); + mav_array_memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(int8_t)*20); + mav_array_memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(int8_t)*20); + mav_array_memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(int8_t)*20); + mav_array_memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(int8_t)*20); + mav_array_memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(int8_t)*20); memset(&packet2, 0, sizeof(packet2)); @@ -3357,7 +3357,7 @@ static void mavlink_test_object_detection_event(uint8_t system_id, uint8_t compo packet1.bearing = packet_in.bearing; packet1.distance = packet_in.distance; - memcpy(packet1.name, packet_in.name, sizeof(char)*20); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*20); memset(&packet2, 0, sizeof(packet2)); @@ -3408,7 +3408,7 @@ static void mavlink_test_debug_vect(uint8_t system_id, uint8_t component_id, mav packet1.y = packet_in.y; packet1.z = packet_in.z; - memcpy(packet1.name, packet_in.name, sizeof(char)*10); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); memset(&packet2, 0, sizeof(packet2)); @@ -3453,7 +3453,7 @@ static void mavlink_test_named_value_float(uint8_t system_id, uint8_t component_ memset(&packet1, 0, sizeof(packet1)); packet1.value = packet_in.value; - memcpy(packet1.name, packet_in.name, sizeof(char)*10); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); memset(&packet2, 0, sizeof(packet2)); @@ -3498,7 +3498,7 @@ static void mavlink_test_named_value_int(uint8_t system_id, uint8_t component_id memset(&packet1, 0, sizeof(packet1)); packet1.value = packet_in.value; - memcpy(packet1.name, packet_in.name, sizeof(char)*10); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); memset(&packet2, 0, sizeof(packet2)); @@ -3543,7 +3543,7 @@ static void mavlink_test_statustext(uint8_t system_id, uint8_t component_id, mav memset(&packet1, 0, sizeof(packet1)); packet1.severity = packet_in.severity; - memcpy(packet1.text, packet_in.text, sizeof(int8_t)*50); + mav_array_memcpy(packet1.text, packet_in.text, sizeof(int8_t)*50); memset(&packet2, 0, sizeof(packet2)); diff --git a/libraries/GCS_MAVLink/include/common/version.h b/libraries/GCS_MAVLink/include/common/version.h index e5ba6ae624..b24aafc788 100644 --- a/libraries/GCS_MAVLink/include/common/version.h +++ b/libraries/GCS_MAVLink/include/common/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Sat Oct 29 18:06:02 2011" +#define MAVLINK_BUILD_DATE "Sat Oct 29 18:27:32 2011" #define MAVLINK_WIRE_PROTOCOL_VERSION "0.9" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 101 diff --git a/libraries/GCS_MAVLink/include/protocol.h b/libraries/GCS_MAVLink/include/protocol.h index e6d003413a..05195c3691 100644 --- a/libraries/GCS_MAVLink/include/protocol.h +++ b/libraries/GCS_MAVLink/include/protocol.h @@ -48,8 +48,10 @@ MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, ui uint8_t chan, uint8_t length, uint8_t crc_extra); MAVLINK_HELPER uint16_t mavlink_finalize_message(mavlink_message_t* msg, uint8_t system_id, uint8_t component_id, uint8_t length, uint8_t crc_extra); +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS MAVLINK_HELPER void _mav_finalize_message_chan_send(mavlink_channel_t chan, uint8_t msgid, const char *packet, uint8_t length, uint8_t crc_extra); +#endif #else MAVLINK_HELPER uint16_t mavlink_finalize_message_chan(mavlink_message_t* msg, uint8_t system_id, uint8_t component_id, uint8_t chan, uint8_t length); @@ -151,17 +153,24 @@ static inline void byte_copy_8(char *dst, const char *src) #define _mav_put_double(buf, wire_offset, b) *(double *)&buf[wire_offset] = b #endif +/* + like memcpy(), but if src is NULL, do a memset to zero + */ +static void mav_array_memcpy(void *dest, const void *src, size_t n) +{ + if (src == NULL) { + memset(dest, 0, n); + } else { + memcpy(dest, src, n); + } +} /* * Place a char array into a buffer */ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length) { - if (b == NULL) { - memset(&buf[wire_offset], 0, array_length); - } else { - memcpy(&buf[wire_offset], b, array_length); - } + mav_array_memcpy(&buf[wire_offset], b, array_length); } /* @@ -169,11 +178,7 @@ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const cha */ static inline void _mav_put_uint8_t_array(char *buf, uint8_t wire_offset, const uint8_t *b, uint8_t array_length) { - if (b == NULL) { - memset(&buf[wire_offset], 0, array_length); - } else { - memcpy(&buf[wire_offset], b, array_length); - } + mav_array_memcpy(&buf[wire_offset], b, array_length); } /* @@ -181,11 +186,7 @@ static inline void _mav_put_uint8_t_array(char *buf, uint8_t wire_offset, const */ static inline void _mav_put_int8_t_array(char *buf, uint8_t wire_offset, const int8_t *b, uint8_t array_length) { - if (b == NULL) { - memset(&buf[wire_offset], 0, array_length); - } else { - memcpy(&buf[wire_offset], b, array_length); - } + mav_array_memcpy(&buf[wire_offset], b, array_length); } #if MAVLINK_NEED_BYTE_SWAP @@ -205,11 +206,7 @@ static inline void _mav_put_ ## TYPE ##_array(char *buf, uint8_t wire_offset, co #define _MAV_PUT_ARRAY(TYPE, V) \ static inline void _mav_put_ ## TYPE ##_array(char *buf, uint8_t wire_offset, const TYPE *b, uint8_t array_length) \ { \ - if (b == NULL) { \ - memset(&buf[wire_offset], 0, array_length*sizeof(TYPE)); \ - } else { \ - memcpy(&buf[wire_offset], b, array_length*sizeof(TYPE)); \ - } \ + mav_array_memcpy(&buf[wire_offset], b, array_length*sizeof(TYPE)); \ } #endif diff --git a/libraries/GCS_MAVLink/include_v1.0/ardupilotmega/version.h b/libraries/GCS_MAVLink/include_v1.0/ardupilotmega/version.h index 319f99cc3d..280a8772ce 100644 --- a/libraries/GCS_MAVLink/include_v1.0/ardupilotmega/version.h +++ b/libraries/GCS_MAVLink/include_v1.0/ardupilotmega/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Sat Oct 29 18:06:03 2011" +#define MAVLINK_BUILD_DATE "Sat Oct 29 18:27:33 2011" #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 101 diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_auth_key.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_auth_key.h index 366805f111..cc77e4e549 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_auth_key.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_auth_key.h @@ -40,7 +40,7 @@ static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t comp #else mavlink_auth_key_t packet; - memcpy(packet.key, key, sizeof(char)*32); + mav_array_memcpy(packet.key, key, sizeof(char)*32); memcpy(_MAV_PAYLOAD(msg), &packet, 32); #endif @@ -69,7 +69,7 @@ static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t #else mavlink_auth_key_t packet; - memcpy(packet.key, key, sizeof(char)*32); + mav_array_memcpy(packet.key, key, sizeof(char)*32); memcpy(_MAV_PAYLOAD(msg), &packet, 32); #endif @@ -108,7 +108,7 @@ static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char #else mavlink_auth_key_t packet; - memcpy(packet.key, key, sizeof(char)*32); + mav_array_memcpy(packet.key, key, sizeof(char)*32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, 32, 119); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_change_operator_control.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_change_operator_control.h index 1b164d0b86..d18194e2da 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_change_operator_control.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_change_operator_control.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_i packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); memcpy(_MAV_PAYLOAD(msg), &packet, 28); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t sys packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); memcpy(_MAV_PAYLOAD(msg), &packet, 28); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t ch packet.target_system = target_system; packet.control_request = control_request; packet.version = version; - memcpy(packet.passkey, passkey, sizeof(char)*25); + mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, 28, 217); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_debug_vect.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_debug_vect.h index 7d0b6e6e67..8f3b909728 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_debug_vect.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_debug_vect.h @@ -58,7 +58,7 @@ static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t co packet.x = x; packet.y = y; packet.z = z; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 30); #endif @@ -97,7 +97,7 @@ static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8 packet.x = x; packet.y = y; packet.z = z; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 30); #endif @@ -146,7 +146,7 @@ static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const cha packet.x = x; packet.y = y; packet.z = z; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, 30, 49); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_gps_status.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_gps_status.h index f363daa96a..5ae1f3ab1c 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_gps_status.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_gps_status.h @@ -63,11 +63,11 @@ static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t co #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); - memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); - memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); - memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); - memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); memcpy(_MAV_PAYLOAD(msg), &packet, 101); #endif @@ -105,11 +105,11 @@ static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8 #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); - memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); - memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); - memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); - memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); memcpy(_MAV_PAYLOAD(msg), &packet, 101); #endif @@ -157,11 +157,11 @@ static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t s #else mavlink_gps_status_t packet; packet.satellites_visible = satellites_visible; - memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); - memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); - memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); - memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); - memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(uint8_t)*20); + mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(uint8_t)*20); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, 101, 23); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_memory_vect.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_memory_vect.h index fadb79ef98..e59db361a7 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_memory_vect.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_memory_vect.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_memory_vect_pack(uint8_t system_id, uint8_t c packet.address = address; packet.ver = ver; packet.type = type; - memcpy(packet.value, value, sizeof(int8_t)*32); + mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); memcpy(_MAV_PAYLOAD(msg), &packet, 36); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_memory_vect_pack_chan(uint8_t system_id, uint packet.address = address; packet.ver = ver; packet.type = type; - memcpy(packet.value, value, sizeof(int8_t)*32); + mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); memcpy(_MAV_PAYLOAD(msg), &packet, 36); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_memory_vect_send(mavlink_channel_t chan, uint16_t packet.address = address; packet.ver = ver; packet.type = type; - memcpy(packet.value, value, sizeof(int8_t)*32); + mav_array_memcpy(packet.value, value, sizeof(int8_t)*32); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)&packet, 36, 204); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_float.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_float.h index c783558648..feabb8f31e 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_float.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_float.h @@ -48,7 +48,7 @@ static inline uint16_t mavlink_msg_named_value_float_pack(uint8_t system_id, uin mavlink_named_value_float_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 18); #endif @@ -81,7 +81,7 @@ static inline uint16_t mavlink_msg_named_value_float_pack_chan(uint8_t system_id mavlink_named_value_float_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 18); #endif @@ -124,7 +124,7 @@ static inline void mavlink_msg_named_value_float_send(mavlink_channel_t chan, ui mavlink_named_value_float_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT, (const char *)&packet, 18, 170); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_int.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_int.h index 917f1efa0c..463b44d67e 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_int.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_named_value_int.h @@ -48,7 +48,7 @@ static inline uint16_t mavlink_msg_named_value_int_pack(uint8_t system_id, uint8 mavlink_named_value_int_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 18); #endif @@ -81,7 +81,7 @@ static inline uint16_t mavlink_msg_named_value_int_pack_chan(uint8_t system_id, mavlink_named_value_int_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); memcpy(_MAV_PAYLOAD(msg), &packet, 18); #endif @@ -124,7 +124,7 @@ static inline void mavlink_msg_named_value_int_send(mavlink_channel_t chan, uint mavlink_named_value_int_t packet; packet.time_boot_ms = time_boot_ms; packet.value = value; - memcpy(packet.name, name, sizeof(char)*10); + mav_array_memcpy(packet.name, name, sizeof(char)*10); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, (const char *)&packet, 18, 44); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_request_read.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_request_read.h index 26965431ae..92fac8037c 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_request_read.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_request_read.h @@ -53,7 +53,7 @@ static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, ui packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); memcpy(_MAV_PAYLOAD(msg), &packet, 20); #endif @@ -89,7 +89,7 @@ static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_i packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); memcpy(_MAV_PAYLOAD(msg), &packet, 20); #endif @@ -135,7 +135,7 @@ static inline void mavlink_msg_param_request_read_send(mavlink_channel_t chan, u packet.param_index = param_index; packet.target_system = target_system; packet.target_component = target_component; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)&packet, 20, 214); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_set.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_set.h index a463c69458..d65412d176 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_set.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_set.h @@ -58,7 +58,7 @@ static inline uint16_t mavlink_msg_param_set_pack(uint8_t system_id, uint8_t com packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); memcpy(_MAV_PAYLOAD(msg), &packet, 23); #endif @@ -97,7 +97,7 @@ static inline uint16_t mavlink_msg_param_set_pack_chan(uint8_t system_id, uint8_ packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); memcpy(_MAV_PAYLOAD(msg), &packet, 23); #endif @@ -146,7 +146,7 @@ static inline void mavlink_msg_param_set_send(mavlink_channel_t chan, uint8_t ta packet.target_system = target_system; packet.target_component = target_component; packet.param_type = param_type; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)&packet, 23, 168); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_value.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_value.h index 858921be39..c972ebaa38 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_value.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_param_value.h @@ -58,7 +58,7 @@ static inline uint16_t mavlink_msg_param_value_pack(uint8_t system_id, uint8_t c packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); memcpy(_MAV_PAYLOAD(msg), &packet, 25); #endif @@ -97,7 +97,7 @@ static inline uint16_t mavlink_msg_param_value_pack_chan(uint8_t system_id, uint packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); memcpy(_MAV_PAYLOAD(msg), &packet, 25); #endif @@ -146,7 +146,7 @@ static inline void mavlink_msg_param_value_send(mavlink_channel_t chan, const ch packet.param_count = param_count; packet.param_index = param_index; packet.param_type = param_type; - memcpy(packet.param_id, param_id, sizeof(char)*16); + mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_VALUE, (const char *)&packet, 25, 220); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_statustext.h b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_statustext.h index 90271de8d1..1e1d38d2c7 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_statustext.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/mavlink_msg_statustext.h @@ -43,7 +43,7 @@ static inline uint16_t mavlink_msg_statustext_pack(uint8_t system_id, uint8_t co #else mavlink_statustext_t packet; packet.severity = severity; - memcpy(packet.text, text, sizeof(char)*50); + mav_array_memcpy(packet.text, text, sizeof(char)*50); memcpy(_MAV_PAYLOAD(msg), &packet, 51); #endif @@ -73,7 +73,7 @@ static inline uint16_t mavlink_msg_statustext_pack_chan(uint8_t system_id, uint8 #else mavlink_statustext_t packet; packet.severity = severity; - memcpy(packet.text, text, sizeof(char)*50); + mav_array_memcpy(packet.text, text, sizeof(char)*50); memcpy(_MAV_PAYLOAD(msg), &packet, 51); #endif @@ -113,7 +113,7 @@ static inline void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t s #else mavlink_statustext_t packet; packet.severity = severity; - memcpy(packet.text, text, sizeof(char)*50); + mav_array_memcpy(packet.text, text, sizeof(char)*50); _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STATUSTEXT, (const char *)&packet, 51, 83); #endif } diff --git a/libraries/GCS_MAVLink/include_v1.0/common/testsuite.h b/libraries/GCS_MAVLink/include_v1.0/common/testsuite.h index 5d4681435c..a5089f5997 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/testsuite.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/testsuite.h @@ -255,7 +255,7 @@ static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t comp packet1.control_request = packet_in.control_request; packet1.version = packet_in.version; - memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25); + mav_array_memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25); memset(&packet2, 0, sizeof(packet2)); @@ -345,7 +345,7 @@ static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavli mavlink_auth_key_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); - memcpy(packet1.key, packet_in.key, sizeof(char)*32); + mav_array_memcpy(packet1.key, packet_in.key, sizeof(char)*32); memset(&packet2, 0, sizeof(packet2)); @@ -441,7 +441,7 @@ static void mavlink_test_param_request_read(uint8_t system_id, uint8_t component packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; - memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); memset(&packet2, 0, sizeof(packet2)); @@ -537,7 +537,7 @@ static void mavlink_test_param_value(uint8_t system_id, uint8_t component_id, ma packet1.param_index = packet_in.param_index; packet1.param_type = packet_in.param_type; - memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); memset(&packet2, 0, sizeof(packet2)); @@ -588,7 +588,7 @@ static void mavlink_test_param_set(uint8_t system_id, uint8_t component_id, mavl packet1.target_component = packet_in.target_component; packet1.param_type = packet_in.param_type; - memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); + mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); memset(&packet2, 0, sizeof(packet2)); @@ -698,11 +698,11 @@ static void mavlink_test_gps_status(uint8_t system_id, uint8_t component_id, mav memset(&packet1, 0, sizeof(packet1)); packet1.satellites_visible = packet_in.satellites_visible; - memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(uint8_t)*20); - memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(uint8_t)*20); - memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(uint8_t)*20); - memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(uint8_t)*20); - memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(uint8_t)*20); + mav_array_memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(uint8_t)*20); + mav_array_memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(uint8_t)*20); + mav_array_memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(uint8_t)*20); + mav_array_memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(uint8_t)*20); + mav_array_memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(uint8_t)*20); memset(&packet2, 0, sizeof(packet2)); @@ -3510,7 +3510,7 @@ static void mavlink_test_memory_vect(uint8_t system_id, uint8_t component_id, ma packet1.ver = packet_in.ver; packet1.type = packet_in.type; - memcpy(packet1.value, packet_in.value, sizeof(int8_t)*32); + mav_array_memcpy(packet1.value, packet_in.value, sizeof(int8_t)*32); memset(&packet2, 0, sizeof(packet2)); @@ -3561,7 +3561,7 @@ static void mavlink_test_debug_vect(uint8_t system_id, uint8_t component_id, mav packet1.y = packet_in.y; packet1.z = packet_in.z; - memcpy(packet1.name, packet_in.name, sizeof(char)*10); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); memset(&packet2, 0, sizeof(packet2)); @@ -3608,7 +3608,7 @@ static void mavlink_test_named_value_float(uint8_t system_id, uint8_t component_ packet1.time_boot_ms = packet_in.time_boot_ms; packet1.value = packet_in.value; - memcpy(packet1.name, packet_in.name, sizeof(char)*10); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); memset(&packet2, 0, sizeof(packet2)); @@ -3655,7 +3655,7 @@ static void mavlink_test_named_value_int(uint8_t system_id, uint8_t component_id packet1.time_boot_ms = packet_in.time_boot_ms; packet1.value = packet_in.value; - memcpy(packet1.name, packet_in.name, sizeof(char)*10); + mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); memset(&packet2, 0, sizeof(packet2)); @@ -3700,7 +3700,7 @@ static void mavlink_test_statustext(uint8_t system_id, uint8_t component_id, mav memset(&packet1, 0, sizeof(packet1)); packet1.severity = packet_in.severity; - memcpy(packet1.text, packet_in.text, sizeof(char)*50); + mav_array_memcpy(packet1.text, packet_in.text, sizeof(char)*50); memset(&packet2, 0, sizeof(packet2)); diff --git a/libraries/GCS_MAVLink/include_v1.0/common/version.h b/libraries/GCS_MAVLink/include_v1.0/common/version.h index 90470e5e78..0b6352c3c1 100644 --- a/libraries/GCS_MAVLink/include_v1.0/common/version.h +++ b/libraries/GCS_MAVLink/include_v1.0/common/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Sat Oct 29 18:06:03 2011" +#define MAVLINK_BUILD_DATE "Sat Oct 29 18:27:33 2011" #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 101 diff --git a/libraries/GCS_MAVLink/include_v1.0/protocol.h b/libraries/GCS_MAVLink/include_v1.0/protocol.h index 27c2396836..05195c3691 100644 --- a/libraries/GCS_MAVLink/include_v1.0/protocol.h +++ b/libraries/GCS_MAVLink/include_v1.0/protocol.h @@ -153,17 +153,24 @@ static inline void byte_copy_8(char *dst, const char *src) #define _mav_put_double(buf, wire_offset, b) *(double *)&buf[wire_offset] = b #endif +/* + like memcpy(), but if src is NULL, do a memset to zero + */ +static void mav_array_memcpy(void *dest, const void *src, size_t n) +{ + if (src == NULL) { + memset(dest, 0, n); + } else { + memcpy(dest, src, n); + } +} /* * Place a char array into a buffer */ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length) { - if (b == NULL) { - memset(&buf[wire_offset], 0, array_length); - } else { - memcpy(&buf[wire_offset], b, array_length); - } + mav_array_memcpy(&buf[wire_offset], b, array_length); } /* @@ -171,11 +178,7 @@ static inline void _mav_put_char_array(char *buf, uint8_t wire_offset, const cha */ static inline void _mav_put_uint8_t_array(char *buf, uint8_t wire_offset, const uint8_t *b, uint8_t array_length) { - if (b == NULL) { - memset(&buf[wire_offset], 0, array_length); - } else { - memcpy(&buf[wire_offset], b, array_length); - } + mav_array_memcpy(&buf[wire_offset], b, array_length); } /* @@ -183,11 +186,7 @@ static inline void _mav_put_uint8_t_array(char *buf, uint8_t wire_offset, const */ static inline void _mav_put_int8_t_array(char *buf, uint8_t wire_offset, const int8_t *b, uint8_t array_length) { - if (b == NULL) { - memset(&buf[wire_offset], 0, array_length); - } else { - memcpy(&buf[wire_offset], b, array_length); - } + mav_array_memcpy(&buf[wire_offset], b, array_length); } #if MAVLINK_NEED_BYTE_SWAP @@ -207,11 +206,7 @@ static inline void _mav_put_ ## TYPE ##_array(char *buf, uint8_t wire_offset, co #define _MAV_PUT_ARRAY(TYPE, V) \ static inline void _mav_put_ ## TYPE ##_array(char *buf, uint8_t wire_offset, const TYPE *b, uint8_t array_length) \ { \ - if (b == NULL) { \ - memset(&buf[wire_offset], 0, array_length*sizeof(TYPE)); \ - } else { \ - memcpy(&buf[wire_offset], b, array_length*sizeof(TYPE)); \ - } \ + mav_array_memcpy(&buf[wire_offset], b, array_length*sizeof(TYPE)); \ } #endif