What is Betaflight CLI? CLI stands for command line interface, a configuration mode that gives users direct access to all the settings and parameters within the flight control firmware. CLI is a powerful tool, but can be daunting for less technical users. In this guide I will explain why and how to use CLI in Betaflight.
Why are we using CLI?
CLI was introduced back in the days in Baseflight and it continues to exist in Cleanflight, Betaflight, iNav, Butterflight etc.
Due to the vast amount of settings in these firmware, it’s simply impossible to list all of them in the GUI (graphical user interface – the configurator) without making it too confusing and difficult to use.
So it makes sense to only list the ones that are frequently used, and the rest can be changed via the CLI.
Another advantage of CLI is how easy it is to list all the settings and make a backup in a text file, which we will explain how later in this tutorial.
How to use CLI in Betaflight?
The CLI tab is available in Betaflight Configurator (where to download), you will have access to it once you’ve connected the flight controller to the configurator.
You can type in commands in the text input field at the very bottom of the screen, and press the “Enter” key on your keyboard to execute it.
Typically, a command in CLI looks like this:
[command] [setting] = [value]
For example, to set expo for roll to zero:
set roll_expo = 0
Once you have changed a setting, you also have to enter the command “save” in order to save the changes, and after that the FC will reboot. If you exit CLI without doing so your changes will be lost.
To exit the CLI without changing settings, simply enter the command “exit” and press enter, or click on another tab, or click on the top right “disconnect” button.
The syntax in Betaflight CLI is very simple and beginner friendly.
You can type commands in the CLI in any case you want. Everything is case-insensitive so all of the below will work:
set serialrx_inverted = on SET SERIALRX_INVERTED = ON seT serialRX_inverTED = oN
It doesn’t matter if you put a space either side of the “=” or if you put multiple spaces, he CLI is able to figure out what the command is, what the setting name is, and what the value is regardless of spaces. All of the following will work:
set serialrx_inverted = on set serialrx_inverted=on set serialrx_inverted =on set serialrx_inverted = on
How to check settings in CLI?
The most used commands in Betaflight CLI are probably “dump” and “diff”.
When entering “dump“, it will simply display all the settings in Betaflight on the screen. As you can probably imagine, it’s a huge list (around 800 lines) and it can take a while to go through.
That’s why we often use the command “diff” instead.
If you only want to check the settings that are different from the default, you can enter “diff“. The returned list is much shorter, and easier to manage if you only want to check the settings that are changed by the user.
See this article for more info about the “diff” command.
The command “get” is another one I use all the time. Simply type “get”, followed by a space, and a few letters of the setting you want to check/change, CLI will return all the settings that begin with those letters. It’s very useful as you don’t have to memorize all the names. For example:
This will return both “serialrx_inverted” and “serialrx_duplex” which I use often.
Backup and Restore of Betaflight Settings using CLI
It’s good practice to make a backup of your Betaflight CLI settings before you make changes, so you can revert back if something goes wrong.
To backup, enter “diff all”, and copy the text to a text file.
To restore, simply copy and paste the text file in the CLI, and hit enter. Don’t forget to enter “save” before closing CLI.
Other Useful CLI Commands
There a lot of commands but some aren’t very useful. Here are the ones that I use a lot and I think you should know about :) Let me know which commands i should add to the list.
||reset controller to defaults and reboot|
||print configurable settings in a paste-able form|
||dump only the settings that are different from the defaults. Includes only the current PID profile.|
||dump only the settings that are different from the defaults. Includes ALL PID profiles.|
||exit without saving|
||get the value of the specified variable|
||lists all commands|
||save settings and reboot|
||set the the given value to the variable. (name=value or blank or * for list)|
||show system status|
||enter the DFU mode without pushing the button. Reboots the FC board in bootloader mode.|
||lets you arm the quad regardless the quad’s attitude when accelerometer is enabled|
||activate bind mode on SPI receivers for FC with integrated RX (BF 4.X)|
||same as above (BF 3.X)|
Note that the different firmware (Cleanflight, BetaFlight, Butterflight and iNav) might have slightly different sets of commands and setting names, and it’s also likely to change form version to version. You can confirm the available commands using
help in CLI or check on the respective project wiki page.
- May 2018 – Guide created
- Feb 2019 – Updated guide, added “Syntax”