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-05-11 13:34:49 +0300
committerPawel Spychalski (DzikuVx) <pspychalski@gmail.com>2020-05-11 13:34:49 +0300
commitd0ae05d17e1ca84069fafe95ba64f1e69321124f (patch)
tree43674f844e8fe6ed8686b7c7c878f089cb5b3c20 /js
parente742a481e22b84eb5f06f5c4922b3c731b8f8eb5 (diff)
Simplify Preset handling
Diffstat (limited to 'js')
-rw-r--r--js/preset_definitions.js162
1 files changed, 90 insertions, 72 deletions
diff --git a/js/preset_definitions.js b/js/preset_definitions.js
index 662d79b8..5149d047 100644
--- a/js/preset_definitions.js
+++ b/js/preset_definitions.js
@@ -37,17 +37,9 @@ presets.defaultValues = {
[0, 0, 0, 0] //PID_VEL_Z
]},
INAV_PID_CONFIG: {"asynchronousMode": "0", "accelerometerTaskFrequency": 500, "attitudeTaskFrequency": 250, "magHoldRateLimit": 90, "magHoldErrorLpfFrequency": 2, "yawJumpPreventionLimit": 200, "gyroscopeLpf": "3", "accSoftLpfHz": 15},
- ADVANCED_CONFIG: {"gyroSyncDenominator": 2, "pidProcessDenom": 1, "useUnsyncedPwm": 1, "motorPwmProtocol": 0, "motorPwmRate": 400, "servoPwmRate": 50, "gyroSync": 1},
RC_tuning: {"RC_RATE": 1, "RC_EXPO": 0.7, "roll_pitch_rate": 0, "roll_rate": 200, "pitch_rate": 200, "yaw_rate": 200, "dynamic_THR_PID": 0, "throttle_MID": 0.5, "throttle_EXPO": 0, "dynamic_THR_breakpoint": 1500, "RC_YAW_EXPO": 0.2},
PID_ADVANCED: {"rollPitchItermIgnoreRate": 200, "yawItermIgnoreRate": 50, "yawPLimit": 300, "axisAccelerationLimitRollPitch": 0, "axisAccelerationLimitYaw": 1000},
- FILTER_CONFIG: {"gyroSoftLpfHz": 60, "dtermLpfHz": 40, "yawLpfHz": 30, "gyroNotchHz1": 0, "gyroNotchCutoff1": 0, "dtermNotchHz": 0, "dtermNotchCutoff": 0, "gyroNotchHz2": 0, "gyroNotchCutoff2": 0, "accNotchHz": 0, "accNotchCutoff": 0, "gyroStage2LowpassHz": 0},
- FC_CONFIG: {"loopTime": 1000},
- MIXER_CONFIG: {
- "yawMotorDirection": 1,
- "yawJumpPreventionLimit": 200,
- "platformType": 0,
- "hasFlaps": false
- }
+ FILTER_CONFIG: {"gyroSoftLpfHz": 60, "dtermLpfHz": 40, "yawLpfHz": 30, "gyroNotchHz1": 0, "gyroNotchCutoff1": 0, "dtermNotchHz": 0, "dtermNotchCutoff": 0, "gyroNotchHz2": 0, "gyroNotchCutoff2": 0, "accNotchHz": 0, "accNotchCutoff": 0, "gyroStage2LowpassHz": 0}
};
presets.settings = {
@@ -72,11 +64,6 @@ presets.settings = {
}
/**
- * When defining a preset, following fields are required:
- *
- * BF_CONFIG::mixerConfiguration
- * MIXER_CONFIG::platformType
- *
* @type {{name: string, description: string, features: string[], applyDefaults: string[], settingsMSP: *[], type: string}[]}
*/
presets.presets = [
@@ -84,13 +71,14 @@ presets.presets = [
name: '3-inch Multirotor Preset',
description: "INAV Quad X configuration, 3-inch propellers. F4/F7 CPU.",
features: ["DSHOT600", "4k mode", "Matrix Filter", "Improved mechanics", "Optimized filtering", "Optimized rates"],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -253,13 +241,14 @@ presets.presets = [
name: 'MegaBee Cinewoop',
description: "iFlight MegaBee Preset",
features: ["DSHOT600", "4k mode", "Matrix Filter", "Improved mechanics", "Optimized filtering", "Optimized rates"],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -430,13 +419,14 @@ presets.presets = [
name: '5-inch Multirotor Preset',
description: "INAV Quad X configuration, 5-inch propellers. F4/F7 CPU. GPS and Magnetometer are optional",
features: ["DSHOT600", "2k mode", "Matrix Filter", "Improved mechanics", "Optimized filtering", "Optimized rates"],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -546,7 +536,7 @@ presets.presets = [
},
{
key: "mc_d_roll",
- value: 25
+ value: 23
},
{
key: "mc_p_yaw",
@@ -591,13 +581,14 @@ presets.presets = [
name: '5-inch, 2208 2450KV motors',
description: "Overpowered freestyle kwad. 5-inch, 3 bladed propellers like HQProp S4, Nepal N1, 2208 2450KV motors, 4S, DSHOT600 ESC protocol. Optimized for smooth, freestyle or acrobatic flight.",
features: ["DSHOT600", "4k mode", "Matrix Filter", "Improved mechanics", "Optimized filtering", "Optimized rates"],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -619,7 +610,7 @@ presets.presets = [
},
{
key: "gyro_stage2_lowpass_hz",
- value: 250
+ value: 0
},
{
key: "gyro_stage2_lowpass_type",
@@ -635,7 +626,7 @@ presets.presets = [
},
{
key: "dterm_lpf2_hz",
- value: 250
+ value: 170
},
{
key: "dterm_lpf2_type",
@@ -703,7 +694,7 @@ presets.presets = [
},
{
key: "mc_d_pitch",
- value: 30
+ value: 28
},
{
key: "mc_p_roll",
@@ -715,7 +706,7 @@ presets.presets = [
},
{
key: "mc_d_roll",
- value: 26
+ value: 24
},
{
key: "mc_p_yaw",
@@ -760,13 +751,14 @@ presets.presets = [
name: '6-inch, 2207 1700KV motors',
description: "6-inch, 3 bladed propellers, 2207 1700KV motors, 4S, DSHOT600 ESC protocol. Optimized for smooth, freestyle or acrobatic flight with GPS or not.",
features: ["DSHOT600", "2k mode", "Matrix Filter", "Improved mechanics", "Optimized filtering", "Optimized rates"],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -929,13 +921,14 @@ presets.presets = [
name: '7-inch Multirotor Preset',
description: "General configuration for 7-inch propellers. Adjusted rates and filtering.",
features: ["DSHOT600", "2k mode", "Matrix Filter", "Improved mechanics", "Optimized filtering", "Optimized rates"],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -1103,13 +1096,14 @@ presets.presets = [
"Improved PID defaults",
"Adjusted filtering"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
- settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3),
- presets.elementHelper("MIXER_CONFIG", "platformType", 0)
- ],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
+ settingsMSP: [],
settings: [
{
+ key: "platform_type",
+ value: "MULTIROTOR"
+ },
+ {
key: "motor_pwm_protocol",
value: "DSHOT600"
},
@@ -1280,15 +1274,19 @@ presets.presets = [
"Adjusted PIDs",
"Adjusted rates"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 14),
- presets.elementHelper("MIXER_CONFIG", "platformType", 1),
presets.elementHelper("RC_tuning", "roll_rate", 200),
presets.elementHelper("RC_tuning", "pitch_rate", 150),
presets.elementHelper("RC_tuning", "yaw_rate", 90),
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 1)
],
+ settings: [
+ {
+ key: "platform_type",
+ value: "AIRPLANE"
+ }
+ ],
type: 'airplane'
},
{
@@ -1300,10 +1298,8 @@ presets.presets = [
"Adjusted PIDs",
"Adjusted rates"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 8),
- presets.elementHelper("MIXER_CONFIG", "platformType", 1),
presets.elementHelper("PIDs", 0, [2, 15, 0, 30]), //ROLL PIDs
presets.elementHelper("PIDs", 1, [2, 15, 0, 70]), //PITCH PIDs
presets.elementHelper("PIDs", 7, [10, 15, 75, 0]), //LEVEL PIDs
@@ -1313,6 +1309,12 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1300),
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 4)
],
+ settings: [
+ {
+ key: "platform_type",
+ value: "AIRPLANE"
+ }
+ ],
type: 'flyingwing'
},
{
@@ -1323,10 +1325,8 @@ presets.presets = [
"Adjusted PIDs",
"Adjusted rates"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 8),
- presets.elementHelper("MIXER_CONFIG", "platformType", 1),
presets.elementHelper("PIDs", 0, [6, 6, 0, 49]), //ROLL PIDs
presets.elementHelper("PIDs", 1, [6, 9, 0, 52]), //PITCH PIDs
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0),
@@ -1336,6 +1336,12 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_PID", 20),
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1600)
],
+ settings: [
+ {
+ key: "platform_type",
+ value: "AIRPLANE"
+ }
+ ],
type: 'flyingwing'
},
{
@@ -1346,10 +1352,8 @@ presets.presets = [
"Adjusted PIDs",
"Adjusted rates"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 8),
- presets.elementHelper("MIXER_CONFIG", "platformType", 1),
presets.elementHelper("PIDs", 0, [7, 7, 0, 25]), //ROLL PIDs
presets.elementHelper("PIDs", 1, [5, 9, 0, 56]), //PITCH PIDs
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0),
@@ -1359,6 +1363,12 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_PID", 30),
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1550)
],
+ settings: [
+ {
+ key: "platform_type",
+ value: "AIRPLANE"
+ }
+ ],
type: 'flyingwing'
},
{
@@ -1369,10 +1379,8 @@ presets.presets = [
"Adjusted PIDs",
"Adjusted rates"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 8),
- presets.elementHelper("MIXER_CONFIG", "platformType", 1),
presets.elementHelper("PIDs", 0, [9, 12, 0, 15]), //ROLL PIDs
presets.elementHelper("PIDs", 1, [9, 15, 0, 14]), //PITCH PIDs
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0),
@@ -1382,6 +1390,12 @@ presets.presets = [
presets.elementHelper("RC_tuning", "dynamic_THR_PID", 30),
presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1500)
],
+ settings: [
+ {
+ key: "platform_type",
+ value: "AIRPLANE"
+ }
+ ],
type: 'flyingwing'
},
{
@@ -1392,10 +1406,8 @@ presets.presets = [
"Adjusted PIDs",
"Adjusted rates"
],
- applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"],
+ applyDefaults: ["PIDs", "INAV_PID_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG"],
settingsMSP: [
- presets.elementHelper("BF_CONFIG", "mixerConfiguration", 8),
- presets.elementHelper("MIXER_CONFIG", "platformType", 1),
presets.elementHelper("PIDs", 0, [8, 16, 0, 64]), //ROLL PIDs
presets.elementHelper("PIDs", 1, [5, 18, 0, 60]), //PITCH PIDs
presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0),
@@ -1403,6 +1415,12 @@ presets.presets = [
presets.elementHelper("RC_tuning", "roll_rate", 280),
presets.elementHelper("RC_tuning", "pitch_rate", 120)
],
+ settings: [
+ {
+ key: "platform_type",
+ value: "AIRPLANE"
+ }
+ ],
type: 'flyingwing'
}
]; \ No newline at end of file