mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-24 00:35:20 +03:00
Add ability to read Programming PID status via MSP
This commit is contained in:
parent
561b288919
commit
0d66fd4c54
6 changed files with 63 additions and 6 deletions
|
@ -108,6 +108,7 @@ sources.js = [
|
|||
'./js/globalVariablesStatus.js',
|
||||
'./js/programmingPid.js',
|
||||
'./js/programmingPidCollection.js',
|
||||
'./js/programmingPidStatus.js',
|
||||
'./js/vtx.js',
|
||||
'./main.js',
|
||||
'./js/tabs.js',
|
||||
|
|
2
js/fc.js
2
js/fc.js
|
@ -24,6 +24,7 @@ var CONFIG,
|
|||
GLOBAL_FUNCTIONS,
|
||||
GLOBAL_VARIABLES_STATUS,
|
||||
PROGRAMMING_PID,
|
||||
PROGRAMMING_PID_STATUS,
|
||||
SERIAL_CONFIG,
|
||||
SENSOR_DATA,
|
||||
MOTOR_DATA,
|
||||
|
@ -179,6 +180,7 @@ var FC = {
|
|||
LOGIC_CONDITIONS_STATUS = new LogicConditionsStatus();
|
||||
GLOBAL_VARIABLES_STATUS = new GlobalVariablesStatus();
|
||||
PROGRAMMING_PID = new ProgrammingPidCollection();
|
||||
PROGRAMMING_PID_STATUS = new ProgrammingPidStatus();
|
||||
|
||||
MIXER_CONFIG = {
|
||||
yawMotorDirection: 0,
|
||||
|
|
|
@ -213,6 +213,7 @@ var MSPCodes = {
|
|||
MSP2_INAV_GVAR_STATUS: 0x2027,
|
||||
MSP2_INAV_PROGRAMMING_PID: 0x2028,
|
||||
MSP2_INAV_SET_PROGRAMMING_PID: 0x2029,
|
||||
MSP2_INAV_PROGRAMMING_PID_STATUS: 0x202A,
|
||||
|
||||
MSP2_PID: 0x2030,
|
||||
MSP2_SET_PID: 0x2031,
|
||||
|
|
|
@ -556,6 +556,16 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_INAV_PROGRAMMING_PID_STATUS:
|
||||
if (data.byteLength % 4 === 0) {
|
||||
let index = 0;
|
||||
for (i = 0; i < data.byteLength; i += 4) {
|
||||
PROGRAMMING_PID_STATUS.set(index, data.getInt32(i, true));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_INAV_SET_PROGRAMMING_PID:
|
||||
console.log("Programming PID saved");
|
||||
break;
|
||||
|
@ -3246,5 +3256,13 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
};
|
||||
|
||||
self.loadProgrammingPidStatus = function (callback) {
|
||||
if (semver.gte(CONFIG.flightControllerVersion, "2.6.0")) {
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_PROGRAMMING_PID_STATUS, false, false, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
})(GUI);
|
||||
|
|
33
js/programmingPidStatus.js
Normal file
33
js/programmingPidStatus.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
|
||||
let ProgrammingPidStatus = 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;
|
||||
}
|
||||
|
||||
self.update = function ($container) {
|
||||
|
||||
}
|
||||
|
||||
self.init = function ($container) {
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
};
|
|
@ -14,7 +14,8 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
|||
|
||||
loadChainer.setChain([
|
||||
mspHelper.loadLogicConditions,
|
||||
mspHelper.loadGlobalVariablesStatus
|
||||
mspHelper.loadGlobalVariablesStatus,
|
||||
mspHelper.loadProgrammingPidStatus
|
||||
]);
|
||||
loadChainer.setExitPoint(loadHtml);
|
||||
loadChainer.execute();
|
||||
|
@ -26,7 +27,8 @@ TABS.programming.initialize = function (callback, scrollPosition) {
|
|||
|
||||
statusChainer.setChain([
|
||||
mspHelper.loadLogicConditionsStatus,
|
||||
mspHelper.loadGlobalVariablesStatus
|
||||
mspHelper.loadGlobalVariablesStatus,
|
||||
mspHelper.loadProgrammingPidStatus
|
||||
]);
|
||||
statusChainer.setExitPoint(onStatusPullDone);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue