mirror of
https://github.com/BotChain-Robots/control.git
synced 2026-03-10 00:32:26 +01:00
Add more examples
This commit is contained in:
@@ -23,6 +23,7 @@ bool RemoteManagement::perform_ota() {
|
||||
m_file.seekg(0, std::ios::end);
|
||||
std::streamsize total_size = m_file.tellg();
|
||||
m_file.seekg(0, std::ios::beg);
|
||||
m_total_packets = total_size/OTA_CHUNK_SIZE;
|
||||
// std::cout << "Total number of chunks: " << total_size/OTA_CHUNK_SIZE << std::endl;
|
||||
|
||||
while (m_file) {
|
||||
@@ -96,3 +97,14 @@ bool RemoteManagement::ota_end() {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
double RemoteManagement::ota_progress() {
|
||||
if (m_total_packets < 1) {
|
||||
return 0.0;
|
||||
}
|
||||
if (m_sequence_num >= m_total_packets) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
return static_cast<double>(m_sequence_num) / static_cast<double>(m_total_packets);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user