Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2020-04-10 22:37:24 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2020-04-10 22:37:24 +0300
commitf85a17d1ad1f6de648082e85a089c396ccdcee46 (patch)
treeec17f8d61b368cd13831bb1ee47c91bcdbf95928 /js
parent1f92a1383add22bcd1ef40e901094be7d1dd96a0 (diff)
Get GVAR status from FC
Diffstat (limited to 'js')
-rw-r--r--js/fc.js3
-rw-r--r--js/globalVariablesStatus.js25
-rw-r--r--js/msp/MSPCodes.js1
-rw-r--r--js/msp/MSPHelper.js20
4 files changed, 48 insertions, 1 deletions
diff --git a/js/fc.js b/js/fc.js
index 9592d03b..c1a1e41a 100644
--- a/js/fc.js
+++ b/js/fc.js
@@ -20,7 +20,9 @@ var CONFIG,
SERVO_RULES,
MOTOR_RULES,
LOGIC_CONDITIONS,
+ LOGIC_CONDITIONS_STATUS,
GLOBAL_FUNCTIONS,
+ GLOBAL_VARIABLES_STATUS,
SERIAL_CONFIG,
SENSOR_DATA,
MOTOR_DATA,
@@ -172,6 +174,7 @@ var FC = {
LOGIC_CONDITIONS = new LogicConditionsCollection();
GLOBAL_FUNCTIONS = new GlobalFunctionsCollection();
LOGIC_CONDITIONS_STATUS = new LogicConditionsStatus();
+ GLOBAL_VARIABLES_STATUS = new GlobalVariablesStatus();
MIXER_CONFIG = {
yawMotorDirection: 0,
diff --git a/js/globalVariablesStatus.js b/js/globalVariablesStatus.js
new file mode 100644
index 00000000..9fa33e30
--- /dev/null
+++ b/js/globalVariablesStatus.js
@@ -0,0 +1,25 @@
+'use strict';
+
+let GlobalVariablesStatus = function () {
+
+ let self = {},
+ data = [];
+
+ self.set = function (condition, value) {
+ data[condition] = value;
+ }
+
+ self.get = function (condition) {
+ if (typeof data[condition] !== 'undefined') {
+ return data[condition];
+ } else {
+ return null;
+ }
+ }
+
+ self.getAll = function() {
+ return data;
+ }
+
+ return self;
+}; \ No newline at end of file
diff --git a/js/msp/MSPCodes.js b/js/msp/MSPCodes.js
index 285cb317..028386f6 100644
--- a/js/msp/MSPCodes.js
+++ b/js/msp/MSPCodes.js
@@ -210,6 +210,7 @@ var MSPCodes = {
MSP2_INAV_GLOBAL_FUNCTIONS: 0x2024,
MSP2_INAV_SET_GLOBAL_FUNCTIONS: 0x2025,
MSP2_INAV_LOGIC_CONDITIONS_STATUS: 0x2026,
+ MSP2_INAV_GVAR_STATUS: 0x2027,
MSP2_PID: 0x2030,
MSP2_SET_PID: 0x2031,
diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js
index 305b6519..d19d9bc7 100644
--- a/js/msp/MSPHelper.js
+++ b/js/msp/MSPHelper.js
@@ -535,6 +535,16 @@ var mspHelper = (function (gui) {
}
break;
+ case MSPCodes.MSP2_INAV_GVAR_STATUS:
+ if (data.byteLength % 4 === 0) {
+ let index = 0;
+ for (i = 0; i < data.byteLength; i += 4) {
+ GLOBAL_VARIABLES_STATUS.set(index, data.getInt32(i, true));
+ index++;
+ }
+ }
+ break;
+
case MSPCodes.MSP2_INAV_SET_LOGIC_CONDITIONS:
console.log("Logic conditions saved");
break;
@@ -3305,7 +3315,7 @@ var mspHelper = (function (gui) {
MSP.send_message(MSPCodes.MSP2_INAV_MC_BRAKING, false, false, callback);
}
- self.loadSensorStatus = function (callback) {
+ self.loadLogicConditionsStatus = function (callback) {
if (semver.gte(CONFIG.flightControllerVersion, "2.3.0")) {
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_STATUS, false, false, callback);
} else {
@@ -3313,5 +3323,13 @@ var mspHelper = (function (gui) {
}
};
+ self.loadGlobalVariablesStatus = function (callback) {
+ if (semver.gte(CONFIG.flightControllerVersion, "2.5.0")) {
+ MSP.send_message(MSPCodes.MSP2_INAV_GVAR_STATUS, false, false, callback);
+ } else {
+ callback();
+ }
+ };
+
return self;
})(GUI);