From e655c0fc577d724a42d6bb666af814b1301feb1c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 21 May 2013 10:14:16 +0200 Subject: [PATCH] Fixed missing count --- src/modules/mavlink/mavlink_log.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/mavlink/mavlink_log.c b/src/modules/mavlink/mavlink_log.c index 1cf073fc8b..efa2e221ff 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, ...)