mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
corrections of inline functions
This commit is contained in:
parent
20e6ad0074
commit
f16b3a479a
2 changed files with 45 additions and 46 deletions
|
@ -158,7 +158,6 @@ MSP.read = function (readInfo) {
|
||||||
};
|
};
|
||||||
|
|
||||||
MSP.process_data = function(code, message_buffer, message_length) {
|
MSP.process_data = function(code, message_buffer, message_length) {
|
||||||
'use strict';
|
|
||||||
var data = new DataView(message_buffer, 0); // DataView (allowing us to view arrayBuffer as struct/union)
|
var data = new DataView(message_buffer, 0); // DataView (allowing us to view arrayBuffer as struct/union)
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
|
20
js/serial.js
20
js/serial.js
|
@ -27,11 +27,15 @@ var serial = {
|
||||||
console.error(info);
|
console.error(info);
|
||||||
googleAnalytics.sendException('Serial: ' + info.error, false);
|
googleAnalytics.sendException('Serial: ' + info.error, false);
|
||||||
|
|
||||||
function get_status() {
|
switch (info.error) {
|
||||||
|
case 'system_error': // we might be able to recover from this one
|
||||||
|
chrome.serial.setPaused(self.connectionId, false, get_status);
|
||||||
|
|
||||||
|
var get_status = function () {
|
||||||
self.getInfo(crunch_status);
|
self.getInfo(crunch_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
function crunch_status(info) {
|
var crunch_status = function (info) {
|
||||||
if (!info.paused) {
|
if (!info.paused) {
|
||||||
console.log('SERIAL: Connection recovered from last onReceiveError');
|
console.log('SERIAL: Connection recovered from last onReceiveError');
|
||||||
googleAnalytics.sendException('Serial: onReceiveError - recovered', false);
|
googleAnalytics.sendException('Serial: onReceiveError - recovered', false);
|
||||||
|
@ -47,10 +51,6 @@ var serial = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (info.error) {
|
|
||||||
case 'system_error': // we might be able to recover from this one
|
|
||||||
chrome.serial.setPaused(self.connectionId, false, get_status);
|
|
||||||
break;
|
break;
|
||||||
case 'timeout':
|
case 'timeout':
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -127,7 +127,10 @@ var serial = {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.output_buffer.push({'data': data, 'callback': callback});
|
self.output_buffer.push({'data': data, 'callback': callback});
|
||||||
|
|
||||||
function sending() {
|
if (!self.transmitting) {
|
||||||
|
self.transmitting = true;
|
||||||
|
|
||||||
|
var sending = function () {
|
||||||
// store inside separate variables in case array gets destroyed
|
// store inside separate variables in case array gets destroyed
|
||||||
var data = self.output_buffer[0].data;
|
var data = self.output_buffer[0].data;
|
||||||
var callback = self.output_buffer[0].callback;
|
var callback = self.output_buffer[0].callback;
|
||||||
|
@ -151,9 +154,6 @@ var serial = {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!self.transmitting) {
|
|
||||||
self.transmitting = true;
|
|
||||||
|
|
||||||
sending();
|
sending();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue