1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-13 11:29:53 +03:00

When LTM stream is detected, the app will automatically switch to groundstation mode.

This commit is contained in:
Pawel Spychalski (DzikuVx) 2024-03-07 20:51:15 +01:00
parent 5e4e9294f8
commit c7b924e67b
6 changed files with 78 additions and 1 deletions

View file

@ -5603,5 +5603,11 @@
}, },
"ezTuneNote": { "ezTuneNote": {
"message": "<strong>Important</strong> Ez Tune is enabled. All settings on this tab are set and controlled by the Ez Tune. To use PID Tuning tab you have to disable Ez Tune. To do it, uncheck the <strong>Enabled</strong> checkbox on the Ez Tune tab." "message": "<strong>Important</strong> Ez Tune is enabled. All settings on this tab are set and controlled by the Ez Tune. To use PID Tuning tab you have to disable Ez Tune. To do it, uncheck the <strong>Enabled</strong> checkbox on the Ez Tune tab."
},
"gsActivated": {
"message": "Ground station mode activated"
},
"gsDeactivated": {
"message": "Ground station mode deactivated"
} }
} }

View file

@ -55,6 +55,7 @@ sources.css = [
'./node_modules/openlayers/dist/ol.css', './node_modules/openlayers/dist/ol.css',
'./src/css/logic.css', './src/css/logic.css',
'./src/css/defaults_dialog.css', './src/css/defaults_dialog.css',
'./src/css/groundstation.css',
]; ];
sources.js = [ sources.js = [
@ -141,6 +142,7 @@ sources.js = [
'./js/CliAutoComplete.js', './js/CliAutoComplete.js',
'./node_modules/jquery-textcomplete/dist/jquery.textcomplete.js', './node_modules/jquery-textcomplete/dist/jquery.textcomplete.js',
'./js/ltmDecoder.js', './js/ltmDecoder.js',
'./js/groundstation.js'
]; ];
sources.receiverCss = [ sources.receiverCss = [

54
js/groundstation.js Normal file
View 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;
})();

View file

@ -326,7 +326,9 @@ function onOpen(openInfo) {
// disconnect after 10 seconds with error if we don't get IDENT data // disconnect after 10 seconds with error if we don't get IDENT data
helper.timeout.add('connecting', function () { 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')); GUI.log(chrome.i18n.getMessage('noConfigurationReceived'));
helper.mspQueue.flush(); helper.mspQueue.flush();
@ -338,6 +340,13 @@ function onOpen(openInfo) {
} }
}, 10000); }, 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(); FC.resetState();
// request configuration data. Start with MSPv1 and // request configuration data. Start with MSPv1 and

View file

@ -174,6 +174,7 @@
<div id="scrollicon"></div> <div id="scrollicon"></div>
<div class="wrapper"></div> <div class="wrapper"></div>
</div> </div>
<div id="view-groundstation" style="display: none;"></div>
<div class="tab_container"> <div class="tab_container">
<div id="tabs"> <div id="tabs">
<ul class="mode-disconnected"> <ul class="mode-disconnected">

View file

@ -0,0 +1,5 @@
#view-groundstation {
background-color: #2e2e2e;
width: 100%;
height: 100%;
}