logger: do not try to wait for mavlink ack when writing watchdog data

As it might block for 2.5s (if mavlink is blocked) and therefore would not
write to file before restoring the priorities.
This commit is contained in:
Beat Küng
2023-02-17 12:16:48 +01:00
committed by Daniel Agar
parent 66b0f6eb35
commit fe3c1d0a92
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -150,11 +150,11 @@ public:
* Indicate to the underlying backend whether future write_message() calls need a reliable
* transfer. Needed for header integrity.
*/
void set_need_reliable_transfer(bool need_reliable)
void set_need_reliable_transfer(bool need_reliable, bool mavlink_backed_too = true)
{
if (_log_writer_file) { _log_writer_file->set_need_reliable_transfer(need_reliable); }
if (_log_writer_mavlink) { _log_writer_mavlink->set_need_reliable_transfer(need_reliable); }
if (_log_writer_mavlink) { _log_writer_mavlink->set_need_reliable_transfer(need_reliable && mavlink_backed_too); }
}
bool need_reliable_transfer() const
+2 -1
View File
@@ -1601,6 +1601,8 @@ void Logger::initialize_load_output(PrintLoadReason reason)
void Logger::write_load_output()
{
_writer.set_need_reliable_transfer(true, _print_load_reason != PrintLoadReason::Watchdog);
if (_print_load_reason == PrintLoadReason::Watchdog) {
PX4_ERR("Writing watchdog data"); // this is just that we see it easily in the log
write_perf_data(PrintLoadReason::Watchdog);
@@ -1611,7 +1613,6 @@ void Logger::write_load_output()
callback_data.logger = this;
callback_data.counter = 0;
callback_data.buffer = buffer;
_writer.set_need_reliable_transfer(true);
// TODO: maybe we should restrict the output to a selected backend (eg. when file logging is running
// and mavlink log is started, this will be added to the file as well)
print_load_buffer(buffer, sizeof(buffer), print_load_callback, &callback_data, &_load);