Skip to content

Commit

Permalink
Revert "mavlink_ulog: always update ulog_stream_acked uorb even check…
Browse files Browse the repository at this point in the history
…_for_updates not set"

This reverts commit f3a8744.

Updating and sometimes ignoring ulog_stream_acked reduces the load, but may cause log to
be corrupted due to missing definition data. Need to revert the patch to avoid
broken log files.
  • Loading branch information
Jari Nippula committed Jan 25, 2024
1 parent ebd9f38 commit 0357a57
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions src/modules/mavlink/mavlink_ulog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,33 +180,31 @@ int MavlinkULog::handle_update(mavlink_channel_t channel)
++_current_num_msgs;
}

if (_ulog_stream_acked_sub.updated()) {
if (check_for_updates && _ulog_stream_acked_sub.updated()) {
_ulog_stream_acked_sub.update();

if (check_for_updates) {
const ulog_stream_s &ulog_data = _ulog_stream_acked_sub.get();
const ulog_stream_s &ulog_data = _ulog_stream_acked_sub.get();

if (ulog_data.timestamp > 0) {
_sent_tries = 1;
_last_sent_time = hrt_absolute_time();
lock();
_wait_for_ack_sequence = ulog_data.msg_sequence;
_ack_received = false;
unlock();

mavlink_logging_data_acked_t msg;
msg.sequence = ulog_data.msg_sequence;
msg.length = ulog_data.length;
msg.first_message_offset = ulog_data.first_message_offset;
msg.target_system = _target_system;
msg.target_component = _target_component;
memcpy(msg.data, ulog_data.data, sizeof(msg.data));
mavlink_msg_logging_data_acked_send_struct(channel, &msg);

}
if (ulog_data.timestamp > 0) {
_sent_tries = 1;
_last_sent_time = hrt_absolute_time();
lock();
_wait_for_ack_sequence = ulog_data.msg_sequence;
_ack_received = false;
unlock();

mavlink_logging_data_acked_t msg;
msg.sequence = ulog_data.msg_sequence;
msg.length = ulog_data.length;
msg.first_message_offset = ulog_data.first_message_offset;
msg.target_system = _target_system;
msg.target_component = _target_component;
memcpy(msg.data, ulog_data.data, sizeof(msg.data));
mavlink_msg_logging_data_acked_send_struct(channel, &msg);

++_current_num_msgs;
}

++_current_num_msgs;
}
}

Expand Down

0 comments on commit 0357a57

Please sign in to comment.