mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 09:15:42 +03:00
When LTM stream is detected, the app will automatically switch to groundstation mode.
This commit is contained in:
parent
5e4e9294f8
commit
c7b924e67b
6 changed files with 78 additions and 1 deletions
54
js/groundstation.js
Normal file
54
js/groundstation.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
'use strict';
|
||||
|
||||
var helper = helper || {};
|
||||
|
||||
helper.groundstation = (function () {
|
||||
|
||||
let publicScope = {},
|
||||
privateScope = {};
|
||||
|
||||
privateScope.activated = false;
|
||||
privateScope.$gsViewport = null;
|
||||
|
||||
publicScope.isActivated = function () {
|
||||
return privateScope.activated;
|
||||
};
|
||||
|
||||
publicScope.activate = function ($viewport) {
|
||||
|
||||
if (privateScope.activated) {
|
||||
return;
|
||||
}
|
||||
|
||||
helper.interval.add('gsUpdateGui', privateScope.updateGui, 200);
|
||||
|
||||
$viewport.find(".tab_container").hide();
|
||||
$viewport.find('#content').hide();
|
||||
$viewport.find('#status-bar').hide();
|
||||
|
||||
privateScope.$gsViewport = $viewport.find('#view-groundstation');
|
||||
|
||||
privateScope.$gsViewport.show();
|
||||
|
||||
privateScope.activated = true;
|
||||
GUI.log(chrome.i18n.getMessage('gsActivated'));
|
||||
}
|
||||
|
||||
publicScope.deactivate = function () {
|
||||
|
||||
if (!privateScope.activated) {
|
||||
return;
|
||||
}
|
||||
|
||||
helper.interval.remove('gsUpdateGui');
|
||||
|
||||
privateScope.activated = false;
|
||||
GUI.log(chrome.i18n.getMessage('gsDeactivated'));
|
||||
}
|
||||
|
||||
privateScope.updateGui = function () {
|
||||
console.log('updateGui');
|
||||
};
|
||||
|
||||
return publicScope;
|
||||
})();
|
|
@ -326,7 +326,9 @@ function onOpen(openInfo) {
|
|||
|
||||
// disconnect after 10 seconds with error if we don't get IDENT data
|
||||
helper.timeout.add('connecting', function () {
|
||||
if (!CONFIGURATOR.connectionValid) {
|
||||
|
||||
//As we add LTM listener, we need to invalidate connection only when both protocols are not listening!
|
||||
if (!CONFIGURATOR.connectionValid && !helper.ltmDecoder.isReceiving()) {
|
||||
GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
|
||||
|
||||
helper.mspQueue.flush();
|
||||
|
@ -338,6 +340,13 @@ function onOpen(openInfo) {
|
|||
}
|
||||
}, 10000);
|
||||
|
||||
//Add a timer that every 1s will check if LTM stream is receiving data and display alert if so
|
||||
helper.interval.add('ltm-connection-check', function () {
|
||||
if (helper.ltmDecoder.isReceiving()) {
|
||||
helper.groundstation.activate($('#main-wrapper'));
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
FC.resetState();
|
||||
|
||||
// request configuration data. Start with MSPv1 and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue