mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 04:15:28 +03:00
remove msp_balanced_interval
This commit is contained in:
parent
94cc87d384
commit
6b5440f437
15 changed files with 21 additions and 162 deletions
|
@ -5,7 +5,6 @@ const Switchery = require('./libraries/switchery/switchery')
|
||||||
const MSP = require('./msp');
|
const MSP = require('./msp');
|
||||||
const FC = require('./fc');
|
const FC = require('./fc');
|
||||||
const interval = require('./intervals');
|
const interval = require('./intervals');
|
||||||
const mspBalancedInterval = require('./msp_balanced_interval');
|
|
||||||
const { scaleRangeInt } = require('./helpers');
|
const { scaleRangeInt } = require('./helpers');
|
||||||
const i18n = require('./localization');
|
const i18n = require('./localization');
|
||||||
|
|
||||||
|
@ -92,7 +91,6 @@ GUI_control.prototype.tab_switch_cleanup = function (callback) {
|
||||||
MSP.callbacks_cleanup(); // we don't care about any old data that might or might not arrive
|
MSP.callbacks_cleanup(); // we don't care about any old data that might or might not arrive
|
||||||
|
|
||||||
interval.killAll(['global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
interval.killAll(['global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
||||||
mspBalancedInterval.flush();
|
|
||||||
|
|
||||||
if (this.active_tab) {
|
if (this.active_tab) {
|
||||||
TABS[this.active_tab].cleanup(callback);
|
TABS[this.active_tab].cleanup(callback);
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const mspQueue = require('./serial_queue');
|
|
||||||
const interval = require('./intervals');
|
|
||||||
|
|
||||||
var mspBalancedInterval = (function (mspQueue, intervalHandler) {
|
|
||||||
|
|
||||||
var publicScope = {},
|
|
||||||
privateScope = {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How often balancing should be executed [Hz]
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
privateScope.balancingFrequency = 0.5;
|
|
||||||
|
|
||||||
privateScope.intervals = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {string} name
|
|
||||||
* @param {number} requestedInterval
|
|
||||||
* @param {number} messagesInInterval
|
|
||||||
* @param {function} code
|
|
||||||
*/
|
|
||||||
publicScope.add = function (name, requestedInterval, messagesInInterval, code) {
|
|
||||||
privateScope.intervals.push({
|
|
||||||
name: name,
|
|
||||||
requestedInterval: requestedInterval,
|
|
||||||
messagesInInterval: messagesInInterval,
|
|
||||||
code: code
|
|
||||||
});
|
|
||||||
|
|
||||||
intervalHandler.add(name, code, mspQueue.getIntervalPrediction(requestedInterval, messagesInInterval));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Periodically executed balancing handler
|
|
||||||
*/
|
|
||||||
publicScope.balancer = function () {
|
|
||||||
|
|
||||||
var interval;
|
|
||||||
|
|
||||||
for (var i in privateScope.intervals) {
|
|
||||||
if (privateScope.intervals.hasOwnProperty(i)) {
|
|
||||||
interval = privateScope.intervals[i];
|
|
||||||
|
|
||||||
intervalHandler.remove(interval.name);
|
|
||||||
intervalHandler.add(
|
|
||||||
interval.name,
|
|
||||||
interval.code,
|
|
||||||
mspQueue.getIntervalPrediction(
|
|
||||||
interval.requestedInterval,
|
|
||||||
interval.messagesInInterval
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Real interval cleaning happens win interval.killAll method
|
|
||||||
* both methods have to be executed
|
|
||||||
*/
|
|
||||||
publicScope.flush = function () {
|
|
||||||
privateScope.intervals = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
setInterval(publicScope.balancer, Math.round(1000 / privateScope.balancingFrequency));
|
|
||||||
|
|
||||||
return publicScope;
|
|
||||||
})(mspQueue, interval);
|
|
||||||
|
|
||||||
module.exports = mspBalancedInterval;
|
|
|
@ -18,7 +18,6 @@ const interval = require('./intervals');
|
||||||
const periodicStatusUpdater = require('./periodicStatusUpdater');
|
const periodicStatusUpdater = require('./periodicStatusUpdater');
|
||||||
const mspQueue = require('./serial_queue');
|
const mspQueue = require('./serial_queue');
|
||||||
const timeout = require('./timeouts');
|
const timeout = require('./timeouts');
|
||||||
const mspBalancedInterval = require('./msp_balanced_interval');
|
|
||||||
const defaultsDialog = require('./defaults_dialog');
|
const defaultsDialog = require('./defaults_dialog');
|
||||||
const { SITLProcess } = require('./sitl');
|
const { SITLProcess } = require('./sitl');
|
||||||
const update = require('./globalUpdates');
|
const update = require('./globalUpdates');
|
||||||
|
@ -218,7 +217,6 @@ var SerialBackend = (function () {
|
||||||
|
|
||||||
timeout.killAll();
|
timeout.killAll();
|
||||||
interval.killAll(['global_data_refresh', 'msp-load-update']);
|
interval.killAll(['global_data_refresh', 'msp-load-update']);
|
||||||
mspBalancedInterval.flush();
|
|
||||||
|
|
||||||
if (CONFIGURATOR.cliActive) {
|
if (CONFIGURATOR.cliActive) {
|
||||||
GUI.tab_switch_cleanup(finishDisconnect);
|
GUI.tab_switch_cleanup(finishDisconnect);
|
||||||
|
|
|
@ -6,12 +6,10 @@ const wNumb = require('wnumb/wNumb')
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const mspQueue = require('./../js/serial_queue');
|
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
TABS.adjustments = {};
|
TABS.adjustments = {};
|
||||||
|
|
||||||
|
@ -260,11 +258,6 @@ TABS.adjustments.initialize = function (callback) {
|
||||||
|
|
||||||
// data pulling functions used inside interval timer
|
// data pulling functions used inside interval timer
|
||||||
function get_rc_data() {
|
function get_rc_data() {
|
||||||
|
|
||||||
if (mspQueue.shouldDrop()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +273,7 @@ TABS.adjustments.initialize = function (callback) {
|
||||||
update_ui();
|
update_ui();
|
||||||
|
|
||||||
// enable data pulling
|
// enable data pulling
|
||||||
mspBalancedInterval.add('aux_data_pull', 50, 1, get_rc_data);
|
interval.add('aux_data_pull', get_rc_data, 50);
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,11 @@ const store = new Store();
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const mspQueue = require('./../js/serial_queue');
|
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
const adjustBoxNameIfPeripheralWithModeID = require('./../js/peripherals');
|
const adjustBoxNameIfPeripheralWithModeID = require('./../js/peripherals');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
var ORIG_AUX_CONFIG_IDS = [];
|
var ORIG_AUX_CONFIG_IDS = [];
|
||||||
|
|
||||||
|
@ -375,11 +373,6 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
|
|
||||||
// data pulling functions used inside interval timer
|
// data pulling functions used inside interval timer
|
||||||
function get_rc_data() {
|
function get_rc_data() {
|
||||||
|
|
||||||
if (mspQueue.shouldDrop()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +509,7 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
update_ui();
|
update_ui();
|
||||||
|
|
||||||
// enable data pulling
|
// enable data pulling
|
||||||
mspBalancedInterval.add('aux_data_pull', 50, 1, get_rc_data);
|
interval.add('aux_data_pull', get_rc_data, 50);
|
||||||
|
|
||||||
$(".tab-auxiliary .acroEnabled").width($("#mode-0 .info").width());
|
$(".tab-auxiliary .acroEnabled").width($("#mode-0 .info").width());
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ const CONFIGURATOR = require('./../js/data_storage');
|
||||||
const SerialBackend = require('./../js/serial_backend');
|
const SerialBackend = require('./../js/serial_backend');
|
||||||
const timeout = require('./../js/timeouts');
|
const timeout = require('./../js/timeouts');
|
||||||
const interval = require('./../js/intervals');
|
const interval = require('./../js/intervals');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const mspQueue = require('./../js/serial_queue');
|
const mspQueue = require('./../js/serial_queue');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const STM32 = require('./../js/protocols/stm32');
|
const STM32 = require('./../js/protocols/stm32');
|
||||||
|
@ -776,7 +775,6 @@ TABS.firmware_flasher.onValidFirmware = function() {
|
||||||
TABS.firmware_flasher.closeTempConnection = function() {
|
TABS.firmware_flasher.closeTempConnection = function() {
|
||||||
timeout.killAll();
|
timeout.killAll();
|
||||||
interval.killAll(['global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
interval.killAll(['global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
||||||
mspBalancedInterval.flush();
|
|
||||||
|
|
||||||
mspQueue.flush();
|
mspQueue.flush();
|
||||||
mspQueue.freeHardLock();
|
mspQueue.freeHardLock();
|
||||||
|
|
12
tabs/gps.js
12
tabs/gps.js
|
@ -8,8 +8,7 @@ const MSPChainerClass = require('./../js/msp/MSPchainer');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
const interval = require('./../js/intervals');
|
||||||
const mspQueue = require('./../js/serial_queue');
|
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
|
@ -262,7 +261,6 @@ TABS.gps.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
|
|
||||||
let lat = FC.GPS_DATA.lat / 10000000;
|
let lat = FC.GPS_DATA.lat / 10000000;
|
||||||
let lon = FC.GPS_DATA.lon / 10000000;
|
let lon = FC.GPS_DATA.lon / 10000000;
|
||||||
|
|
||||||
|
@ -400,19 +398,15 @@ TABS.gps.initialize = function (callback) {
|
||||||
* enable data pulling
|
* enable data pulling
|
||||||
* GPS is usually refreshed at 5Hz, there is no reason to pull it much more often, really...
|
* GPS is usually refreshed at 5Hz, there is no reason to pull it much more often, really...
|
||||||
*/
|
*/
|
||||||
mspBalancedInterval.add('gps_pull', 200, 3, function gps_update() {
|
interval.add('gps_pull', function gps_update() {
|
||||||
// avoid usage of the GPS commands until a GPS sensor is detected for targets that are compiled without GPS support.
|
// avoid usage of the GPS commands until a GPS sensor is detected for targets that are compiled without GPS support.
|
||||||
if (!SerialBackend.have_sensor(FC.CONFIG.activeSensors, 'gps')) {
|
if (!SerialBackend.have_sensor(FC.CONFIG.activeSensors, 'gps')) {
|
||||||
update_ui();
|
update_ui();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mspQueue.shouldDrop()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
get_raw_gps_data();
|
get_raw_gps_data();
|
||||||
});
|
}, 200);
|
||||||
|
|
||||||
|
|
||||||
$('a.save').on('click', function () {
|
$('a.save').on('click', function () {
|
||||||
|
|
|
@ -7,7 +7,6 @@ const store = new Store();
|
||||||
|
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
const CONFIGURATOR = require('./../js/data_storage');
|
const CONFIGURATOR = require('./../js/data_storage');
|
||||||
|
@ -106,7 +105,6 @@ TABS.logging.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
interval.killAll(['global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
interval.killAll(['global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
||||||
mspBalancedInterval.flush();
|
|
||||||
|
|
||||||
$('.speed').prop('disabled', false);
|
$('.speed').prop('disabled', false);
|
||||||
$(this).text(i18n.getMessage('loggingStart'));
|
$(this).text(i18n.getMessage('loggingStart'));
|
||||||
|
|
|
@ -6,12 +6,11 @@ const MSPChainerClass = require('./../js/msp/MSPchainer');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const mspQueue = require('./../js/serial_queue');
|
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
const { mixer } = require('./../js/model');
|
const { mixer } = require('./../js/model');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
TABS.magnetometer = {};
|
TABS.magnetometer = {};
|
||||||
|
|
||||||
|
@ -524,9 +523,6 @@ TABS.magnetometer.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function get_fast_data() {
|
function get_fast_data() {
|
||||||
if (mspQueue.shouldDrop()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
||||||
self.roll_e.text(i18n.getMessage('initialSetupAttitude', [FC.SENSOR_DATA.kinematics[0]]));
|
self.roll_e.text(i18n.getMessage('initialSetupAttitude', [FC.SENSOR_DATA.kinematics[0]]));
|
||||||
|
@ -536,7 +532,7 @@ TABS.magnetometer.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mspBalancedInterval.add('setup_data_pull_fast', 40, 1, get_fast_data);
|
interval.add('setup_data_pull_fast', get_fast_data, 40);
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ const MSPChainerClass = require('./../js/msp/MSPchainer');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const mspQueue = require('./../js/serial_queue');
|
const mspQueue = require('./../js/serial_queue');
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
|
@ -27,6 +26,7 @@ const FwApproachCollection = require('./../js/fwApproachCollection');
|
||||||
const SerialBackend = require('./../js/serial_backend');
|
const SerialBackend = require('./../js/serial_backend');
|
||||||
const { distanceOnLine, wrap_360, calculate_new_cooridatnes } = require('./../js/helpers');
|
const { distanceOnLine, wrap_360, calculate_new_cooridatnes } = require('./../js/helpers');
|
||||||
const Plotly = require('./../js/libraries/plotly-latest.min');
|
const Plotly = require('./../js/libraries/plotly-latest.min');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
var MAX_NEG_FW_LAND_ALT = -2000; // cm
|
var MAX_NEG_FW_LAND_ALT = -2000; // cm
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
*/
|
*/
|
||||||
if(!isOffline)
|
if(!isOffline)
|
||||||
{
|
{
|
||||||
mspBalancedInterval.add('gps_pull', 200, 3, function gps_update() {
|
interval.add('gps_pull', function gps_update() {
|
||||||
// avoid usage of the GPS commands until a GPS sensor is detected for targets that are compiled without GPS support.
|
// avoid usage of the GPS commands until a GPS sensor is detected for targets that are compiled without GPS support.
|
||||||
if (!SerialBackend.have_sensor(FC.CONFIG.activeSensors, 'gps')) {
|
if (!SerialBackend.have_sensor(FC.CONFIG.activeSensors, 'gps')) {
|
||||||
update_gpsTrack();
|
update_gpsTrack();
|
||||||
|
@ -346,7 +346,7 @@ TABS.mission_control.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_raw_gps_data();
|
get_raw_gps_data();
|
||||||
});
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
|
|
|
@ -11,8 +11,8 @@ const FC = require('./../js/fc');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
const { mixer, platform, PLATFORM, INPUT, STABILIZED } = require('./../js/model');
|
const { mixer, platform, PLATFORM, INPUT, STABILIZED } = require('./../js/model');
|
||||||
const Settings = require('./../js/settings');
|
const Settings = require('./../js/settings');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const jBox = require('../js/libraries/jBox/jBox.min');
|
const jBox = require('../js/libraries/jBox/jBox.min');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
TABS.mixer = {};
|
TABS.mixer = {};
|
||||||
|
|
||||||
|
@ -823,9 +823,9 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
|
|
||||||
FC.LOGIC_CONDITIONS.init($('#logic-wrapper'));
|
FC.LOGIC_CONDITIONS.init($('#logic-wrapper'));
|
||||||
|
|
||||||
i18n.localize();;
|
i18n.localize();;
|
||||||
|
|
||||||
mspBalancedInterval.add('logic_conditions_pull', 350, 1, getLogicConditionsStatus);
|
interval.add('logic_conditions_pull', getLogicConditionsStatus, 350);
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ const path = require('path');
|
||||||
const MSPChainerClass = require('./../js/msp/MSPchainer');
|
const MSPChainerClass = require('./../js/msp/MSPchainer');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const mspQueue = require('./../js/serial_queue')
|
const mspQueue = require('./../js/serial_queue')
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
|
@ -430,7 +429,6 @@ TABS.outputs.initialize = function (callback) {
|
||||||
|
|
||||||
// timer initialization
|
// timer initialization
|
||||||
interval.killAll(['motor_and_status_pull', 'global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
interval.killAll(['motor_and_status_pull', 'global_data_refresh', 'msp-load-update', 'ltm-connection-check']);
|
||||||
mspBalancedInterval.flush();
|
|
||||||
|
|
||||||
interval.add('IMU_pull', function () {
|
interval.add('IMU_pull', function () {
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const MSPChainerClass = require('./../js/msp/MSPchainer');
|
const MSPChainerClass = require('./../js/msp/MSPchainer');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
const FC = require('./../js/fc');
|
const FC = require('./../js/fc');
|
||||||
const tabs = require('./../js/tabs');
|
const tabs = require('./../js/tabs');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
TABS.programming = {};
|
TABS.programming = {};
|
||||||
|
|
||||||
|
@ -68,9 +67,9 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
||||||
GUI.log(i18n.getMessage('programmingEepromSaved'));
|
GUI.log(i18n.getMessage('programmingEepromSaved'));
|
||||||
});
|
});
|
||||||
|
|
||||||
mspBalancedInterval.add('logic_conditions_pull', 100, 1, function () {
|
interval.add('logic_conditions_pull', function () {
|
||||||
statusChainer.execute();
|
statusChainer.execute();
|
||||||
});
|
}, 100);
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@ const path = require('path');
|
||||||
|
|
||||||
const MSPChainerClass = require('./../js/msp/MSPchainer');
|
const MSPChainerClass = require('./../js/msp/MSPchainer');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const mspQueue = require('./../js/serial_queue');
|
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const MSP = require('./../js/msp');
|
const MSP = require('./../js/msp');
|
||||||
const { GUI, TABS } = require('./../js/gui');
|
const { GUI, TABS } = require('./../js/gui');
|
||||||
|
@ -13,6 +11,7 @@ const FC = require('./../js/fc');
|
||||||
const CONFIGURATOR = require('./../js/data_storage');
|
const CONFIGURATOR = require('./../js/data_storage');
|
||||||
const Settings = require('./../js/settings');
|
const Settings = require('./../js/settings');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
|
const interval = require('./../js/intervals');
|
||||||
|
|
||||||
TABS.receiver = {
|
TABS.receiver = {
|
||||||
rateChartHeight: 117
|
rateChartHeight: 117
|
||||||
|
@ -370,21 +369,10 @@ TABS.receiver.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function get_rc_data() {
|
function get_rc_data() {
|
||||||
|
|
||||||
/*
|
|
||||||
* Throttling
|
|
||||||
*/
|
|
||||||
if (mspQueue.shouldDrop()) {
|
|
||||||
update_ui();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_ui() {
|
function update_ui() {
|
||||||
var i;
|
|
||||||
|
|
||||||
// update bars with latest data
|
// update bars with latest data
|
||||||
for (let i = 0; i < FC.RC.active_channels; i++) {
|
for (let i = 0; i < FC.RC.active_channels; i++) {
|
||||||
meter_fill_array[i].css('width', ((FC.RC.channels[i] - meter_scale.min) / (meter_scale.max - meter_scale.min) * 100).clamp(0, 100) + '%');
|
meter_fill_array[i].css('width', ((FC.RC.channels[i] - meter_scale.min) / (meter_scale.max - meter_scale.min) * 100).clamp(0, 100) + '%');
|
||||||
|
@ -393,7 +381,7 @@ TABS.receiver.initialize = function (callback) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mspBalancedInterval.add('receiver_pull', 35, 1, get_rc_data);
|
interval.add('receiver_pull', get_rc_data, 25);
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,7 @@ const MSP = require('./../js/msp');
|
||||||
const MSPCodes = require('./../js/msp/MSPCodes');
|
const MSPCodes = require('./../js/msp/MSPCodes');
|
||||||
const i18n = require('./../js/localization');
|
const i18n = require('./../js/localization');
|
||||||
const mspHelper = require('./../js/msp/MSPHelper');
|
const mspHelper = require('./../js/msp/MSPHelper');
|
||||||
const mspBalancedInterval = require('./../js/msp_balanced_interval');
|
|
||||||
const interval = require('./../js/intervals');
|
const interval = require('./../js/intervals');
|
||||||
const mspQueue = require('./../js/serial_queue');
|
|
||||||
const SerialBackend = require('./../js/serial_backend');
|
const SerialBackend = require('./../js/serial_backend');
|
||||||
const { mixer } = require('./../js/model');
|
const { mixer } = require('./../js/model');
|
||||||
const BitHelper = require('./../js/bitHelper')
|
const BitHelper = require('./../js/bitHelper')
|
||||||
|
@ -119,14 +117,6 @@ TABS.setup.initialize = function (callback) {
|
||||||
|
|
||||||
function get_slow_data() {
|
function get_slow_data() {
|
||||||
if (SerialBackend.have_sensor(FC.CONFIG.activeSensors, 'gps')) {
|
if (SerialBackend.have_sensor(FC.CONFIG.activeSensors, 'gps')) {
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable balancer
|
|
||||||
*/
|
|
||||||
// if (mspQueue.shouldDrop()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_RAW_GPS, false, false, function () {
|
||||||
var gpsFixType = i18n.getMessage('gpsFixNone');
|
var gpsFixType = i18n.getMessage('gpsFixNone');
|
||||||
if (FC.GPS_DATA.fix >= 2)
|
if (FC.GPS_DATA.fix >= 2)
|
||||||
|
@ -142,14 +132,6 @@ TABS.setup.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_fast_data() {
|
function get_fast_data() {
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable balancer
|
|
||||||
*/
|
|
||||||
// if (mspQueue.shouldDrop()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
MSP.send_message(MSPCodes.MSP_ATTITUDE, false, false, function () {
|
||||||
roll_e.text(i18n.getMessage('initialSetupAttitude', [FC.SENSOR_DATA.kinematics[0]]));
|
roll_e.text(i18n.getMessage('initialSetupAttitude', [FC.SENSOR_DATA.kinematics[0]]));
|
||||||
pitch_e.text(i18n.getMessage('initialSetupAttitude', [FC.SENSOR_DATA.kinematics[1]]));
|
pitch_e.text(i18n.getMessage('initialSetupAttitude', [FC.SENSOR_DATA.kinematics[1]]));
|
||||||
|
@ -159,9 +141,8 @@ TABS.setup.initialize = function (callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mspBalancedInterval.add('setup_data_pull_slow', 250, 1, get_slow_data);
|
|
||||||
|
|
||||||
interval.add('setup_data_pull_fast', get_fast_data, 50);
|
interval.add('setup_data_pull_fast', get_fast_data, 50);
|
||||||
|
interval.add('setup_data_pull_slow', get_slow_data, 250);
|
||||||
|
|
||||||
interval.add('gui_analog_update', function () {
|
interval.add('gui_analog_update', function () {
|
||||||
bat_cells_e.text(i18n.getMessage('initialSetupBatteryDetectedCellsValue', [FC.ANALOG.cell_count]));
|
bat_cells_e.text(i18n.getMessage('initialSetupBatteryDetectedCellsValue', [FC.ANALOG.cell_count]));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue