diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-20 09:07:33 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-20 09:07:33 +0200 |
commit | 2c8fafd12af505f0f6dbcce521c99f7cd76109ca (patch) | |
tree | a4fbfbb6ce3662c1e7df37240e281f05bbe13d19 /apps/mavlink/mavlink.c | |
parent | 4a7f92fad0f5f7170038690e3e35af889bddae78 (diff) | |
download | px4-firmware-2c8fafd12af505f0f6dbcce521c99f7cd76109ca.tar.gz px4-firmware-2c8fafd12af505f0f6dbcce521c99f7cd76109ca.tar.bz2 px4-firmware-2c8fafd12af505f0f6dbcce521c99f7cd76109ca.zip |
Reworked MAVLink parameter interface to support new parameter storage, tested.
Diffstat (limited to 'apps/mavlink/mavlink.c')
-rw-r--r-- | apps/mavlink/mavlink.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/mavlink/mavlink.c b/apps/mavlink/mavlink.c index 47eab6be8..1ac3f907a 100644 --- a/apps/mavlink/mavlink.c +++ b/apps/mavlink/mavlink.c @@ -151,8 +151,8 @@ static enum { void mavlink_wpm_send_message(mavlink_message_t *msg); void mavlink_wpm_send_gcs_string(const char *string); uint64_t mavlink_wpm_get_system_timestamp(void); -void mavlink_missionlib_send_message(mavlink_message_t *msg); -void mavlink_missionlib_send_gcs_string(const char *string); +int mavlink_missionlib_send_message(mavlink_message_t *msg); +int mavlink_missionlib_send_gcs_string(const char *string); uint64_t mavlink_missionlib_get_system_timestamp(void); void handleMessage(mavlink_message_t *msg); @@ -183,13 +183,18 @@ static void usage(const char *reason); static uint8_t missionlib_msg_buf[MAVLINK_MAX_PACKET_LEN]; -void mavlink_missionlib_send_message(mavlink_message_t *msg) +int mavlink_missionlib_send_message(mavlink_message_t *msg) { uint16_t len = mavlink_msg_to_send_buffer(missionlib_msg_buf, msg); - write(uart, missionlib_msg_buf, len); + int writelen = write(uart, missionlib_msg_buf, len); + if (writelen != len) { + return 1; + } else { + return 0; + } } -void mavlink_missionlib_send_gcs_string(const char *string) +int mavlink_missionlib_send_gcs_string(const char *string) { const int len = MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN; mavlink_statustext_t statustext; @@ -210,7 +215,9 @@ void mavlink_missionlib_send_gcs_string(const char *string) mavlink_message_t msg; mavlink_msg_statustext_encode(mavlink_system.sysid, mavlink_system.compid, &msg, &statustext); - mavlink_missionlib_send_message(&msg); + return mavlink_missionlib_send_message(&msg); + } else { + return 1; } } |