1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-14 11:59:51 +03:00

AT32 MCU DFU added

This commit is contained in:
Ernest Stepanov (ErNis) 2023-02-02 15:05:34 +02:00
parent 5a6c2d7040
commit cf35bd6142
5 changed files with 17 additions and 6 deletions

View file

@ -1,7 +1,10 @@
'use strict';
var usbDevices = {
STM32DFU: {'vendorId': 1155, 'productId': 57105}
filters: [
{'vendorId': 1155, 'productId': 57105},
{'vendorId': 11836, 'productId': 57105}
]
};
var PortHandler = new function () {
@ -152,7 +155,7 @@ PortHandler.check = function () {
};
PortHandler.check_usb_devices = function (callback) {
chrome.usb.getDevices(usbDevices.STM32DFU, function (result) {
chrome.usb.getDevices(usbDevices, function (result) {
if (result.length) {
if (!$("div#port-picker #port [value='DFU']").length) {
$('div#port-picker #port').append($('<option/>', {value: "DFU", text: "DFU", data: {isDFU: true}}));
@ -166,7 +169,7 @@ PortHandler.check_usb_devices = function (callback) {
self.dfu_available = false;
}
if(callback) callback(self.dfu_available);
if (callback) callback(self.dfu_available);
});
};

View file

@ -115,7 +115,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
PortHandler.check_usb_devices(function(dfu_available) {
if (dfu_available) {
clearInterval(interval);
STM32DFU.connect(usbDevices.STM32DFU, hex, options);
STM32DFU.connect(usbDevices, hex, options);
return;
}
// Check for the serial port

View file

@ -336,6 +336,8 @@ STM32DFU_protocol.prototype.getChipInfo = function (_interface, callback) {
// H750 SPRacing H7 EXST: "@External Flash /0x90000000/998*128Kg,1*128Kg,4*128Kg,21*128Ka"
// H750 SPRacing H7 EXST: "@External Flash /0x90000000/1001*128Kg,3*128Kg,20*128Ka" - Early BL firmware with incorrect string, treat as above.
// AT32F435: "@Internal Flash /0x08000000/512*002Kg,@Option byte /0x1FFFC000/01*512 g"
// H750 Partitions: Flash, Config, Firmware, 1x BB Management block + x BB Replacement blocks)
if (str == "@External Flash /0x90000000/1001*128Kg,3*128Kg,20*128Ka") {
str = "@External Flash /0x90000000/998*128Kg,1*128Kg,4*128Kg,21*128Ka";
@ -617,6 +619,11 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
});
break;
case 1:
// workaroud for AT32
if (typeof self.chipInfo.option_bytes === "undefined" && typeof self.chipInfo.option_byte !== "undefined") {
self.chipInfo.option_bytes = self.chipInfo.option_byte;
}
if (typeof self.chipInfo.option_bytes === "undefined") {
console.log('Failed to detect option bytes');
self.cleanup();

View file

@ -47,7 +47,8 @@
"notifications",
"alwaysOnTopWindows",
{"usbDevices": [
{"vendorId": 1155, "productId": 57105}
{"vendorId": 1155, "productId": 57105},
{"vendorId": 11836, "productId": 57105}
]}
],

View file

@ -405,7 +405,7 @@ TABS.firmware_flasher.initialize = function (callback) {
GUI.log('<span style="color: red">Please select valid serial port</span>');
}
} else {
STM32DFU.connect(usbDevices.STM32DFU, parsed_hex, options);
STM32DFU.connect(usbDevices, parsed_hex, options);
}
} else {
$('span.progressLabel').text(chrome.i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));