Skip to content

Commit

Permalink
Merge pull request #1396 from mavlink/pr-fix-unneeded-data
Browse files Browse the repository at this point in the history
core: remove unneeded private data
  • Loading branch information
JonasVautherin committed Apr 5, 2021
2 parents 75057e0 + a6331ca commit 5f63ea7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/mavlink_statustext_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ MavlinkStatustextHandler::process(const mavlink_statustext_t& statustext)
{
char text_with_null[sizeof(statustext.text) + 1]{};
strncpy(text_with_null, statustext.text, sizeof(text_with_null) - 1);
MAV_SEVERITY severity = static_cast<MAV_SEVERITY>(statustext.severity);

if (statustext.id > 0) {
if (statustext.id != _last_id) {
_temp_multi_str = "";
_last_chunk_seq = 0;
_last_id = statustext.id;
_last_severity = static_cast<MAV_SEVERITY>(statustext.severity);
}

// We can recover from missing chunks in-between but not if the first or last one is lost.
Expand All @@ -30,11 +30,11 @@ MavlinkStatustextHandler::process(const mavlink_statustext_t& statustext)
// No zero termination yet, keep going.
return std::nullopt;
} else {
return Statustext{_temp_multi_str, _last_severity};
return Statustext{_temp_multi_str, severity};
}
}

return Statustext{text_with_null, _last_severity};
return Statustext{text_with_null, severity};
}

std::string MavlinkStatustextHandler::severity_str(MAV_SEVERITY severity)
Expand Down
1 change: 0 additions & 1 deletion src/core/mavlink_statustext_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class MavlinkStatustextHandler {
std::string _temp_multi_str{};
uint16_t _last_id{0};
uint8_t _last_chunk_seq{0};
MAV_SEVERITY _last_severity{MAV_SEVERITY_DEBUG};
};

} // namespace mavsdk

0 comments on commit 5f63ea7

Please sign in to comment.