#$ TITLE: 533 TinyTrainer “spec” Karate
#$ FIRMWARE_VERSION: 4.5
#$ CATEGORY: TUNE
#$ STATUS:   OFFICIAL
#$ KEYWORDS: karate, race, 533, 3 inch, 3", sugarK, shames, tiny, trainer, spec, tinyTrainer
#$ AUTHOR: sugarK

#$ PARSER: MARKED

#$ DESCRIPTION:
#$ DESCRIPTION: <a href="https://flyfive33.com/product/tinytrainer-frame-kit"><img src="https://github.com/betaflight/firmware-presets/assets/19867640/8914662e-121a-4ab0-b5ad-1fe7705cb801" alt="533" width="50%" style="display: block; margin-left: auto; margin-right: auto; margin-top: 20px;"/></a>
#$ DESCRIPTION: <h1>533 TinyTrainer “spec” Karate</h1>
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: This racing tune was developed for the <a href="https://flyfive33.com/product/tinytrainer-frame-kit">533 TinyTrainer</a> spec class with @Shames throwing his quad out the window of his office and sending me logs.
#$ DESCRIPTION:
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: The revised tune was developed thanks to the 533 team sending me a Tiny Trainer any my local gang going hard on TT spec racing.
#$ DESCRIPTION:
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: ## Things to note:
#$ DESCRIPTION: - Please use Betaflight 4.4.2 or newer
#$ DESCRIPTION: - **YOU HAVE TO USE RPM FILTERING WITH THIS TUNE!** Failure to do so might result in fire 🔥
#$ DESCRIPTION: - This preset sets the **motor pole count to 12** to match the Tiny Trainer Headsup motors
#$ DESCRIPTION: - Regarding DShot600: if your setup has errors in the motor tab using bidirectional DShot, change to **8k/4k and DShot300**
#$ 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: 2. Make sure your **ADC Filter is OFF** in the hardware page
#$ DESCRIPTION: 3. Go to the radio presets (RC_LINK) and apply the correct setup for your system and link speed
#$ DISCUSSION: https://github.com/betaflight/firmware-presets/pull/81
#$ INCLUDE_WARNING: misc/warnings/en/rpm_filters.txt
#$ INCLUDE: presets/4.5/tune/defaults.txt
#$ INCLUDE: presets/4.5/filters/defaults.txt

# -- Gyro lowpass filters --
set gyro_lpf1_static_hz = 0

# -- Gyro Dynamic Notches --
set dyn_notch_count = 1
set dyn_notch_q = 500
set dyn_notch_min_hz = 120
set dyn_notch_max_hz = 700

# -- Dterm filtering --
set dterm_lpf1_dyn_expo = 10

# -- RPM filtering --
set dshot_bidir = ON
set rpm_filter_weights = 100,20,100
set rpm_filter_fade_range_hz = 100
set motor_poles = 12

# -- Misc --
set yaw_spin_recovery = AUTO
set thrust_linear = 0
set throttle_boost = 7

# -- iTerm  --
set iterm_relax_cutoff = 45

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

#--Vbat sag
set vbat_sag_compensation = 100

# -- PID values --
set throttle_boost = 7
set simplified_pids_mode = RP
set simplified_i_gain = 115
set simplified_d_gain = 165
set simplified_pi_gain = 90
set simplified_dmax_gain = 0
set simplified_feedforward_gain = 110
set simplified_pitch_d_gain = 95
simplified_tuning apply

# -- TPA --
set tpa_rate = 70
set tpa_breakpoint = 1250

#$ OPTION BEGIN (UNCHECKED): BMI gyro madness 
    set gyro_lpf2_static_hz = 0
#$ OPTION END

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

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

#$ OPTION BEGIN (CHECKED): dynamic idle
    set dshot_idle_value = 700
    set dyn_idle_min_rpm = 60
    set dyn_idle_p_gain = 35
#$ OPTION END

#$ OPTION BEGIN (UNCHECKED): Quaddiction LED channel mapping
    #$ INCLUDE: presets/4.4/leds/quaddiction_tinytrainer.txt
#$ 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 BEGIN (UNCHECKED): Secret sauce stick feel 
        set feedforward_jitter_factor = 0
        
    #$ OPTION END
    
#$ OPTION_GROUP END

#$ OPTION_GROUP BEGIN: Optional rates
    #$ OPTION BEGIN (UNCHECKED): sugarK's rates
        #$ INCLUDE: presets/4.3/rates/SugarK.txt
        
    #$ OPTION END
    
    #$ OPTION BEGIN (UNCHECKED): Throttle curve for 6s racer
        set thr_mid = 45
        set thr_expo = 65
        
     #$ OPTION END
     
#$ OPTION_GROUP END
