I am using a FlySky TH9X with the OpenTX firmware installed so the following wiki is also useful for background but steps are different since I am using EzUHF for the radio instead of stock:
Turnigy 9x / FlySky 9x FrSky Mod

Most operators use the throttle channel to indicate failsafe however on the EzUHF, you can configure all the channels to any condition during loss of signal so I chose to use my 2-pos Assist/Mission/Return switch so I can keep full dynamic range on the throttle channel and have more margin between the operational level and the failsafe level. To set this up, follow these steps:

1. Set channel range to 100%

Go to the MIXER settings (press - long and go to page 5/9 using +/-) and look up to what channel your 2pos switch is set (channel 8 for me)

Go to the LIMIT settings (press - long and go to page 6/9 using +/-) and verify that the range of the switch channel goes from -512 to 512

2. Program failsafe

- With TX and RX on and bound, Flip the switch down and confirm that the Assist/Mission/Return switch is reporting 1900-2100 in the RC calibration page on QGroundControl. Press the Failsafe/Bind button on the EzUHF TX until you hear it beep several times. This programs the EzUHF RX to output the current values of all channels in the event of signal loss.

3. Reduce FS channel range to 50%

Go back to the LIMIT settings on the TX(press - long and go to page 6/9 using +/-) and set the range of the switch channel to -512 to 0. This configures that channel to output the mid level as the maximum so the failsafe level you just programmed in the RX will never be issued from the TX and cause false failsafe entry.

4. Check RC failsafe

Open QGroundControl and connect to your PX4.

Goto Config → Radio Calibration and perform the calibration if not already performed. Due to the calibration behavior below, there is no point to re-calibrating it since you have to manually calibrate the switch.

At the time of this wiki, the RC calibration treated 2-pos switches differently - preventing operation with only half the range. To manually calibrate it, you will need to take note of the new max and min outputs of the 2-pos failsafe switch by toggling the switch on the TX and recording the value in the Config → Radio Calibration page. For me, the values were 992 and 1496.

Test failsafe by turning off the transmitter. The 2-pos switch should reflect the 1900-2100 value established in step 2.

5. Correct calibration

In QGroundControl go back to the Flight tab and make sure Onboard Parameters is selected under Tool Widgets