Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reput firmware restore #987

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions aseba/thymio-device-manager/aseba_endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,17 @@ void aseba_endpoint::handle_read(boost::system::error_code ec, std::shared_ptr<A
if(ec || !msg) {
if(!ec && !msg && !m_upgrading_firmware)
read_aseba_message();


if(!m_has_had_sucessful_read)
restore_firmware();
return;

mLogError("Error while reading aseba message {}", ec ? ec.message() : "Message corrupted");
return;
}
mLogTrace("Message received : '{}' {}", msg->message_name(), ec.message());

m_has_had_sucessful_read = true;

auto node_id = msg->source;
auto it = m_nodes.find(node_id);
auto node = it == std::end(m_nodes) ? std::shared_ptr<aseba_node>{} : it->second.node;
Expand Down
1 change: 1 addition & 0 deletions aseba/thymio-device-manager/aseba_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class aseba_endpoint : public std::enable_shared_from_this<aseba_endpoint> {
node_id m_uuid;

bool m_upgrading_firmware = false;
bool m_has_had_sucessful_read = false;
bool m_first_ping = true;
bool m_rebooting = false;
};
Expand Down