diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-05-21 10:14:16 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-05-21 10:14:16 +0200 |
commit | e655c0fc577d724a42d6bb666af814b1301feb1c (patch) | |
tree | 8af91510a682733df2d126b416bdb8f564b1dcfe /src/modules | |
parent | 5dfde44c56e8fc833ea08a246b49076256819ba0 (diff) | |
download | px4-firmware-e655c0fc577d724a42d6bb666af814b1301feb1c.tar.gz px4-firmware-e655c0fc577d724a42d6bb666af814b1301feb1c.tar.bz2 px4-firmware-e655c0fc577d724a42d6bb666af814b1301feb1c.zip |
Fixed missing count
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/mavlink/mavlink_log.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/modules/mavlink/mavlink_log.c b/src/modules/mavlink/mavlink_log.c index 1cf073fc8..efa2e221f 100644 --- a/src/modules/mavlink/mavlink_log.c +++ b/src/modules/mavlink/mavlink_log.c @@ -97,6 +97,14 @@ void mavlink_logbuffer_vasprintf(struct mavlink_logbuffer *lb, int severity, con lb->elems[end].severity = severity; vsnprintf(lb->elems[end].text, sizeof(lb->elems[0].text), fmt, ap); va_end(ap); + + /* increase count */ + if (mavlink_logbuffer_is_full(lb)) { + lb->start = (lb->start + 1) % lb->size; /* full, overwrite */ + + } else { + ++lb->count; + } } __EXPORT void mavlink_vasprintf(int _fd, int severity, const char *fmt, ...) |