diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-29 18:28:37 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-05-29 18:28:37 +0200 |
commit | 46301f753d212b55e151a394bc9d4b3b787f35ef (patch) | |
tree | cc6266bb835b91d88a3010fa6218a676f37f2c60 /src | |
parent | 58c9d7a7239942ff2c28babcbf6db90fc95b98b3 (diff) | |
download | px4-firmware-46301f753d212b55e151a394bc9d4b3b787f35ef.tar.gz px4-firmware-46301f753d212b55e151a394bc9d4b3b787f35ef.tar.bz2 px4-firmware-46301f753d212b55e151a394bc9d4b3b787f35ef.zip |
Minor fixes to MAVLink
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/mavlink/mavlink_main.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index bb1ad86ef..28cdf65a3 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -190,8 +190,9 @@ mavlink_send_uart_bytes(mavlink_channel_t channel, const uint8_t *ch, int length /* check if there is space in the buffer, let it overflow else */ if (!ioctl(uart, FIONWRITE, (unsigned long)&buf_free)) { - if (desired > buf_free) { - desired = buf_free; + if (buf_free < desired) { + /* we don't want to send anything just in half, so return */ + return; } } @@ -222,6 +223,8 @@ Mavlink::Mavlink() : _subscriptions(nullptr), _streams(nullptr), _mission_pub(-1), + _mode(MAVLINK_MODE_NORMAL), + _total_counter(0), _verbose(false), _forwarding_on(false), _passing_on(false), |