1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 19:40:22 +03:00

correct callbacks in firmware flasher, optimize speed by updating UI between read/write operations

This commit is contained in:
cTn 2014-11-15 13:44:12 +01:00
parent dc633f2421
commit 698aeb1bf9
2 changed files with 8 additions and 12 deletions

View file

@ -505,13 +505,13 @@ STM32_protocol.prototype.upload_procedure = function (step) {
self.send(array_out, 1, function (reply) { self.send(array_out, 1, function (reply) {
if (self.verify_response(self.status.ACK, reply)) { if (self.verify_response(self.status.ACK, reply)) {
// update progress bar
self.progress_bar_e.val(bytes_flashed_total / (self.hex.bytes_total * 2) * 100);
// flash another page // flash another page
write(); write();
} }
}); });
// update progress bar
self.progress_bar_e.val(Math.round(bytes_flashed_total / (self.hex.bytes_total * 2) * 100));
} }
}); });
} }
@ -580,14 +580,14 @@ STM32_protocol.prototype.upload_procedure = function (step) {
bytes_verified += bytes_to_read; bytes_verified += bytes_to_read;
bytes_verified_total += bytes_to_read; bytes_verified_total += bytes_to_read;
// update progress bar
self.progress_bar_e.val((self.hex.bytes_total + bytes_verified_total) / (self.hex.bytes_total * 2) * 100);
// verify another page // verify another page
reading(); reading();
}); });
} }
}); });
// update progress bar
self.progress_bar_e.val(Math.round((self.hex.bytes_total + bytes_verified_total) / (self.hex.bytes_total * 2) * 100));
} }
}); });
} }
@ -665,10 +665,6 @@ STM32_protocol.prototype.upload_procedure = function (step) {
// close connection // close connection
serial.disconnect(function (result) { serial.disconnect(function (result) {
if (result) { // All went as expected
} else { // Something went wrong
}
PortUsage.reset(); PortUsage.reset();
// unlocking connect button // unlocking connect button
@ -682,7 +678,7 @@ STM32_protocol.prototype.upload_procedure = function (step) {
console.log('Script finished after: ' + (timeSpent / 1000) + ' seconds'); console.log('Script finished after: ' + (timeSpent / 1000) + ' seconds');
if (self.callback) callback(); if (self.callback) self.callback();
}); });
break; break;
} }

View file

@ -474,7 +474,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
console.log('Script finished after: ' + (timeSpent / 1000) + ' seconds'); console.log('Script finished after: ' + (timeSpent / 1000) + ' seconds');
if (self.callback) callback(); if (self.callback) self.callback();
break; break;
} }
}; };