Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Betaflight SmartAudio pit mode support

There was no pit mode before SmartAudio 2.0. SmartAudio 2.0 added the ability to configure if the device starts in pit mode when powered on and the ability to turn off pit mode.

To control this behavior, Betaflight uses a set of flags and the saSetMode function (in vtx_smartaudio.c) as shown below.

1. Configure the VTX to start in pit mode when powered up.


2. Turn off pit mode while retaining the start-in-pit-mode behavior.


3. Disable the start-in-pit-mode behavior (and turn off pit mode if currently still on), i.e. configure the VTX to transmit at its normal power level when powered up.


SmartAudio 2.1 added the ability to immediately switch in and out of pit mode even if start-in-pit-mode behavior has not been configured:

4. Turn off pit mode without also enabling/retaining the start-in-pit-mode behavior.


5. Turn on pit mode immediately without also enabling/retaining the start-in-pit-mode behavior.

static uint8_t buf[6] = { 0xAA, 0x55, SACMD(SA_CMD_SET_POWER), 1 };
buf[4] = 0 | 128;
buf[5] = CRC8(buf, 5); 
saQueueCmd(buf, 6); 

As you can see, turning on pit mode immediately works quite differently - it does not use saSetMode. Under the covers saSetMode also uses saQueueCmd but it always uses SA_CMD_SET_MODE rather than the SA_CMD_SET_POWER seen here.

Note: there are two types of pit mode:

  • in-range which uses the SA_MODE_SET_IN_RANGE_PITMODE flag seen above.
  • out-range which uses the SA_MODE_SET_OUT_RANGE_PITMODE flag.

The SA_MODE_SET_OUT_RANGE_PITMODE flag can be used exactly as the SA_MODE_SET_IN_RANGE_PITMODE is used above. However, when this flag is used the VTX uses the frequency configured via vtx_pit_mode_freq when in pit mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment