#$ TITLE:  FPVCycle Sonicare 6s Tune | mouseFPV 
#$ FIRMWARE_VERSION: 4.3
#$ CATEGORY: TUNE
#$ STATUS: COMMUNITY
#$ KEYWORDS: FPVCycle
#$ 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 FPVCycle Sonicare
#$ DESCRIPTION:
#$ DESCRIPTION: ## About:
#$ DESCRIPTION: * This was tuned on a very light quad. If you are over 670g maybe try the Heavy Action Cam Option. YMMV.
#$ DESCRIPTION: * 20mm and 25mm Stacks (as supported by this frame) may have inadequate capacitance. 1000uf 35v Cap on ESC leads *and* 200-470uf 35v on FC Vbatt rail recommended. 
#$ DESCRIPTION: * Recommended 48k PWM.
#$ DESCRIPTION:
#$ DESCRIPTION: ## Options:
#$ DESCRIPTION: ### **Filters:**
#$ DESCRIPTION: * **RPM Filters DShot300:** Enables RPM filtering. ESCs must support bi-directional. Sets motor poles to 14, Sets Dshot600.
#$ DESCRIPTION: * **RPM Filters DShot600:** Enables RPM filtering. ESCs must support bi-directional. Sets motor poles to 14, 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 5"
#$ DESCRIPTION: * **93% Motor Limit:** Simulates 1800-1900kv motors down closer to 1700kv
#$ DESCRIPTION: * **Enable Battery Sag Compensation:** Self Explanatory (see tooltip). Land at 3.5v/Cell or it's a bad time.
#$ DESCRIPTION: * **Heavy Action Camera:** Increases the Pids/Master Slider
#$ DESCRIPTION:
#$ DESCRIPTION: ## Build Specs This Was Created on:
#$ DESCRIPTION: * **Frame:** FPVCycle Sonicare
#$ DESCRIPTION: * **Motors:** iFlight Xing2 2306 1755kv (6s)
#$ DESCRIPTION: * **FC:** DarwinFPV Whoop Mount (MPU6000)
#$ DESCRIPTION: * **ESC:** DarwinFPV Whoop Mount 45a
#$ DESCRIPTION: * **Action Cam:** GoPro Hero 5 Session
#$ DESCRIPTION: * **AUW:** 620-640g
#$ 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/275
#$ WARNING: If You Choose To Include 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 = 120
set simplified_pi_gain = 100    
set simplified_feedforward_gain = 60
set simplified_dmax_gain = 000
set simplified_i_gain = 090
set simplified_pitch_d_gain = 105
set simplified_pitch_pi_gain = 115
set simplified_master_multiplier = 135
simplified_tuning apply

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

# -- TPA  --
set tpa_rate = 70

# -- Thrust linear  --
set thrust_linear = 20

# -- DShot Idle --
set dshot_idle_value = 400

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

# -- 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 = ON
set simplified_gyro_filter_multiplier = 150
simplified_tuning apply

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

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

# -- Yaw lowpass --
set yaw_lowpass_hz = 100

# ------ OPTIONS GO BELOW THIS LINE ------

#$ 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 Filters --

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

        # -- 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

        # -- 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 = 150
        set rpm_filter_fade_range_hz = 75

        # -- Dterm sliders --
        set simplified_dterm_filter_multiplier = 115
        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 Filters --

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

        # -- 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 simplified_gyro_filter = ON
        set simplified_gyro_filter_multiplier = 200
        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 = 150
        set rpm_filter_fade_range_hz = 75

        # -- Dterm sliders --
        set simplified_dterm_filter_multiplier = 115
        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 = 20
        set dyn_idle_p_gain = 45
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): 93% Motor Limit (Use this if its too spicy)
        set motor_output_limit = 93
    #$ OPTION END

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

    #$ OPTION BEGIN (UNCHECKED): Heavy Action Cam (Hero8/9/10)
            set simplified_master_multiplier = 150
            simplified_tuning apply
    #$ OPTION END

#$ OPTION_GROUP END

