#$ TITLE: Karate brushless whoop
#$ FIRMWARE_VERSION: 4.4
#$ CATEGORY: TUNE
#$ STATUS:  COMMUNITY
#$ KEYWORDS: karate, 2s, 1S, race, brushless, whoop, 65mm, sugarK, KarateBrot
#$ AUTHOR: sugarK

#$ PARSER: MARKED

#$ DESCRIPTION:
#$ DESCRIPTION: <img src="https://user-images.githubusercontent.com/19867640/174759844-ffd85f42-1f1c-42bf-9032-d9f96d4d9619.svg" width="90px" style="display: block; float: left; margin-right: 10px; margin-top: 20px"/>
#$ DESCRIPTION: <h1>Karate Race 6S 5"</h1>
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: This 2s whoop racing tune was developed using the [Meteor 85](https://betafpv.com/collections/brushless-series-except-hd/products/beta85-pro2-whoop-quadcopter-2s) it is a slider tune allowing easy modification. 
#$ DESCRIPTION:
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: This tune should work well on any BRUSHLESS powered quality whoop build in eiher 1 or 2s. It shouldn't be used on a brushed whoop.
#$ DESCRIPTION:
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: ## Things to note:
#$ DESCRIPTION: - **YOU HAVE TO USE RPM FILTERING WITH THIS TUNE!** Failure to do so might result in fire 🔥
#$ DESCRIPTION: - Regarding DShot600: if your setup has errors in the motor tab using bidirectional DShot, change to **8k/4k and DShot300**
#$ DESCRIPTION: - Also this should be applied to a clean flash after you've setup your rates, swtiches, vtx tables etc.
#$ DESCRIPTION: - To test arm the quad with props on, it should **sound clean with no grinding**. If it passes that then hover test and check motor temps.
#$ DESCRIPTION: - **If anything is off, don't fly it!!**
#$ DESCRIPTION:
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: ## Second note... Radio links:
#$ DESCRIPTION: 1. Make sure your radio firmware is up to date using either EdgeTX or OpenTX
#$ DESCRIPTION: 1. Make sure your **ADC Filter is OFF** in the hardware page
#$ DESCRIPTION: 1. Go to the radio (RC_LINK) presets and apply the correct setup for your system and link speed

#$ DISCUSSION: https://github.com/betaflight/firmware-presets/pull/331

#$ INCLUDE_WARNING: misc/warnings/en/rpm_filters.txt
#$ INCLUDE: presets/4.4/tune/defaults.txt
#$ INCLUDE: presets/4.3/filters/defaults.txt

set motor_poles = 12

# -- Gyro lowpass filters --
set gyro_lpf1_static_hz = 0
set gyro_lpf1_dyn_min_hz = 500
set gyro_lpf1_dyn_max_hz = 1000
set simplified_gyro_filter = OFF

#$ OPTION BEGIN (UNCHECKED): Bosch (BMI) gyro - experimantal
    set gyro_lpf1_dyn_min_hz = 0
    set gyro_lpf1_dyn_max_hz = 0
#$ OPTION END

# -- Gyro Dynamic Notches --
set dyn_notch_count = 2
set dyn_notch_q = 600
set dyn_notch_max_hz = 650

# -- Dterm filtering --
set dterm_lpf1_dyn_expo = 7

# -- RPM filtering --
set dshot_bidir = ON
set rpm_filter_fade_range_hz = 100

# -- Misc --
set thrust_linear = 20


# -- PIDsum limits --
set iterm_limit = 500
set pidsum_limit_yaw = 1000


# -- PID values --
set p_pitch = 41
set i_pitch = 70
set d_pitch = 37
set f_pitch = 110
set p_roll = 41
set i_roll = 70
set d_roll = 37
set f_roll = 111
set p_yaw = 41
set i_yaw = 70
set f_yaw = 111
set d_min_roll = 37
set d_min_pitch = 37
set simplified_master_multiplier = 155
set simplified_i_gain = 95
set simplified_d_gain = 80
set simplified_pi_gain = 60
set simplified_dmax_gain = 0
set simplified_feedforward_gain = 60
set simplified_pitch_d_gain = 90
set simplified_pitch_pi_gain = 95

#$ OPTION BEGIN (UNCHECKED): Dshot600
    set dshot_bidir = ON
    set motor_pwm_protocol = DSHOT600
#$ OPTION END

#$ OPTION BEGIN (CHECKED): Dshot300
    set dshot_bidir = ON
    set motor_pwm_protocol = Dshot300
#$ OPTION END

#$ OPTION BEGIN (CHECKED): Set 12 poles for whoop motors
    set motor_poles = 12
#$ OPTION END

#$ OPTION BEGIN (UNCHECKED): Dynamic idle for 11000kv 2s
    set dyn_idle_min_rpm = 150
    set dyn_idle_p_gain = 35
#$ OPTION END

#$ OPTION BEGIN (CHECKED): Vbat sag compensation
    set vbat_sag_compensation = 100
#$ OPTION END

#$ OPTION_GROUP BEGIN: Some popular RC Links

    #$ OPTION BEGIN (UNCHECKED): Tracer/ELRS 250Hz
        # Tracer/ELRS 250Hz
        
        feature RX_SERIAL
        set serialrx_provider = CRSF

        #$ INCLUDE: presets/4.3/rc_link/generic/250hz_race.txt

    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): ELRS 500Hz
        # ERLS 500Hz
        
        feature RX_SERIAL
        set serialrx_provider = CRSF

        #$ INCLUDE: presets/4.3/rc_link/generic/500hz_race.txt

    #$ OPTION END
    
    #$ OPTION BEGIN (UNCHECKED): ELRS 1000Hz
        # ELRS 1000Hz
       
        feature RX_SERIAL
        set serialrx_provider = CRSF

        #$ INCLUDE: presets/4.3/rc_link/generic/1000hz_race.txt
         
    #$ OPTION END
    
    #$ OPTION BEGIN (UNCHECKED): Ghost 250Hz
        # Ghost 250Hz
      
        feature RX_SERIAL
        set serialrx_provider = GHST

        #$ INCLUDE:presets/4.3/rc_link/generic/250hz_race.txt

    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): Ghost 500Hz
        # Ghost 500Hz
       
        feature RX_SERIAL
        set serialrx_provider = GHST

        #$ INCLUDE: presets/4.3/rc_link/generic/500hz_race.txt

    #$ OPTION END

#$ OPTION_GROUP END

#$ OPTION_GROUP BEGIN: Optional rates
    #$ OPTION BEGIN (UNCHECKED): sugarK's rates
        #$ INCLUDE: presets/4.3/rates/SugarK.txt
        set thr_expo = 80

    #$ OPTION END

#$ OPTION_GROUP END

