#$ TITLE:  AOS 3.5 V1 4s Tune | mouseFPV
#$ FIRMWARE_VERSION: 4.3
#$ CATEGORY: TUNE
#$ STATUS: COMMUNITY
#$ KEYWORDS: AOS, 4s, freestyle, sub 250
#$ AUTHOR: mouseFPV
#$ PARSER: MARKED
#$ DESCRIPTION: <br>
#$ DESCRIPTION: <img src="https://user-images.githubusercontent.com/19867640/174462482-28bdcfec-1c3a-43db-99d7-50688b92f050.svg" width="100px" style="margin-left: auto; margin-right: auto; display: block;"/>
#$ DESCRIPTION:
#$ DESCRIPTION: # Tune for AOS 3.5
#$ DESCRIPTION:
#$ DESCRIPTION: ## About:
#$ DESCRIPTION: * May be appropriate for v2 frame and/or different motors/cell counts
#$ DESCRIPTION: * Tune/Filters are aggressive, and may not be appropriate for non trussed/braced frames
#$ DESCRIPTION: * Recommended 48k PWM
#$ DESCRIPTION: * Uses Multi-Dynamic notich by default. Options for RPM filtering which use Dshot. Using DShot on Unsupported ESC's is Dangerous. See Warning.
#$ DESCRIPTION: * RPM Filtering is recommended
#$ DESCRIPTION:
#$ DESCRIPTION: ## Options:
#$ DESCRIPTION: ### **Filters:**
#$ DESCRIPTION: * **RPM Filters DSHOT600:** Enables RPM filtering. ESCs must support bi-directional. sets motor poles to 12, For F7 or better, sets Dshot600.
#$ DESCRIPTION: * **RPM Filters DSHOT300:** Enables RPM filtering. ESCs must support bi-directional. sets motor poles to 12, For F4 or better, sets Dshot300, enables gyro LPF 2 Due to DSHOT300 often run on half loop rate.
#$ DESCRIPTION:
#$ DESCRIPTION: ### **Additional Options:**
#$ DESCRIPTION: * **Dynamic Idle:** Enables Dynamic Idle for Freestyle 3.5"
#$ DESCRIPTION: * **95% Motor Limit:** Takes some of the spice out of powerful motors on 4s
#$ DESCRIPTION: * **Enable Battery Sag Compensation:** Self Explanatory (see tooltip). Land at 3.5v/Cell or it's a bad time.
#$ DESCRIPTION:
#$ DESCRIPTION: ## Build Specs This Was Created on:
#$ DESCRIPTION: * **Frame:** AOS 3.5 V1
#$ DESCRIPTION: * **Motors:** FPVCycle 16mm (4s 95% Motor Limit)
#$ DESCRIPTION: * **FC/ESC:** Foxeer Reaper f7 AIO
#$ DESCRIPTION: * **AUW:** 243g
#$ DESCRIPTION:
#$ DESCRIPTION: ## Fly Like mouseFPV | Recommendations Outside of Tune:
#$ DESCRIPTION: * Apply mouseFPV Freestyle Rates
#$ DESCRIPTION: * Use 250hz radio link if possible
#$ DESCRIPTION: * **Set Jitter Reduction (feedforward_jitter_factor) to 14**
#$ DESCRIPTION:
#$ DISCUSSION: https://github.com/betaflight/firmware-presets/pull/247
#$ WARNING: If You Choose To Include RPM Filters, Please, See The Following:
#$ INCLUDE_WARNING: misc/warnings/en/dshot.txt
#$ FORCE_OPTIONS_REVIEW: TRUE
#$ INCLUDE: presets/4.3/tune/defaults.txt
#$ INCLUDE: presets/4.3/filters/defaults.txt

# ------- End Defaults --------
# ----- Begin Mouse Tune-------


# -- PID Sliders  --
set simplified_pids_mode = RPY
set simplified_d_gain = 130
set simplified_pi_gain = 100
set simplified_feedforward_gain = 60
set simplified_dmax_gain = 000
set simplified_i_gain = 80
set simplified_pitch_d_gain = 105
set simplified_pitch_pi_gain = 105
set simplified_master_multiplier = 145
simplified_tuning apply

# -- iTerm relax --
set iterm_relax = RP
set iterm_relax_type = SETPOINT
set iterm_relax_cutoff = 10

# -- TPA  --
set tpa_rate = 70

# -- Antigravity --
set anti_gravity_gain = 3500

# -- Thrust linear --
set thrust_linear = 20

# -- DShot Idle --
# Commonly set lower when dynamic idle is active.
set dshot_idle_value = 400

# -- Filters for non bi-directional setups as a base--

# -- Gyro lowpass filters --
# -- No Gyro Lowpass
set gyro_lpf1_static_hz = 0
set gyro_lpf1_dyn_min_hz = 0
set gyro_lpf1_dyn_max_hz = 0
set gyro_lpf2_static_hz = 0
set simplified_gyro_filter = OFF


# -- Gyro Dynamic Notches --
set dyn_notch_count = 3
set dyn_notch_q = 425
set dyn_notch_min_hz = 150
set dyn_notch_max_hz = 600

# -- Dterm sliders --
set simplified_dterm_filter = ON
set simplified_dterm_filter_multiplier = 125
simplified_tuning apply

# -- Yaw lowpass --
set yaw_lowpass_hz = 100

# ------ OPTIONS GO BELOW THIS LINE ------
# This is where the author includes options that require input from the User

#$ OPTION_GROUP BEGIN: (EXCLUSIVE) Filters (Choose One or None)

#$ OPTION BEGIN (CHECKED): RPM Filters DSHOT600
#$ INCLUDE: presets/4.3/filters/defaults.txt

# ------- End Defaults --------
# ----- Begin Mouse Tune-------

# enable dshot rpm telemetry
set motor_pwm_protocol = DSHOT600
set dshot_bidir = ON
set motor_poles = 12

# -- Gyro lowpass filters --
# -- No Gyro Lowpass
set gyro_lpf1_static_hz = 0
set gyro_lpf1_dyn_min_hz = 0
set gyro_lpf1_dyn_max_hz = 0
set gyro_lpf2_static_hz = 0
set simplified_gyro_filter = off

# -- Gyro Dynamic Notches --
set dyn_notch_count = 1
set dyn_notch_q = 500
set dyn_notch_min_hz = 150
set dyn_notch_max_hz = 600

# -- RPM filtering --
set rpm_filter_q = 500
set rpm_filter_min_hz = 125
set rpm_filter_harmonics = 3

# -- Dterm filtering --
set simplified_dterm_filter = on
set simplified_dterm_filter_multiplier = 125
simplified_tuning apply

# -- Yaw lowpass --
set yaw_lowpass_hz = 100
#$ OPTION END

#$ OPTION BEGIN (UNCHECKED): RPM Filters DSHOT300
#$ INCLUDE: presets/4.3/filters/defaults.txt

# ------- End Defaults --------
# ----- Begin Mouse Tune-------

# enable dshot rpm telemetry
set motor_pwm_protocol = DSHOT300
set dshot_bidir = ON
set motor_poles = 12

# -- Gyro lowpass filters --
set gyro_lpf1_static_hz = 0
set gyro_lpf1_dyn_min_hz = 0
set gyro_lpf1_dyn_max_hz = 0
set simplified_gyro_filter_multiplier = 200
set simplified_gyro_filter = on
simplified_tuning apply

# -- Gyro Dynamic Notches --
set dyn_notch_count = 1
set dyn_notch_q = 500
set dyn_notch_min_hz = 150
set dyn_notch_max_hz = 600

# -- RPM filtering --
set rpm_filter_q = 500
set rpm_filter_min_hz = 125
set rpm_filter_harmonics = 3

# -- Dterm filtering --
set simplified_dterm_filter = on
set simplified_dterm_filter_multiplier = 125
simplified_tuning apply


# -- Yaw lowpass --
set yaw_lowpass_hz = 100
#$ OPTION END


#$ OPTION_GROUP END


#$ OPTION_GROUP BEGIN: Additional Options (Choose Many or None)

#$ OPTION BEGIN (CHECKED): Dynamic Idle
set dyn_idle_min_rpm = 25
set dyn_idle_p_gain = 50
#$ OPTION END

#$ OPTION BEGIN (UNCHECKED): 95% Motor Limit
set motor_output_limit = 95
#$ OPTION END

#$ OPTION BEGIN (UNCHECKED): Enable Battery Sag Compensation?
set vbat_sag_compensation = 100
#$ OPTION END

#$ OPTION_GROUP END

