Skip to content

Commit

Permalink
Merge pull request #1180 from NicolasM0/fix_log_file_chunks_received_…
Browse files Browse the repository at this point in the history
…size

log_files: fix chunks_received size in download_log_file
  • Loading branch information
JonasVautherin authored Aug 28, 2020
2 parents 2efde2f + 4a42999 commit a2fd088
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/core/mavsdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,4 @@ void Mavsdk::Configuration::set_usage_type(Mavsdk::Configuration::UsageType usag
_usage_type = usage_type;
}


} // namespace mavsdk
2 changes: 1 addition & 1 deletion src/core/mavsdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class Mavsdk {
*/
uint8_t get_system_id() const;

/**
/**
* @brief Set the system id of this configuration.
*/
void set_system_id(uint8_t system_id);
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/log_files/log_files_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ void LogFilesImpl::download_log_file_async(
_data.part_start = 0;
const auto part_size = determine_part_end() - _data.part_start;
_data.bytes.resize(part_size);
_data.chunks_received.resize(part_size / MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN);
_data.chunks_received.resize(
part_size / MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN +
((part_size % MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN) != 0));

_parent->register_timeout_handler(
std::bind(&LogFilesImpl::data_timeout, this), DATA_TIMEOUT_S, &_data.cookie);
Expand Down Expand Up @@ -376,7 +378,9 @@ void LogFilesImpl::check_part()

const auto part_size = determine_part_end() - _data.part_start;
_data.bytes.resize(part_size);
_data.chunks_received.resize(part_size / MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN);
_data.chunks_received.resize(
part_size / MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN +
((part_size % MAVLINK_MSG_LOG_DATA_FIELD_DATA_LEN) != 0));
std::fill(_data.chunks_received.begin(), _data.chunks_received.end(), false);

request_log_data(_data.id, _data.part_start, _data.bytes.size());
Expand Down

0 comments on commit a2fd088

Please sign in to comment.