#$ TITLE: Karate 'THICC' ranger  7"
#$ FIRMWARE_VERSION: 4.5
#$ CATEGORY: TUNE
#$ STATUS: EXPERIMENTAL
#$ KEYWORDS: karate, ranging, 7 inch, 7", sugarK, KarateBrot, thicc, loRanger, sliders
#$ AUTHOR: sugarK

#$ PARSER: MARKED

#$ DESCRIPTION:
#$ DESCRIPTION: <img src="https://github.com/betaflight/firmware-presets/assets/83344205/e69b70c7-f443-4f2f-807f-0f4030d894a9" style="max-width: 50%; margin-left: auto; margin-right: auto; display: block;"/>
#$ DESCRIPTION: <h1>Karate Viper Racing</h1>
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: This Ranging tune was developed using the Karate filters to suit my LoRanger 7” build out of the house of Viper racing. [LoRanger 7”](https://rotorbuilds.com/build/31218)
#$ DESCRIPTION:
#$ DESCRIPTION: <br>
#$ DESCRIPTION:
#$ DESCRIPTION: This tune should be used with 48khz PWM settings, it SHOULD work with any stiff 6-7” frame if the build is nice and clean.
#$ DESCRIPTION: The tune is slider based to make it easier to adjust for personal taste but use at your OWN risk.
#$ 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: ## 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 4.5 GPS rescue does require at this stage to run 8k/4k so the FC has time to process the data from the GPS unit at 10hz refresh rate (needed for good performance)
#$ DESCRIPTION: - The critical value for GPS rescue to work effectively is your hover throttle. If this isn't correct GPS rescue will not be reliable.
#$ DESCRIPTION: - Also this should be tested on a switch in a park over grass MANY times to ensure your settings work for your build. 
#$ DESCRIPTION: - Advice from me, sugarK buy a good gps unit from a company like matek, like every thing in this hobby you get what you pay for.
#$ DESCRIPTION: - Please read the document prepared here on 4.5s GPS rescue [Betaflight 4.5 GPS rescue](https://betaflight.com/docs/wiki/archive/GPS-Rescue-v4-5)
#$ 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/423

#$ 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_dyn_min_hz = 500
set gyro_lpf1_dyn_max_hz = 1000
set gyro_lpf1_dyn_expo = 7
set simplified_gyro_filter = OFF

# -- Gyro Dynamic Notches --
set dyn_notch_count = 2
set dyn_notch_q = 500
set dyn_notch_max_hz = 450

# -- Dterm filtering --
set dterm_lpf1_dyn_expo = 10

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

# -- Misc --

# -- iTerm  --

# -- PIDsum limits --

# -- PID values --
set simplified_i_gain = 80
set simplified_d_gain = 175
set simplified_pi_gain = 130
set simplified_dmax_gain = 0
set simplified_feedforward_gain = 85
set simplified_pitch_d_gain = 95
simplified_tuning apply
set thrust_linear = 15

# -- Feedforward --

# -- TPA --

#$ 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 (UNCHECKED): Dynamic idle for 6s 1750KV
    #dynamic idle for 6s 1750KV
    set dyn_idle_min_rpm = 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): Crossfire/ELRS 50hz cinematic
        # Crossfire/ELRS 50Hz
        
        feature RX_SERIAL
        set serialrx_provider = CRSF

        #$ INCLUDE: presets/4.3/rc_link/generic/50hz_cinematic.txt
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): ELRS 150hz 
        # ERLS 150z
        
        feature RX_SERIAL
        set serialrx_provider = CRSF

        #$ INCLUDE: presets/4.3/rc_link/generic/150hz_cinematic.txt
    #$ OPTION END
    
    #$ OPTION BEGIN (UNCHECKED): ELRS 250hz (don’t recommend faster rates for cinematic flying)
        # ELRS 250Hz
       
        feature RX_SERIAL
        set serialrx_provider = CRSF

         #$ INCLUDE: presets/4.3/rc_link/generic/250hz_cinematic.txt
    #$ OPTION END
    
#$ OPTION_GROUP END


#$ OPTION_GROUP BEGIN: GPS setup
    #$ OPTION BEGIN (UNCHECKED):GPS rescue settings for 850-1.1kg build
    
        feature GPS
        set failsafe_procedure = GPS-RESCUE
        set gps_ublox_use_galileo = ON
        set gps_rescue_ascend_rate = 600
        set gps_rescue_return_alt = 20
        set gps_rescue_max_angle = 50
        set gps_rescue_descend_rate = 100
        set gps_rescue_throttle_p = 10
        set gps_rescue_throttle_i = 20
        set gps_rescue_throttle_d = 6
        set pid_process_denom = 2
        set motor_pwm_protocol = Dshot300
    #$ OPTION END
    
    #$ OPTION BEGIN (UNCHECKED): GPS UART 1 
        serial 0 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 2 
         serial 1 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 3 
        serial 2 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 4
        serial 3 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 5 
        serial 4 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 6 
        serial 5 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 7
        serial 6 2 115200 57600 0 115200
    #$ OPTION END

    #$ OPTION BEGIN (UNCHECKED): GPS UART 8
        serial 7 2 115200 57600 0 115200
    #$ 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_GROUP END
