diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 600251a1..f85efbaa 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2205,7 +2205,7 @@ "message": "Warning" }, "presetApplyDescription": { - "message": "Preset overwrites selected configuration values including mixer, filtering, PIDs and other. Settings like: flight modes, radio settings, failsafe and OSD are not changed. Applied values should NOT treated as final values, but entry points for final tuning.
Always check new configuration before flying!" + "message": "

Make sure that mixer was configured before applying any Presets!

Preset overwrites selected configuration values including mixer, filtering, PIDs and other. Settings like: flight modes, radio settings, failsafe and OSD are not changed. Applied values should NOT treated as final values, but entry points for final tuning.
Always check new configuration before flying!

" }, "OK": { "message": "OK" diff --git a/gulpfile.js b/gulpfile.js index 159340bd..b7a8b09e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -108,6 +108,7 @@ sources.js = [ './js/vtx.js', './main.js', './js/tabs.js', + './js/preset_definitions.js', './tabs/*.js', './js/eventFrequencyAnalyzer.js', './js/periodicStatusUpdater.js', diff --git a/js/defaults_dialog.js b/js/defaults_dialog.js index d68ab183..2202e6f8 100644 --- a/js/defaults_dialog.js +++ b/js/defaults_dialog.js @@ -43,6 +43,10 @@ helper.defaultsDialog = (function() { }, { key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", value: "RP" }, { diff --git a/js/preset_definitions.js b/js/preset_definitions.js new file mode 100644 index 00000000..662d79b8 --- /dev/null +++ b/js/preset_definitions.js @@ -0,0 +1,1408 @@ +'use strict'; + +var presets = presets || {}; + +presets.elementHelper = function (group, field, value) { + return { + group: group, + field: field, + value: value + } +}; + +presets.defaultValues = { + PIDs: { + mr: [ + [40, 30, 23, 0], //PID_ROLL + [40, 30, 23, 0], //PID_PITCH + [85, 45, 0, 0], //PID_YAW + [50, 0, 0, 0], //PID_POS_Z + [65, 120, 10, 0], //PID_POS_XY + [40, 15, 100, 40], //PID_VEL_XY + [0, 0, 0, 0], //PID_SURFACE + [20, 15, 75, 0], //PID_LEVEL + [60, 0, 0, 0], //PID_HEADING + [100, 50, 10, 0] //PID_VEL_Z + ], + fw: [ + [5, 7, 0, 50], //PID_ROLL + [5, 7, 0, 50], //PID_PITCH + [6, 10, 0, 60], //PID_YAW + [40, 5, 10, 0], //PID_POS_Z + [75, 5, 8, 0], //PID_POS_XY + [0, 0, 0, 0], //PID_VEL_XY + [0, 0, 0, 0], //PID_SURFACE + [20, 5, 75, 0], //PID_LEVEL + [60, 0, 0, 0], //PID_HEADING + [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 + } +}; + +presets.settings = { + COMMON: { + + }, + FW: { + "small_angle": 180, + }, + MR: { + }, + get: function(mixerType) { + var settings = {}; + $.extend(settings, presets.settings.COMMON); + if (mixerType == 'multirotor') { + $.extend(settings, presets.settings.MR); + } else { + $.extend(settings, presets.settings.FW); + } + return 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 = [ + { + 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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 250 + }, + { + key: "gyro_lpf_hz", + value: 130 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 150 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "dterm_lpf_hz", + value: 100 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "dterm_lpf2_hz", + value: 150 + }, + { + key: "dterm_lpf2_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", + value: "RP" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 5000.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 80 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 70 + }, + { + key: "pitch_rate", + value: 70 + }, + { + key: "yaw_rate", + value: 60 + }, + { + key: "mc_p_pitch", + value: 38 + }, + { + key: "mc_i_pitch", + value: 55 + }, + { + key: "mc_d_pitch", + value: 25 + }, + { + key: "mc_p_roll", + value: 35 + }, + { + key: "mc_i_roll", + value: 50 + }, + { + key: "mc_d_roll", + value: 25 + }, + { + key: "mc_p_yaw", + value: 45 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 150 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 150 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.500 + } + ], + type: 'multirotor' + }, + { + 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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 250 + }, + { + key: "gyro_lpf_hz", + value: 130 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 180 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "gyro_notch1_hz", + value: 200 + }, + { + key: "gyro_notch1_cutoff", + value: 175 + }, + { + key: "dterm_lpf_hz", + value: 100 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "dterm_lpf2_hz", + value: 150 + }, + { + key: "dterm_lpf2_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "GYRO" + }, + { + key: "mc_iterm_relax", + value: "RP" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 5000.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 80 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 70 + }, + { + key: "pitch_rate", + value: 70 + }, + { + key: "yaw_rate", + value: 60 + }, + { + key: "mc_p_pitch", + value: 34 + }, + { + key: "mc_i_pitch", + value: 55 + }, + { + key: "mc_d_pitch", + value: 35 + }, + { + key: "mc_p_roll", + value: 32 + }, + { + key: "mc_i_roll", + value: 45 + }, + { + key: "mc_d_roll", + value: 33 + }, + { + key: "mc_p_yaw", + value: 65 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 180 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 150 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.400 + } + ], + type: 'multirotor' + }, + { + 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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 500 + }, + { + key: "gyro_lpf_hz", + value: 110 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 250 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "dterm_lpf_hz", + value: 100 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", + value: "RP" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 7500.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 80 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 70 + }, + { + key: "pitch_rate", + value: 70 + }, + { + key: "yaw_rate", + value: 60 + }, + { + key: "mc_p_pitch", + value: 44 + }, + { + key: "mc_i_pitch", + value: 60 + }, + { + key: "mc_d_pitch", + value: 25 + }, + { + key: "mc_p_roll", + value: 40 + }, + { + key: "mc_i_roll", + value: 50 + }, + { + key: "mc_d_roll", + value: 25 + }, + { + key: "mc_p_yaw", + value: 45 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 200 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 150 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.850 + } + ], + type: 'multirotor' + }, + { + 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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 250 + }, + { + key: "gyro_lpf_hz", + value: 115 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 250 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "dterm_lpf_hz", + value: 110 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "dterm_lpf2_hz", + value: 250 + }, + { + key: "dterm_lpf2_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", + value: "RP" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 7500.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 80 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 85 + }, + { + key: "pitch_rate", + value: 85 + }, + { + key: "yaw_rate", + value: 75 + }, + { + key: "mc_p_pitch", + value: 26 + }, + { + key: "mc_i_pitch", + value: 60 + }, + { + key: "mc_d_pitch", + value: 30 + }, + { + key: "mc_p_roll", + value: 22 + }, + { + key: "mc_i_roll", + value: 50 + }, + { + key: "mc_d_roll", + value: 26 + }, + { + key: "mc_p_yaw", + value: 44 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 200 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 140 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.850 + } + ], + type: 'multirotor' + }, + { + 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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 500 + }, + { + key: "gyro_lpf_hz", + value: 100 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 250 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "dterm_lpf_hz", + value: 90 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "dterm_lpf2_hz", + value: 200 + }, + { + key: "dterm_lpf2_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", + value: "RP" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 5500.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 70 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 70 + }, + { + key: "pitch_rate", + value: 70 + }, + { + key: "yaw_rate", + value: 60 + }, + { + key: "mc_p_pitch", + value: 37 + }, + { + key: "mc_i_pitch", + value: 70 + }, + { + key: "mc_d_pitch", + value: 22 + }, + { + key: "mc_p_roll", + value: 31 + }, + { + key: "mc_i_roll", + value: 50 + }, + { + key: "mc_d_roll", + value: 21 + }, + { + key: "mc_p_yaw", + value: 50 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 175 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 110 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.700 + } + ], + type: 'multirotor' + }, + { + 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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 500 + }, + { + key: "gyro_lpf_hz", + value: 100 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 160 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "dterm_lpf_hz", + value: 90 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "dterm_lpf2_hz", + value: 0 + }, + { + key: "dterm_lpf2_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", + value: "RPY" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 5000.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 65 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 70 + }, + { + key: "pitch_rate", + value: 70 + }, + { + key: "yaw_rate", + value: 60 + }, + { + key: "mc_p_pitch", + value: 44 + }, + { + key: "mc_i_pitch", + value: 60 + }, + { + key: "mc_d_pitch", + value: 25 + }, + { + key: "mc_p_roll", + value: 40 + }, + { + key: "mc_i_roll", + value: 50 + }, + { + key: "mc_d_roll", + value: 25 + }, + { + key: "mc_p_yaw", + value: 45 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 200 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 80 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.800 + } + ], + type: 'multirotor' + }, + { + name: '10-inch Multirotor Preset', + description: "450-600 class general purpose multirotor with 10-inch 2-bladed propellers.", + features: [ + "DSHOT600", + "400dps rates", + "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) + ], + settings: [ + { + key: "motor_pwm_protocol", + value: "DSHOT600" + }, + { + key: "gyro_hardware_lpf", + value: "256HZ" + }, + { + key: "looptime", + value: 500 + }, + { + key: "gyro_lpf_hz", + value: 60 + }, + { + key: "gyro_lpf_type", + value: "PT1" + }, + { + key: "gyro_stage2_lowpass_hz", + value: 120 + }, + { + key: "gyro_stage2_lowpass_type", + value: "PT1" + }, + { + key: "dterm_lpf_hz", + value: 60 + }, + { + key: "dterm_lpf_type", + value: "PT1" + }, + { + key: "dterm_lpf2_hz", + value: 0 + }, + { + key: "dterm_lpf2_type", + value: "PT1" + }, + { + key: "use_dterm_fir_filter", + value: "OFF" + }, + { + key: "mc_iterm_relax_type", + value: "SETPOINT" + }, + { + key: "mc_iterm_relax", + value: "RPY" + }, + { + key: "d_boost_factor", + value: 1.5 + }, + { + key: "d_boost_max_at_acceleration", + value: 5000.000 + }, + { + key: "d_boost_gyro_delta_lpf_hz", + value: 50 + }, + { + key: "antigravity_gain", + value: 2 + }, + { + key: "antigravity_accelerator", + value: 5 + }, + { + key: "rc_yaw_expo", + value: 70 + }, + { + key: "rc_expo", + value: 70 + }, + { + key: "roll_rate", + value: 70 + }, + { + key: "pitch_rate", + value: 70 + }, + { + key: "yaw_rate", + value: 60 + }, + { + key: "mc_p_pitch", + value: 44 + }, + { + key: "mc_i_pitch", + value: 60 + }, + { + key: "mc_d_pitch", + value: 25 + }, + { + key: "mc_p_roll", + value: 40 + }, + { + key: "mc_i_roll", + value: 50 + }, + { + key: "mc_d_roll", + value: 25 + }, + { + key: "mc_p_yaw", + value: 45 + }, + { + key: "mc_i_yaw", + value: 70 + }, + { + key: "mc_airmode_type", + value: "THROTTLE_THRESHOLD" + }, + { + key: "dynamic_gyro_notch_enabled", + value: "ON" + }, + { + key: "dynamic_gyro_notch_q", + value: 150 + }, + { + key: "dynamic_gyro_notch_min_hz", + value: 60 + }, + { + key: "min_check", + value: 1050 + }, + { + key: "throttle_idle", + value: 12 + }, + { + key: "dterm_setpoint_weight", + value: 0.300 + }, + { + key: "heading_hold_rate_limit", + value: 30 + } + ], + type: 'multirotor' + }, + { + name: "Airplane General", + description: "General setup for airplanes", + features: [ + "Adjusted gyro filtering", + "Adjusted PIDs", + "Adjusted rates" + ], + applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_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) + ], + type: 'airplane' + }, + { + name: "Flying wing Z84", + description: "Small flying wing on multirotor racer parts
" + + "300g-500g weight, 3S-4S battery", + features: [ + "Adjusted gyro filtering", + "Adjusted PIDs", + "Adjusted rates" + ], + applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_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 + presets.elementHelper("RC_tuning", "roll_rate", 350), + presets.elementHelper("RC_tuning", "pitch_rate", 90), + presets.elementHelper("RC_tuning", "dynamic_THR_PID", 33), + presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1300), + presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 4) + ], + type: 'flyingwing' + }, + { + name: "Flying Wing S800 Sky Shadow", + description: "Flying wing on multirotor racer parts with 3S/4S battery and FPV equipment", + features: [ + "Adjusted gyro filtering", + "Adjusted PIDs", + "Adjusted rates" + ], + applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_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), + presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 40), + presets.elementHelper("RC_tuning", "roll_rate", 280), + presets.elementHelper("RC_tuning", "pitch_rate", 140), + presets.elementHelper("RC_tuning", "dynamic_THR_PID", 20), + presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1600) + ], + type: 'flyingwing' + }, + { + name: "Ritewing Mini Drak", + description: "Amazig looking and flying airplane with 8x6 propeller, 2216 1400KV motor, powered with 4S LiPo. AUW above 1200g", + features: [ + "Adjusted gyro filtering", + "Adjusted PIDs", + "Adjusted rates" + ], + applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_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), + presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 35), + presets.elementHelper("RC_tuning", "roll_rate", 260), + presets.elementHelper("RC_tuning", "pitch_rate", 140), + presets.elementHelper("RC_tuning", "dynamic_THR_PID", 30), + presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1550) + ], + type: 'flyingwing' + }, + { + name: "ZOHD Dart 250G", + description: "Small and light flying wing that can be build below 250g and as such be fully legal in many countries", + features: [ + "Adjusted gyro filtering", + "Adjusted PIDs", + "Adjusted rates" + ], + applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_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), + presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 35), + presets.elementHelper("RC_tuning", "roll_rate", 360), + presets.elementHelper("RC_tuning", "pitch_rate", 130), + presets.elementHelper("RC_tuning", "dynamic_THR_PID", 30), + presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1500) + ], + type: 'flyingwing' + }, + { + name: "Mini AR Wing", + description: "Small, 600mm wingspan, FPV flying wing", + features: [ + "Adjusted gyro filtering", + "Adjusted PIDs", + "Adjusted rates" + ], + applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_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), + presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 35), + presets.elementHelper("RC_tuning", "roll_rate", 280), + presets.elementHelper("RC_tuning", "pitch_rate", 120) + ], + type: 'flyingwing' + } +]; \ No newline at end of file diff --git a/tabs/profiles.js b/tabs/profiles.js index 94d04535..bb103e02 100644 --- a/tabs/profiles.js +++ b/tabs/profiles.js @@ -2,583 +2,6 @@ var presets = presets || {}; -presets.elementHelper = function (group, field, value) { - return { - group: group, - field: field, - value: value - } -}; - -presets.defaultValues = { - PIDs: { - mr: [ - [40, 30, 23, 0], //PID_ROLL - [40, 30, 23, 0], //PID_PITCH - [85, 45, 0, 0], //PID_YAW - [50, 0, 0, 0], //PID_POS_Z - [65, 120, 10, 0], //PID_POS_XY - [40, 15, 100, 40], //PID_VEL_XY - [0, 0, 0, 0], //PID_SURFACE - [20, 15, 75, 0], //PID_LEVEL - [60, 0, 0, 0], //PID_HEADING - [100, 50, 10, 0] //PID_VEL_Z - ], - fw: [ - [5, 7, 0, 50], //PID_ROLL - [5, 7, 0, 50], //PID_PITCH - [6, 10, 0, 60], //PID_YAW - [40, 5, 10, 0], //PID_POS_Z - [75, 5, 8, 0], //PID_POS_XY - [0, 0, 0, 0], //PID_VEL_XY - [0, 0, 0, 0], //PID_SURFACE - [20, 5, 75, 0], //PID_LEVEL - [60, 0, 0, 0], //PID_HEADING - [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 - } -}; - -presets.settings = { - COMMON: { - - }, - FW: { - "small_angle": 180, - }, - MR: { - }, - get: function(mixerType) { - var settings = {}; - $.extend(settings, presets.settings.COMMON); - if (mixerType == 'multirotor') { - $.extend(settings, presets.settings.MR); - } else { - $.extend(settings, presets.settings.FW); - } - return settings; - }, -} - -/* - * When defining a preset, following fields are required: - * - * BF_CONFIG::mixerConfiguration - * MIXER_CONFIG::platformType - * - */ - - -/** - * When defining a preset, following fields are required: - * - * BF_CONFIG::mixerConfiguration - * - * @type {{name: string, description: string, features: string[], applyDefaults: string[], settings: *[], type: string}[]} - */ -presets.presets = [ - { - name: 'Default Preset', - description: "INAV Quad X configuration", - features: ["Default INAV Settings"], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0) - ], - type: 'multirotor' - }, - { - name: '5" Racer', - description: "210-250 class racer with F3/F4/F7 CPU on 4S battery
" + - "400g-650g weight, 2000KV - 2600KV motors, 5 inch propellers, MPU6000 or MPU6050 gyro, acro flight optimized", - features: [ - "Asynchronous processing", - "OneShot125 at 2kHz", - "750dps rates", - "Dterm and gyro notch filter", - "Increased LPF cutoff frequencies", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 500), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 1), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 2000), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 90), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 90), - presets.elementHelper("RC_tuning", "roll_rate", 750), - presets.elementHelper("RC_tuning", "pitch_rate", 750), - presets.elementHelper("RC_tuning", "yaw_rate", 750), - presets.elementHelper("RC_tuning", "RC_YAW_EXPO", 0.7), - presets.elementHelper("FILTER_CONFIG", "dtermNotchHz", 260), - presets.elementHelper("FILTER_CONFIG", "dtermNotchCutoff", 160), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz1", 400), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff1", 300), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz2", 200), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff2", 100), - presets.elementHelper("FILTER_CONFIG", "yawLpfHz", 0), - presets.elementHelper("PIDs", 0, [36, 40, 20, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [48, 50, 22, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [70, 45, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '5" Performance', - description: "210-220 class racer with F4/F7 CPU on 4S battery
" + - "450g-600g weight, 2300KV - 2600KV motors, 5 inch triblade propellers, MPU6000 or MPU6050 gyro." + - "This preset uses agressive filter tuning. Check motor temperature! Do not use bent propellers or motors", - features: [ - "8kHz / 4kHz / 4kHz", - "Multishot", - "750dps rates", - "RC FIR2 stage 2 gyro filter", - "Increased LPF cutoff frequencies", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 250), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 3), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 4000), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 100), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 95), - presets.elementHelper("RC_tuning", "roll_rate", 750), - presets.elementHelper("RC_tuning", "pitch_rate", 750), - presets.elementHelper("RC_tuning", "yaw_rate", 750), - presets.elementHelper("RC_tuning", "RC_YAW_EXPO", 0.7), - presets.elementHelper("FILTER_CONFIG", "yawLpfHz", 0), - presets.elementHelper("FILTER_CONFIG", "gyroStage2LowpassHz", 220), - presets.elementHelper("PIDs", 0, [32, 45, 23, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [38, 54, 25, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [75, 45, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '5" GPS', - description: "210-250 class quadcopter with F4/F7 CPU on 3S or 4S battery
" + - "500g-700g weight, 2000KV - 2600KV motors, 5 inch propellers, MPU6000 or MPU6050 gyro, GPS optimized", - features: [ - "OneShot125 at 1kHz", - "500dps rates", - "Dterm and gyro notch filter", - "Increased LPF cutoff frequencies", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 500), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 1), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 1000), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 90), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 80), - presets.elementHelper("RC_tuning", "roll_rate", 500), - presets.elementHelper("RC_tuning", "pitch_rate", 500), - presets.elementHelper("RC_tuning", "yaw_rate", 450), - presets.elementHelper("FILTER_CONFIG", "yawLpfHz", 0), - presets.elementHelper("FILTER_CONFIG", "dtermNotchHz", 200), - presets.elementHelper("FILTER_CONFIG", "dtermNotchCutoff", 100), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz1", 200), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff1", 100), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz2", 0), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff2", 1), - presets.elementHelper("PIDs", 0, [43, 40, 20, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [58, 50, 22, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [70, 45, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '7" Endurance', - description: "Quadcopter using 7\" propellers with F4/F7 CPU on 4S battery
" + - "long range scout with full GPS capabilities, 1200-1500KV motors", - features: [ - "Multishot at 4kHz", - "600dps rates", - "Improved filtering", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 250), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 3), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 4000), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 90), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 75), - presets.elementHelper("FILTER_CONFIG", "gyroStage2LowpassHz", 175), - presets.elementHelper("RC_tuning", "roll_rate", 600), - presets.elementHelper("RC_tuning", "pitch_rate", 600), - presets.elementHelper("RC_tuning", "yaw_rate", 500), - presets.elementHelper("RC_tuning", "RC_YAW_EXPO", 0.7), - presets.elementHelper("FILTER_CONFIG", "yawLpfHz", 0), - presets.elementHelper("PIDs", 0, [40, 35, 24, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [45, 35, 24, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [85, 45, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '7" Freestyle', - description: "Quadcopter using 7\" propellers with F4/F7 CPU on 4S battery
" + - "1500-1800KV motors optimized for acro and freestyle", - features: [ - "Multishot at 4kHz", - "700dps/600dps rates", - "Improved filtering", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 250), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 3), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 4000), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 90), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 80), - presets.elementHelper("FILTER_CONFIG", "gyroStage2LowpassHz", 175), - presets.elementHelper("RC_tuning", "roll_rate", 700), - presets.elementHelper("RC_tuning", "pitch_rate", 700), - presets.elementHelper("RC_tuning", "yaw_rate", 500), - presets.elementHelper("RC_tuning", "RC_YAW_EXPO", 0.7), - presets.elementHelper("FILTER_CONFIG", "yawLpfHz", 0), - presets.elementHelper("PIDs", 0, [30, 50, 25, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [30, 50, 25, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [60, 50, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '10" General Purpose', - description: "450-600 class general purpose multirotor
1.0kg - 1.4kg weight, 10 inch propellers,
F3/F4/F7 CPU, MPU6000 or MPU6050 gyro, GPS optional.
", - features: [ - "Asynchronous gyro processing", - "400dps rates", - "Dterm and gyro notch filter", - "Increased LPF cutoff frequencies", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 1000), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 1), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 70), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 40), - presets.elementHelper("RC_tuning", "roll_rate", 400), - presets.elementHelper("RC_tuning", "pitch_rate", 400), - presets.elementHelper("RC_tuning", "yaw_rate", 200), - presets.elementHelper("FILTER_CONFIG", "dtermNotchHz", 125), - presets.elementHelper("FILTER_CONFIG", "dtermNotchCutoff", 90), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz1", 170), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff1", 125), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz2", 85), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff2", 43), - presets.elementHelper("INAV_PID_CONFIG", "magHoldRateLimit", 30), - presets.elementHelper("PID_ADVANCED", "axisAccelerationLimitRollPitch", 360), - presets.elementHelper("PID_ADVANCED", "axisAccelerationLimitYaw", 72), - presets.elementHelper("PIDs", 0, [80, 30, 18, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [80, 30, 18, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [95, 45, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '12" General Purpose', - description: "550 and above general purpose multirotor
" + - "12 inch propellers, 1.4kg-2kg weight, F3/F4/F7 CPU, MPU6000 or MPU6050 gyro, GPS optional", - features: [ - "Asynchronous gyro processing", - "180dps rates", - "Limited rate acceleration", - "Dterm and gyro notch filter", - "Increased LPF cutoff frequencies", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 3), - presets.elementHelper("MIXER_CONFIG", "platformType", 0), - presets.elementHelper("FC_CONFIG", "loopTime", 1000), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 1), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 55), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 30), - presets.elementHelper("RC_tuning", "roll_rate", 180), - presets.elementHelper("RC_tuning", "pitch_rate", 180), - presets.elementHelper("RC_tuning", "yaw_rate", 90), - presets.elementHelper("FILTER_CONFIG", "dtermNotchHz", 108), - presets.elementHelper("FILTER_CONFIG", "dtermNotchCutoff", 72), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz1", 144), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff1", 90), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz2", 72), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff2", 50), - presets.elementHelper("INAV_PID_CONFIG", "magHoldRateLimit", 30), - presets.elementHelper("PID_ADVANCED", "axisAccelerationLimitRollPitch", 240), - presets.elementHelper("PID_ADVANCED", "axisAccelerationLimitYaw", 36), - presets.elementHelper("PIDs", 0, [100, 30, 25, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [100, 30, 25, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [120, 45, 0, 0]), //YAW PIDs - presets.elementHelper("PIDs", 7, [15, 10, 75, 0]) //Level PIDs - ], - type: 'multirotor' - }, - { - name: '280mm Tricopter', - description: "280mm class tricopter with F4/F7 CPU", - features: [ - "Asynchronous processing", - "Dterm and gyro notch filter", - "Increased LPF cutoff frequencies", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 1), - presets.elementHelper("MIXER_CONFIG", "platformType", 3), - presets.elementHelper("FC_CONFIG", "loopTime", 500), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 490), - presets.elementHelper("ADVANCED_CONFIG", "servoPwmRate", 50), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 90), - presets.elementHelper("FILTER_CONFIG", "dtermLpfHz", 80), - presets.elementHelper("RC_tuning", "roll_rate", 700), - presets.elementHelper("RC_tuning", "pitch_rate", 550), - presets.elementHelper("RC_tuning", "yaw_rate", 250), - presets.elementHelper("RC_tuning", "dynamic_THR_PID", 20), - presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1650), - presets.elementHelper("FILTER_CONFIG", "dtermNotchHz", 260), - presets.elementHelper("FILTER_CONFIG", "dtermNotchCutoff", 160), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz1", 400), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff1", 300), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz2", 200), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff2", 100), - presets.elementHelper("PIDs", 0, [55, 40, 15, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [55, 40, 15, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [90, 20, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: '600mm Tricopter', - description: "600mm class tricopter with F3/F4/F7 CPU
", - features: [ - "Dterm and gyro notch filter", - "GPS ready", - "Improved PID defaults" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 1), - presets.elementHelper("MIXER_CONFIG", "platformType", 3), - presets.elementHelper("FC_CONFIG", "loopTime", 1000), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 0), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmProtocol", 1), - presets.elementHelper("ADVANCED_CONFIG", "motorPwmRate", 2000), - presets.elementHelper("ADVANCED_CONFIG", "servoPwmRate", 50), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 70), - presets.elementHelper("RC_tuning", "roll_rate", 550), - presets.elementHelper("RC_tuning", "pitch_rate", 480), - presets.elementHelper("RC_tuning", "dynamic_THR_PID", 20), - presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1650), - presets.elementHelper("FILTER_CONFIG", "dtermNotchHz", 125), - presets.elementHelper("FILTER_CONFIG", "dtermNotchCutoff", 90), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz1", 170), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff1", 125), - presets.elementHelper("FILTER_CONFIG", "gyroNotchHz2", 85), - presets.elementHelper("FILTER_CONFIG", "gyroNotchCutoff2", 43), - presets.elementHelper("PIDs", 0, [110, 20, 52, 0]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [110, 20, 52, 0]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [75, 20, 0, 0]) //YAW PIDs - ], - type: 'multirotor' - }, - { - name: "Airplane General", - description: "General setup for airplanes", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 14), - presets.elementHelper("MIXER_CONFIG", "platformType", 1), - presets.elementHelper("PIDs", 0, [20, 30, 0, 15]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [20, 30, 0, 15]), //PITCH PIDs - presets.elementHelper("PIDs", 2, [45, 5, 0, 15]), //YAW PIDs - 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) - ], - type: 'airplane' - }, - { - name: "600mm Flying Wing", - description: "Small flying wing on multirotor racer parts
" + - "300g-500g weight, 3S-4S battery", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - presets.elementHelper("BF_CONFIG", "mixerConfiguration", 8), - presets.elementHelper("MIXER_CONFIG", "platformType", 1), - presets.elementHelper("PIDs", 0, [15, 30, 15]), //ROLL PIDs - presets.elementHelper("PIDs", 1, [15, 40, 15]), //PITCH PIDs - presets.elementHelper("RC_tuning", "roll_rate", 400), - presets.elementHelper("RC_tuning", "pitch_rate", 150), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 1) - ], - type: 'flyingwing' - }, - { - name: "Flying wing Z84", - description: "Small flying wing on multirotor racer parts
" + - "300g-500g weight, 3S-4S battery", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - 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 - presets.elementHelper("RC_tuning", "roll_rate", 350), - presets.elementHelper("RC_tuning", "pitch_rate", 90), - presets.elementHelper("RC_tuning", "dynamic_THR_PID", 33), - presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1300), - presets.elementHelper("INAV_PID_CONFIG", "gyroscopeLpf", 4) - ], - type: 'flyingwing' - }, - { - name: "Flying Wing S800 Sky Shadow", - description: "Flying wing on multirotor racer parts with 3S/4S battery and FPV equipment", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - 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), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 40), - presets.elementHelper("RC_tuning", "roll_rate", 280), - presets.elementHelper("RC_tuning", "pitch_rate", 140), - presets.elementHelper("RC_tuning", "dynamic_THR_PID", 20), - presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1600) - ], - type: 'flyingwing' - }, - { - name: "Ritewing Mini Drak", - description: "Amazig looking and flying airplane with 8x6 propeller, 2216 1400KV motor, powered with 4S LiPo. AUW above 1200g", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - 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), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 35), - presets.elementHelper("RC_tuning", "roll_rate", 260), - presets.elementHelper("RC_tuning", "pitch_rate", 140), - presets.elementHelper("RC_tuning", "dynamic_THR_PID", 30), - presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1550) - ], - type: 'flyingwing' - }, - { - name: "ZOHD Dart 250G", - description: "Small and light flying wing that can be build below 250g and as such be fully legal in many countries", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - 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), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 35), - presets.elementHelper("RC_tuning", "roll_rate", 360), - presets.elementHelper("RC_tuning", "pitch_rate", 130), - presets.elementHelper("RC_tuning", "dynamic_THR_PID", 30), - presets.elementHelper("RC_tuning", "dynamic_THR_breakpoint", 1500) - ], - type: 'flyingwing' - }, - { - name: "Mini AR Wing", - description: "Small, 600mm wingspan, FPV flying wing", - features: [ - "Adjusted gyro filtering", - "Adjusted PIDs", - "Adjusted rates" - ], - applyDefaults: ["PIDs", "INAV_PID_CONFIG", "ADVANCED_CONFIG", "RC_tuning", "PID_ADVANCED", "FILTER_CONFIG", "FC_CONFIG", "MIXER_CONFIG"], - settings: [ - 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), - presets.elementHelper("FILTER_CONFIG", "gyroSoftLpfHz", 35), - presets.elementHelper("RC_tuning", "roll_rate", 280), - presets.elementHelper("RC_tuning", "pitch_rate", 120) - ], - type: 'flyingwing' - } -]; - presets.model = (function () { var self = {}; @@ -674,28 +97,37 @@ TABS.profiles.initialize = function (callback, scrollPosition) { mspHelper.saveFilterConfig, mspHelper.savePidData, mspHelper.saveRcTuningData, - mspHelper.savePidAdvanced, - mspHelper.saveToEeprom + mspHelper.savePidAdvanced ]); - saveChainer.setExitPoint(reboot); + saveChainer.setExitPoint(applySettings); function loadHtml() { GUI.load("./tabs/profiles.html", processHtml); } - - function reboot() { - //noinspection JSUnresolvedVariable - GUI.log(chrome.i18n.getMessage('configurationEepromSaved')); - GUI.tab_switch_cleanup(function () { - MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitialize); + + function applySettings() { + Promise.mapSeries(currentPreset.settings, function (input, ii) { + return mspHelper.getSetting(input.key); + }).then(function () { + Promise.mapSeries(currentPreset.settings, function (input, ii) { + console.log('applying', input.key, input.value); + return mspHelper.setSetting(input.key, input.value); + }).then(function () { + mspHelper.saveToEeprom(function () { + //noinspection JSUnresolvedVariable + GUI.log(chrome.i18n.getMessage('configurationEepromSaved')); + + GUI.tab_switch_cleanup(function() { + MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, function () { + //noinspection JSUnresolvedVariable + GUI.log(chrome.i18n.getMessage('deviceRebooting')); + GUI.handleReconnect(); + }); + }); + }); + }) }); - } - - function reinitialize() { - //noinspection JSUnresolvedVariable - GUI.log(chrome.i18n.getMessage('deviceRebooting')); - GUI.handleReconnect($('.tab_setup a')); - } + } function applyAndSave() { @@ -704,9 +136,9 @@ TABS.profiles.initialize = function (callback, scrollPosition) { var setting; //Iterate over settings saved in preset - for (var i in currentPreset.settings) { - if (currentPreset.settings.hasOwnProperty(i)) { - setting = currentPreset.settings[i]; + for (let i in currentPreset.settingsMSP) { + if (currentPreset.settingsMSP.hasOwnProperty(i)) { + setting = currentPreset.settingsMSP[i]; //Apply setting window[setting.group][setting.field] = setting.value; }