Merge pull request #2092 from iNavFlight/dzikuvx-refactor-programming-defines
Refactor programming defines and extract definitions to separate modulespull/2101/head
commit
c7dfab991d
@ -0,0 +1,131 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const OPERAND_TYPES = {
|
||||||
|
0: {
|
||||||
|
name: "Value",
|
||||||
|
type: "value",
|
||||||
|
min: -1000000,
|
||||||
|
max: 1000000,
|
||||||
|
step: 1,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
1: {
|
||||||
|
name: "Get RC Channel",
|
||||||
|
type: "range",
|
||||||
|
range: [1, 16],
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
name: "Flight",
|
||||||
|
type: "dictionary",
|
||||||
|
default: 0,
|
||||||
|
values: {
|
||||||
|
0: "ARM timer [s]",
|
||||||
|
1: "Home distance [m]",
|
||||||
|
2: "Trip distance [m]",
|
||||||
|
3: "RSSI",
|
||||||
|
4: "Vbat [centi-Volt] [1V = 100]",
|
||||||
|
5: "Cell voltage [centi-Volt] [1V = 100]",
|
||||||
|
6: "Current [centi-Amp] [1A = 100]",
|
||||||
|
7: "Current drawn [mAh]",
|
||||||
|
8: "GPS Sats",
|
||||||
|
9: "Ground speed [cm/s]",
|
||||||
|
10: "3D speed [cm/s]",
|
||||||
|
11: "Air speed [cm/s]",
|
||||||
|
12: "Altitude [cm]",
|
||||||
|
13: "Vertical speed [cm/s]",
|
||||||
|
14: "Throttle position [%]",
|
||||||
|
15: "Roll [deg]",
|
||||||
|
16: "Pitch [deg]",
|
||||||
|
17: "Is Armed",
|
||||||
|
18: "Is Autolaunch",
|
||||||
|
19: "Is Controlling Altitude",
|
||||||
|
20: "Is Controlling Position",
|
||||||
|
21: "Is Emergency Landing",
|
||||||
|
22: "Is RTH",
|
||||||
|
23: "Is Landing",
|
||||||
|
24: "Is Failsafe",
|
||||||
|
25: "Stabilized Roll",
|
||||||
|
26: "Stabilized Pitch",
|
||||||
|
27: "Stabilized Yaw",
|
||||||
|
28: "3D home distance [m]",
|
||||||
|
29: "CRSF LQ",
|
||||||
|
30: "CRSF SNR",
|
||||||
|
31: "GPS Valid Fix",
|
||||||
|
32: "Loiter Radius [cm]",
|
||||||
|
33: "Active PIDProfile",
|
||||||
|
34: "Battery cells",
|
||||||
|
35: "AGL status [0/1]",
|
||||||
|
36: "AGL [cm]",
|
||||||
|
37: "Rangefinder [cm]",
|
||||||
|
38: "Active MixerProfile",
|
||||||
|
39: "MixerTransition Active",
|
||||||
|
40: "Yaw [deg]",
|
||||||
|
41: "FW Land State"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
name: "Flight Mode",
|
||||||
|
type: "dictionary",
|
||||||
|
default: 0,
|
||||||
|
values: {
|
||||||
|
0: "Failsafe",
|
||||||
|
1: "Manual",
|
||||||
|
2: "RTH",
|
||||||
|
3: "Position Hold",
|
||||||
|
4: "Cruise",
|
||||||
|
5: "Altitude Hold",
|
||||||
|
6: "Angle",
|
||||||
|
7: "Horizon",
|
||||||
|
8: "Air",
|
||||||
|
9: "USER 1",
|
||||||
|
10: "USER 2",
|
||||||
|
11: "Course Hold",
|
||||||
|
12: "USER 3",
|
||||||
|
13: "USER 4",
|
||||||
|
14: "Acro",
|
||||||
|
15: "Waypoint Mission",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
4: {
|
||||||
|
name: "Logic Condition",
|
||||||
|
type: "range",
|
||||||
|
range: [0, 63],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
name: "Get Global Variable",
|
||||||
|
type: "range",
|
||||||
|
range: [0, 7],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
6: {
|
||||||
|
name: "Programming PID",
|
||||||
|
type: "range",
|
||||||
|
range: [0, 3],
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
7: {
|
||||||
|
name: "Waypoints",
|
||||||
|
type: "dictionary",
|
||||||
|
default: 0,
|
||||||
|
values: {
|
||||||
|
0: "Is WP",
|
||||||
|
1: "Current Waypoint Index",
|
||||||
|
2: "Current Waypoint Action",
|
||||||
|
3: "Next Waypoint Action",
|
||||||
|
4: "Distance to next Waypoint [m]",
|
||||||
|
5: "Distance from last Waypoint [m]",
|
||||||
|
6: "Current WP has User Action 1",
|
||||||
|
7: "Current WP has User Action 2",
|
||||||
|
8: "Current WP has User Action 3",
|
||||||
|
9: "Current WP has User Action 4",
|
||||||
|
10: "Next WP has User Action 1",
|
||||||
|
11: "Next WP has User Action 2",
|
||||||
|
12: "Next WP has User Action 3",
|
||||||
|
13: "Next WP has User Action 4",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { OPERAND_TYPES };
|
@ -0,0 +1,331 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const LOGIC_OPERATORS = {
|
||||||
|
0: {
|
||||||
|
name: "True",
|
||||||
|
operandType: "Active",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
1: {
|
||||||
|
name: "Equal (A = B)",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
name: "Greater Than (A > B)",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
name: "Lower Than (A < B)",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
4: {
|
||||||
|
name: "Low",
|
||||||
|
operandType: "RC Switch Check",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
name: "Mid",
|
||||||
|
operandType: "RC Switch Check",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
6: {
|
||||||
|
name: "High",
|
||||||
|
operandType: "RC Switch Check",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
7: {
|
||||||
|
name: "AND",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
8: {
|
||||||
|
name: "OR",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
9: {
|
||||||
|
name: "XOR",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
10: {
|
||||||
|
name: "NAND",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
11: {
|
||||||
|
name: "NOR",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
12: {
|
||||||
|
name: "NOT",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
13: {
|
||||||
|
name: "Sticky",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
14: {
|
||||||
|
name: "Basic: Add",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
15: {
|
||||||
|
name: "Basic: Subtract",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
16: {
|
||||||
|
name: "Basic: Multiply",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
17: {
|
||||||
|
name: "Basic: Divide",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
40: {
|
||||||
|
name: "Modulo",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
18: {
|
||||||
|
name: "Set GVAR",
|
||||||
|
operandType: "Variables",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "none"
|
||||||
|
},
|
||||||
|
19: {
|
||||||
|
name: "Increase GVAR",
|
||||||
|
operandType: "Variables",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "none"
|
||||||
|
},
|
||||||
|
20: {
|
||||||
|
name: "Decrease GVAR",
|
||||||
|
operandType: "Variables",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "none"
|
||||||
|
},
|
||||||
|
21: {
|
||||||
|
name: "Set IO Port",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "none"
|
||||||
|
},
|
||||||
|
22: {
|
||||||
|
name: "Override Arming Safety",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
23: {
|
||||||
|
name: "Override Throttle Scale",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
29: {
|
||||||
|
name: "Override Throttle",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
24: {
|
||||||
|
name: "Swap Roll & Yaw",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
25: {
|
||||||
|
name: "Set VTx Power Level",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
30: {
|
||||||
|
name: "Set VTx Band",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
31: {
|
||||||
|
name: "Set VTx Channel",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
26: {
|
||||||
|
name: "Invert Roll",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
27: {
|
||||||
|
name: "Invert Pitch",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
28: {
|
||||||
|
name: "Invert Yaw",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
32: {
|
||||||
|
name: "Set OSD Layout",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
33: {
|
||||||
|
name: "Trigonometry: Sine",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
34: {
|
||||||
|
name: "Trigonometry: Cosine",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
35: {
|
||||||
|
name: "Trigonometry: Tangent",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
36: {
|
||||||
|
name: "Map Input",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
37: {
|
||||||
|
name: "Map Output",
|
||||||
|
operandType: "Maths",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
38: {
|
||||||
|
name: "Override RC Channel",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
|
||||||
|
41: {
|
||||||
|
name: "Override Loiter Radius",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
42: {
|
||||||
|
name: "Set Profile",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
43: {
|
||||||
|
name: "Use Lowest Value",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
44: {
|
||||||
|
name: "Use Highest Value",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
45: {
|
||||||
|
name: "Flight Axis Angle Override",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
46: {
|
||||||
|
name: "Flight Axis Rate Override",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
47: {
|
||||||
|
name: "Edge",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
48: {
|
||||||
|
name: "Delay",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
49: {
|
||||||
|
name: "Timer",
|
||||||
|
operandType: "Logic Switches",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
50: {
|
||||||
|
name: "Delta (|A| >= B)",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
51: {
|
||||||
|
name: "Approx Equals (A ~ B)",
|
||||||
|
operandType: "Comparison",
|
||||||
|
hasOperand: [true, true],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
52: {
|
||||||
|
name: "LED Pin PWM",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "raw"
|
||||||
|
},
|
||||||
|
53: {
|
||||||
|
name: "Disable GPS Sensor Fix",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [true, false],
|
||||||
|
output: "boolean"
|
||||||
|
},
|
||||||
|
54: {
|
||||||
|
name: "Mag calibration",
|
||||||
|
operandType: "Set Flight Parameter",
|
||||||
|
hasOperand: [false, false],
|
||||||
|
output: "boolean"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { LOGIC_OPERATORS };
|
Loading…
Reference in New Issue