diff options
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, ...) |