mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-23 00:05:19 +03:00
msp cleanup
This commit is contained in:
parent
18a00dedf8
commit
9a5e3dbeae
7 changed files with 266 additions and 396 deletions
10
js/gui.js
10
js/gui.js
|
@ -345,5 +345,15 @@ GUI_control.prototype.content_ready = function (callback) {
|
|||
if (callback) callback();
|
||||
};
|
||||
|
||||
GUI_control.prototype.updateStatusBar = function() {
|
||||
$('span.i2c-error').text(CONFIG.i2cError);
|
||||
$('span.cycle-time').text(CONFIG.cycleTime);
|
||||
$('span.cpu-load').text(chrome.i18n.getMessage('statusbar_cpu_load', [CONFIG.cpuload]));
|
||||
};
|
||||
|
||||
GUI_control.prototype.updateProfileChange = function() {
|
||||
$('#profilechange').val(CONFIG.profile);
|
||||
};
|
||||
|
||||
// initialize object into GUI variable
|
||||
var GUI = new GUI_control();
|
||||
|
|
11
js/msp.js
11
js/msp.js
|
@ -87,7 +87,7 @@ var MSP = {
|
|||
case 6:
|
||||
if (this.message_checksum == data[i]) {
|
||||
// message received, process
|
||||
mspHelper.processData(this.code, this.message_buffer, this.message_length_expected);
|
||||
mspHelper.processData(this);
|
||||
} else {
|
||||
console.log('code: ' + this.code + ' - crc failed');
|
||||
|
||||
|
@ -109,12 +109,13 @@ var MSP = {
|
|||
|
||||
send_message: function (code, data, callback_sent, callback_msp) {
|
||||
var bufferOut,
|
||||
bufView;
|
||||
bufView,
|
||||
i;
|
||||
|
||||
// always reserve 6 bytes for protocol overhead !
|
||||
if (data) {
|
||||
var size = data.length + 6,
|
||||
checksum = 0;
|
||||
checksum;
|
||||
|
||||
bufferOut = new ArrayBuffer(size);
|
||||
bufView = new Uint8Array(bufferOut);
|
||||
|
@ -127,7 +128,7 @@ var MSP = {
|
|||
|
||||
checksum = bufView[3] ^ bufView[4];
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
for (i = 0; i < data.length; i++) {
|
||||
bufView[i + 5] = data[i];
|
||||
|
||||
checksum ^= bufView[i + 5];
|
||||
|
@ -152,7 +153,7 @@ var MSP = {
|
|||
var obj = {'code': code, 'requestBuffer': bufferOut, 'callback': (callback_msp) ? callback_msp : false, 'timer': false};
|
||||
|
||||
var requestExists = false;
|
||||
for (var i = 0; i < MSP.callbacks.length; i++) {
|
||||
for (i = 0; i < MSP.callbacks.length; i++) {
|
||||
if (i < MSP.callbacks.length) {
|
||||
if (MSP.callbacks[i].code == code) {
|
||||
// request already exist, we will just attach
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,4 @@
|
|||
/*global chrome, chrome.i18n*/
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function () {
|
||||
|
@ -307,6 +308,7 @@ function read_serial(info) {
|
|||
}
|
||||
}
|
||||
|
||||
//FIXME move it into GUI
|
||||
function sensor_status(sensors_detected) {
|
||||
// initialize variable (if it wasn't)
|
||||
if (!sensor_status.previous_sensors_detected) {
|
||||
|
|
|
@ -48,12 +48,12 @@
|
|||
<script type="text/javascript" src="./js/libraries/jquery.ba-throttle-debounce.min.js"></script>
|
||||
<script type="text/javascript" src="./js/libraries/inflection.min.js"></script>
|
||||
<script type="text/javascript" src="./js/injected_methods.js"></script>
|
||||
<script type="text/javascript" src="./js/gui.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPCodes.js"></script>
|
||||
<script type="text/javascript" src="./js/msp/MSPHelper.js"></script>
|
||||
<script type="text/javascript" src="./js/port_handler.js"></script>
|
||||
<script type="text/javascript" src="./js/port_usage.js"></script>
|
||||
<script type="text/javascript" src="./js/serial.js"></script>
|
||||
<script type="text/javascript" src="./js/gui.js"></script>
|
||||
<script type="text/javascript" src="./js/model.js"></script>
|
||||
<script type="text/javascript" src="./js/request_balancer.js"></script>
|
||||
<script type="text/javascript" src="./js/serial_backend.js"></script>
|
||||
|
@ -148,7 +148,7 @@
|
|||
<div id="profile_change">
|
||||
<div class="dropdown dropdown-dark">
|
||||
<form name="profile-change" id="profile-change">
|
||||
<select class="dropdown-select" name="profilechange">
|
||||
<select class="dropdown-select" id="profilechange">
|
||||
<option value="0">Profile 1</option>
|
||||
<option value="1">Profile 2</option>
|
||||
<option value="2">Profile 3</option>
|
||||
|
|
2
main.js
2
main.js
|
@ -350,7 +350,7 @@ $(document).ready(function () {
|
|||
|
||||
});
|
||||
|
||||
var profile_e = $('select[name="profilechange"]');
|
||||
var profile_e = $('#profilechange');
|
||||
|
||||
profile_e.change(function () {
|
||||
var profile = parseInt($(this).val());
|
||||
|
|
|
@ -189,7 +189,7 @@ FONT.upload = function ($progress) {
|
|||
};
|
||||
|
||||
FONT.preview = function ($el) {
|
||||
$el.empty()
|
||||
$el.empty();
|
||||
for (var i = 0; i < SYM.LOGO; i++) {
|
||||
var url = FONT.data.character_image_urls[i];
|
||||
$el.append('<img src="' + url + '" title="0x' + i.toString(16) + '"></img>');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue