mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 15:40:31 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user