mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
variable bitrate definition per OS
This commit is contained in:
parent
1b4a51ef05
commit
1a80ecff44
1 changed files with 17 additions and 2 deletions
19
js/stm32.js
19
js/stm32.js
|
@ -55,6 +55,21 @@ STM32_protocol.prototype.connect = function() {
|
||||||
var baud = parseInt($('div#port-picker #baud').val());
|
var baud = parseInt($('div#port-picker #baud').val());
|
||||||
|
|
||||||
if (selected_port != '0') {
|
if (selected_port != '0') {
|
||||||
|
// calculate fastest bitrate speed for current OS
|
||||||
|
switch (GUI.operating_system) {
|
||||||
|
case 'Windows':
|
||||||
|
var flashing_bitrate = 256000;
|
||||||
|
break;
|
||||||
|
case 'MacOS':
|
||||||
|
var flashing_bitrate = 230400;
|
||||||
|
break;
|
||||||
|
case 'ChromeOS':
|
||||||
|
case 'Linux':
|
||||||
|
case 'UNIX':
|
||||||
|
var flashing_bitrate = 230400;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$('input.updating').is(':checked')) {
|
if (!$('input.updating').is(':checked')) {
|
||||||
chrome.serial.open(selected_port, {bitrate: baud}, function(openInfo) {
|
chrome.serial.open(selected_port, {bitrate: baud}, function(openInfo) {
|
||||||
connectionId = openInfo.connectionId;
|
connectionId = openInfo.connectionId;
|
||||||
|
@ -73,7 +88,7 @@ STM32_protocol.prototype.connect = function() {
|
||||||
if (result) {
|
if (result) {
|
||||||
console.log('Connection closed successfully.');
|
console.log('Connection closed successfully.');
|
||||||
|
|
||||||
chrome.serial.open(selected_port, {bitrate: 115200, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
chrome.serial.open(selected_port, {bitrate: flashing_bitrate, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
||||||
connectionId = openInfo.connectionId;
|
connectionId = openInfo.connectionId;
|
||||||
|
|
||||||
if (connectionId != -1) {
|
if (connectionId != -1) {
|
||||||
|
@ -92,7 +107,7 @@ STM32_protocol.prototype.connect = function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
chrome.serial.open(selected_port, {bitrate: 115200, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
chrome.serial.open(selected_port, {bitrate: flashing_bitrate, parityBit: 'evenparity', stopBit: 'onestopbit'}, function(openInfo) {
|
||||||
connectionId = openInfo.connectionId;
|
connectionId = openInfo.connectionId;
|
||||||
|
|
||||||
if (connectionId != -1) {
|
if (connectionId != -1) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue