Add support for manual baud rate selection to firmware flasher.
parent
5471ab7f65
commit
3086a98828
|
@ -1047,11 +1047,11 @@
|
|||
"firmwareFlasherFlashDevelopmentFirmwareDescription": {
|
||||
"message": "Flash most recent (untested) development firmware"
|
||||
},
|
||||
"firmwareFlasherFlashSlowly": {
|
||||
"message": "Flash slowly"
|
||||
"firmwareFlasherManualBaud": {
|
||||
"message": "Manual Baud Rate"
|
||||
},
|
||||
"firmwareFlasherFlashSlowlyDescription": {
|
||||
"message": "Use 115200 baudrate for flashing (useful for flashing via bluetooth)"
|
||||
"firmwareFlasherManualBaudDescription": {
|
||||
"message": "Manual selection of baud rate for boards that don't support the default speed or for flashing via bluetooth."
|
||||
},
|
||||
"firmwareFlasherShowDevelopmentReleases":{
|
||||
"message": "Show unstable releases"
|
||||
|
|
|
@ -60,8 +60,7 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
|||
self.options = {
|
||||
no_reboot: false,
|
||||
reboot_baud: false,
|
||||
erase_chip: false,
|
||||
flash_slowly: false
|
||||
erase_chip: false
|
||||
};
|
||||
|
||||
if (options.no_reboot) {
|
||||
|
@ -74,11 +73,6 @@ STM32_protocol.prototype.connect = function (port, baud, hex, options, callback)
|
|||
self.options.erase_chip = true;
|
||||
}
|
||||
|
||||
if (options.flash_slowly) {
|
||||
self.options.flash_slowly = true;
|
||||
self.baud = 115200;
|
||||
}
|
||||
|
||||
if (self.options.no_reboot) {
|
||||
serial.connect(port, {bitrate: self.baud, parityBit: 'even', stopBits: 'one'}, function (openInfo) {
|
||||
if (openInfo) {
|
||||
|
|
|
@ -71,11 +71,15 @@
|
|||
margin-left: 6px;
|
||||
}
|
||||
.tab-firmware_flasher .options select {
|
||||
width: 280px;
|
||||
height: 20px;
|
||||
|
||||
border: 1px solid silver;
|
||||
}
|
||||
|
||||
.tab-firmware_flasher .options .releases select {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
.tab-firmware_flasher .option.releases {
|
||||
margin: 0 0 2px 0;
|
||||
line-height: 20px;
|
||||
|
@ -91,6 +95,10 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
.tab-firmware_flasher .options .manual_baud_rate select {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.tab-firmware_flasher .release_info {
|
||||
display: none;
|
||||
|
||||
|
|
|
@ -31,12 +31,23 @@
|
|||
</label>
|
||||
<span class="description" i18n="firmwareFlasherFullChipEraseDescription"></span>
|
||||
</div>
|
||||
<div class="option">
|
||||
<div class="option manual_baud_rate">
|
||||
<label>
|
||||
<input class="flash_slowly" type="checkbox" />
|
||||
<span i18n="firmwareFlasherFlashSlowly"></span>
|
||||
<input class="flash_manual_baud" type="checkbox" />
|
||||
<span i18n="firmwareFlasherManualBaud"></span>
|
||||
<select id="flash_manual_baud_rate" title="Baud Rate">
|
||||
<option value="921600">921600</option>
|
||||
<option value="460800">460800</option>
|
||||
<option value="256000" selected="selected">256000</option>
|
||||
<option value="230400">230400</option>
|
||||
<option value="115200">115200</option>
|
||||
<option value="57600">57600</option>
|
||||
<option value="38400">38400</option>
|
||||
<option value="28800">28800</option>
|
||||
<option value="19200">19200</option>
|
||||
</select>
|
||||
</label>
|
||||
<span class="description" i18n="firmwareFlasherFlashSlowlyDescription"></span>
|
||||
<span class="description" i18n="firmwareFlasherManualBaudDescription"></span>
|
||||
</div>
|
||||
<div class="option">
|
||||
<label>
|
||||
|
|
|
@ -336,10 +336,11 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
options.erase_chip = true;
|
||||
}
|
||||
|
||||
if ($('input.flash_slowly').is(':checked')) {
|
||||
options.flash_slowly = true;
|
||||
if ($('input.flash_manual_baud').is(':checked')) {
|
||||
baud = parseInt($('#flash_manual_baud_rate').val());
|
||||
}
|
||||
|
||||
|
||||
STM32.connect(port, baud, parsed_hex, options);
|
||||
} else {
|
||||
console.log('Please select valid serial port');
|
||||
|
@ -423,6 +424,35 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
});
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_manual_baud', function (result) {
|
||||
if (result.flash_manual_baud) {
|
||||
$('input.flash_manual_baud').prop('checked', true);
|
||||
} else {
|
||||
$('input.flash_manual_baud').prop('checked', false);
|
||||
}
|
||||
|
||||
// bind UI hook so the status is saved on change
|
||||
$('input.flash_manual_baud').change(function() {
|
||||
var status = $(this).is(':checked');
|
||||
|
||||
chrome.storage.local.set({'flash_manual_baud': status});
|
||||
});
|
||||
|
||||
$('input.flash_manual_baud').change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_manual_baud_rate', function (result) {
|
||||
$('#flash_manual_baud_rate').val(result.flash_manual_baud_rate);
|
||||
|
||||
// bind UI hook so the status is saved on change
|
||||
$('#flash_manual_baud_rate').change(function() {
|
||||
var baud = parseInt($('#flash_manual_baud_rate').val());
|
||||
chrome.storage.local.set({'flash_manual_baud_rate': baud});
|
||||
});
|
||||
|
||||
$('input.flash_manual_baud_rate').change();
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_on_connect', function (result) {
|
||||
if (result.flash_on_connect) {
|
||||
$('input.flash_on_connect').prop('checked', true);
|
||||
|
@ -477,19 +507,6 @@ TABS.firmware_flasher.initialize = function (callback) {
|
|||
});
|
||||
});
|
||||
|
||||
chrome.storage.local.get('flash_slowly', function (result) {
|
||||
if (result.flash_slowly) {
|
||||
$('input.flash_slowly').prop('checked', true);
|
||||
} else {
|
||||
$('input.flash_slowly').prop('checked', false);
|
||||
}
|
||||
|
||||
// bind UI hook so the status is saved on change
|
||||
$('input.flash_slowly').change(function () {
|
||||
chrome.storage.local.set({'flash_slowly': $(this).is(':checked')});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).keypress(function (e) {
|
||||
if (e.which == 13) { // enter
|
||||
// Trigger regular Flashing sequence
|
||||
|
|
Loading…
Reference in New Issue