From d7b9202d7742f9f6949bbc945bb656593e5ccae0 Mon Sep 17 00:00:00 2001 From: muramura Date: Tue, 6 May 2025 00:42:38 +0900 Subject: [PATCH] AP_Logger: Refactor the process --- libraries/AP_Logger/AP_Logger_MAVLink.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libraries/AP_Logger/AP_Logger_MAVLink.cpp b/libraries/AP_Logger/AP_Logger_MAVLink.cpp index c3670d32087f2..4232ac5e52a65 100644 --- a/libraries/AP_Logger/AP_Logger_MAVLink.cpp +++ b/libraries/AP_Logger/AP_Logger_MAVLink.cpp @@ -120,10 +120,7 @@ bool AP_Logger_MAVLink::free_seqno_from_queue(uint32_t seqno, dm_block_queue_t & bool AP_Logger_MAVLink::WritesOK() const { - if (!_sending_to_client) { - return false; - } - return true; + return _sending_to_client; } /* Write a block of data at current offset */ @@ -311,6 +308,7 @@ void AP_Logger_MAVLink::stats_init() { stats.resends = 0; stats_reset(); } + void AP_Logger_MAVLink::stats_reset() { stats.state_free = 0; stats.state_free_min = -1; // unsigned wrap @@ -354,10 +352,7 @@ void AP_Logger_MAVLink::Write_DMS(AP_Logger_MAVLink &logger_mav) void AP_Logger_MAVLink::stats_log() { - if (!_initialised) { - return; - } - if (stats.collection_count == 0) { + if (!_initialised || stats.collection_count == 0) { return; } Write_DMS(*this); @@ -391,6 +386,7 @@ uint8_t AP_Logger_MAVLink::stack_size(struct dm_block *stack) } return ret; } + uint8_t AP_Logger_MAVLink::queue_size(dm_block_queue_t queue) { return stack_size(queue.oldest);