mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 04:45:20 +03:00
Be aware of async nature of the procedure
This commit is contained in:
parent
99ab8a945c
commit
2c62a0dc9d
1 changed files with 7 additions and 8 deletions
|
@ -64,6 +64,7 @@ var STM32DFU_protocol = function () {
|
||||||
|
|
||||||
this.chipInfo = null; // information about chip's memory
|
this.chipInfo = null; // information about chip's memory
|
||||||
this.flash_layout = { 'start_address': 0, 'total_size': 0, 'sectors': []};
|
this.flash_layout = { 'start_address': 0, 'total_size': 0, 'sectors': []};
|
||||||
|
this.transferSize = 2048; // Default USB DFU transfer size for F3,F4 and F7
|
||||||
};
|
};
|
||||||
|
|
||||||
STM32DFU_protocol.prototype.connect = function (device, hex, options, callback) {
|
STM32DFU_protocol.prototype.connect = function (device, hex, options, callback) {
|
||||||
|
@ -558,18 +559,16 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
|
||||||
(self.available_flash_size / 1024.0).toFixed(1)]));
|
(self.available_flash_size / 1024.0).toFixed(1)]));
|
||||||
self.upload_procedure(99);
|
self.upload_procedure(99);
|
||||||
} else {
|
} else {
|
||||||
self.clearStatus(function () {
|
self.getFunctionalDescriptor(0, function (descriptor, resultCode) {
|
||||||
self.upload_procedure(1);
|
self.transferSize = resultCode ? 2048 : descriptor.wTransferSize;
|
||||||
|
console.log('Using transfer size: ' + self.transferSize);
|
||||||
|
self.clearStatus(function () {
|
||||||
|
self.upload_procedure(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.getFunctionalDescriptor(0, function (descriptor, resultCode) {
|
|
||||||
self.transferSize = resultCode ? 2048 : descriptor.wTransferSize;
|
|
||||||
console.log('Using transfer size: ' + self.transferSize);
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (typeof self.chipInfo.option_bytes === "undefined") {
|
if (typeof self.chipInfo.option_bytes === "undefined") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue