1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

add / implement flash slowly option in firmware flasher

this will allow flashing via serial adapters that doesn't support 921600
flashing via various bluetooth adapters will be also possible now
(untested)
This commit is contained in:
cTn 2014-08-30 08:59:21 +02:00
parent 6dec7dfbc1
commit 322af92d45
4 changed files with 41 additions and 10 deletions

View file

@ -51,11 +51,12 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options) {
var self = this;
self.hex = hex;
// we will crunch the options here since doing it inside initialization routine would be too late / redundant
// we will crunch the options here since doing it inside initialization routine would be too late
self.options = {
no_reboot: false,
reboot_baud: false,
erase_chip: false
erase_chip: false,
flash_slowly: false
};
if (options.no_reboot) {
@ -68,8 +69,12 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options) {
self.options.erase_chip = true;
}
if (options.flash_slowly) {
self.options.flash_slowly = true;
}
if (self.options.no_reboot) {
serial.connect(port, {bitrate: baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
serial.connect(port, {bitrate: (!self.options.flash_slowly) ? baud : 115200, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
if (openInfo) {
// we are connected, disabling connect button in the UI
GUI.connect_lock = true;
@ -95,7 +100,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options) {
serial.send(bufferOut, function () {
serial.disconnect(function (result) {
if (result) {
serial.connect(port, {bitrate: baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
serial.connect(port, {bitrate: (!self.options.flash_slowly) ? baud : 115200, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
if (openInfo) {
self.initialize();
} else {