mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-14 03:49:53 +03:00
tab tasks unified
This commit is contained in:
parent
d1fcb81017
commit
d1483e5e26
18 changed files with 46 additions and 99 deletions
|
@ -53,6 +53,7 @@ var mspHelper = (function (gui) {
|
|||
CONFIG.capability = data.getUint32(3, true);
|
||||
break;
|
||||
case MSPCodes.MSP_STATUS:
|
||||
console.log('Using deprecated msp command: MSP_STATUS');
|
||||
CONFIG.cycleTime = data.getUint16(0, true);
|
||||
CONFIG.i2cError = data.getUint16(2, true);
|
||||
CONFIG.activeSensors = data.getUint16(4, true);
|
||||
|
@ -86,6 +87,7 @@ var mspHelper = (function (gui) {
|
|||
sensor_status(CONFIG.activeSensors);
|
||||
}
|
||||
gui.updateStatusBar();
|
||||
gui.updateProfileChange();
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP_SENSOR_STATUS:
|
||||
|
|
|
@ -499,6 +499,7 @@ function update_live_status() {
|
|||
display: 'inline-block'
|
||||
});
|
||||
|
||||
//FIXME probably this is a duplication on status polling... one of those is probably very very not needed
|
||||
if (GUI.active_tab != 'cli') {
|
||||
MSP.send_message(MSPCodes.MSP_BOXNAMES, false, false);
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.2.0"))
|
||||
|
|
27
js/tasks.js
Normal file
27
js/tasks.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var helper = helper || {};
|
||||
|
||||
helper.task = (function () {
|
||||
|
||||
var publicScope = {},
|
||||
privateScope = {};
|
||||
|
||||
privateScope.getStatusPullInterval = function () {
|
||||
//TODO use serial connection speed to determine update interval
|
||||
return 250;
|
||||
};
|
||||
|
||||
publicScope.statusPullStart = function () {
|
||||
helper.interval.add('status_pull', function () {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS, false, false, function () {
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
});
|
||||
|
||||
}, privateScope.getStatusPullInterval(), true);
|
||||
};
|
||||
|
||||
return publicScope;
|
||||
})();
|
|
@ -69,6 +69,7 @@
|
|||
<script type="text/javascript" src="./js/protocols/stm32usbdfu.js"></script>
|
||||
<script type="text/javascript" src="./js/localization.js"></script>
|
||||
<script type="text/javascript" src="./js/boards.js"></script>
|
||||
<script type="text/javascript" src="./js/tasks.js"></script>
|
||||
<script type="text/javascript" src="./main.js"></script>
|
||||
<script type="text/javascript" src="./tabs/landing.js"></script>
|
||||
<script type="text/javascript" src="./tabs/setup.js"></script>
|
||||
|
|
|
@ -271,14 +271,7 @@ TABS.adjustments.initialize = function (callback) {
|
|||
// enable data pulling
|
||||
helper.interval.add('aux_data_pull', get_rc_data, 50);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function () {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
|
@ -290,14 +290,7 @@ TABS.auxiliary.initialize = function (callback) {
|
|||
// enable data pulling
|
||||
helper.interval.add('aux_data_pull', get_rc_data, 50);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function () {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
|
@ -633,13 +633,8 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
|
|||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.interval.add('config_load_analog', function () {
|
||||
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
|
||||
$('#batteryvoltage').val([ANALOG.voltage.toFixed(1)]);
|
||||
|
|
|
@ -358,14 +358,7 @@ TABS.failsafe.initialize = function (callback, scrollPosition) {
|
|||
}
|
||||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
10
tabs/gps.js
10
tabs/gps.js
|
@ -111,15 +111,7 @@ TABS.gps.initialize = function (callback) {
|
|||
get_raw_gps_data();
|
||||
}, 75, true);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
|
||||
helper.task.statusPullStart();
|
||||
|
||||
//check for internet connection on load
|
||||
if (navigator.onLine) {
|
||||
|
|
|
@ -144,14 +144,7 @@ TABS.modes.initialize = function (callback) {
|
|||
// enable data pulling
|
||||
helper.interval.add('aux_data_pull', get_rc_data, 50);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
|
@ -289,10 +289,7 @@ TABS.pid_tuning.initialize = function (callback) {
|
|||
send_pids();
|
||||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
|
@ -221,14 +221,7 @@ TABS.ports.initialize = function (callback, scrollPosition) {
|
|||
|
||||
$('a.save').click(on_save_handler);
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
|
@ -368,13 +368,7 @@ TABS.profiles.initialize = function (callback, scrollPosition) {
|
|||
content: $('#presetApplyContent')
|
||||
});
|
||||
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -470,15 +470,7 @@ TABS.receiver.initialize = function (callback) {
|
|||
helper.interval.add('receiver_pull', get_rc_data, plot_update_rate, true);
|
||||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
|
||||
helper.task.statusPullStart();
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -443,14 +443,7 @@ TABS.sensors.initialize = function (callback) {
|
|||
}
|
||||
});
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
});
|
||||
|
|
|
@ -188,14 +188,7 @@ TABS.servos.initialize = function (callback) {
|
|||
// translate to user-selected language
|
||||
localize();
|
||||
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function () {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
|
@ -175,6 +175,7 @@ TABS.setup.initialize = function (callback) {
|
|||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
|
||||
//TODO ah man.... compare with update_live_status from serial_backend.js
|
||||
MSP.send_message(MSPCodes.MSP_ANALOG, false, false, function () {
|
||||
bat_voltage_e.text(chrome.i18n.getMessage('initialSetupBatteryValue', [ANALOG.voltage]));
|
||||
bat_mah_drawn_e.text(chrome.i18n.getMessage('initialSetupBatteryMahValue', [ANALOG.mAhdrawn]));
|
||||
|
|
|
@ -91,14 +91,8 @@ TABS.transponder.initialize = function (callback, scrollPosition) {
|
|||
save_transponder_config();
|
||||
});
|
||||
}
|
||||
// status data pulled via separate timer with static speed
|
||||
helper.interval.add('status_pull', function status_pull() {
|
||||
MSP.send_message(MSPCodes.MSP_STATUS);
|
||||
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "1.5.0")) {
|
||||
MSP.send_message(MSPCodes.MSP_SENSOR_STATUS);
|
||||
}
|
||||
}, 250, true);
|
||||
helper.task.statusPullStart();
|
||||
|
||||
GUI.content_ready(callback);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue