mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-16 21:05:28 +03:00
load balancing on oter tabs
This commit is contained in:
parent
297ad70c5d
commit
35adb962fb
4 changed files with 20 additions and 13 deletions
|
@ -11,8 +11,8 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
privateScope.balancerFrequency = 10;
|
privateScope.balancerFrequency = 10;
|
||||||
|
|
||||||
privateScope.loadFilter = new classes.SimpleSmoothFilter(0.5, 0.995);
|
privateScope.loadFilter = new classes.SimpleSmoothFilter(0.5, 0.995);
|
||||||
privateScope.roundtripFilter = new classes.SimpleSmoothFilter(20, 0.95);
|
privateScope.roundtripFilter = new classes.SimpleSmoothFilter(20, 0.97);
|
||||||
privateScope.hardwareRoundtripFilter = new classes.SimpleSmoothFilter(5, 0.95);
|
privateScope.hardwareRoundtripFilter = new classes.SimpleSmoothFilter(5, 0.97);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target load for MSP queue. When load is above target, throttling might start to appear
|
* Target load for MSP queue. When load is above target, throttling might start to appear
|
||||||
|
@ -255,13 +255,13 @@ helper.mspQueue = (function (serial, MSP) {
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
publicScope.getIntervalPrediction = function (requestedInterval, messagesInInterval) {
|
publicScope.getIntervalPrediction = function (requestedInterval, messagesInInterval) {
|
||||||
var openWindow = publicScope.getRoundtrip() * 1.25,
|
var requestedRate = (1000 / requestedInterval) * messagesInInterval,
|
||||||
requestedWindow = requestedInterval / messagesInInterval;
|
availableRate = (1000 / publicScope.getRoundtrip()) * 0.75;
|
||||||
|
|
||||||
if (requestedWindow < openWindow) {
|
if (requestedRate < availableRate) {
|
||||||
return openWindow;
|
|
||||||
} else {
|
|
||||||
return requestedInterval;
|
return requestedInterval;
|
||||||
|
} else {
|
||||||
|
return (1000 / availableRate) * messagesInInterval;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,11 @@ 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 (helper.mspQueue.shouldDrop()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +274,7 @@ TABS.adjustments.initialize = function (callback) {
|
||||||
update_ui();
|
update_ui();
|
||||||
|
|
||||||
// enable data pulling
|
// enable data pulling
|
||||||
helper.interval.add('aux_data_pull', get_rc_data, 50);
|
helper.interval.add('aux_data_pull', get_rc_data, helper.mspQueue.getIntervalPrediction(50, 1));
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,6 +258,11 @@ 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 (helper.mspQueue.shouldDrop()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
MSP.send_message(MSPCodes.MSP_RC, false, false, update_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +293,7 @@ TABS.auxiliary.initialize = function (callback) {
|
||||||
update_ui();
|
update_ui();
|
||||||
|
|
||||||
// enable data pulling
|
// enable data pulling
|
||||||
helper.interval.add('aux_data_pull', get_rc_data, 50);
|
helper.interval.add('aux_data_pull', get_rc_data, helper.mspQueue.getIntervalPrediction(50, 1));
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
TABS.gps = {};
|
TABS.gps = {};
|
||||||
TABS.gps.initialize = function (callback) {
|
TABS.gps.initialize = function (callback) {
|
||||||
var self = this;
|
|
||||||
|
|
||||||
if (GUI.active_tab != 'gps') {
|
if (GUI.active_tab != 'gps') {
|
||||||
GUI.active_tab = 'gps';
|
GUI.active_tab = 'gps';
|
||||||
|
@ -115,7 +114,7 @@ TABS.gps.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_raw_gps_data();
|
get_raw_gps_data();
|
||||||
}, 250, true);
|
}, helper.mspQueue.getIntervalPrediction(200, 3), true);
|
||||||
|
|
||||||
//check for internet connection on load
|
//check for internet connection on load
|
||||||
if (navigator.onLine) {
|
if (navigator.onLine) {
|
||||||
|
@ -159,8 +158,6 @@ TABS.gps.initialize = function (callback) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TABS.gps.cleanup = function (callback) {
|
TABS.gps.cleanup = function (callback) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue