Betaflight CLI (Command Line Interface) is a powerful tool that gives FPV drone pilots direct access to all the flight controller’s settings and parameters. This guide will help you understand what Betaflight CLI is, why it’s useful, and how to use it effectively.
Table of Contents
What is Betaflight CLI
Betaflight CLI is a command line interface that allows users to interact with their flight controller’s firmware directly. Similar to Windows and Linux, while you can access most of the settings via the graphical user interface (GUI), there are more advanced settings that can be accessed only through the command line. Furthermore, for some advanced users, the command line interface is a more efficient and effective method to access settings compared to GUI. CLI is also a great way to backup and restore configurations, as it can be saved in a text file.
Why Use Betaflight CLI
- Access to Advanced Settings: CLI provides access to all settings, including those not available in the GUI.
- Easy Backup and Restore: You can easily save and restore settings by copying and pasting commands.
- Efficient Troubleshooting: Quickly identify and adjust parameters that might be causing issues with your drone’s performance.
How to Use Betaflight CLI
The CLI tab is available in the Betaflight Configurator. You will have access to it once you’ve connected the flight controller to the configurator. Here’s a tutorial if you are new to Betaflight Configurator: https://oscarliang.com/betaflight-firmware-setup/
You can type commands in the text input field at the bottom of the screen and press the “Enter” key to execute them.
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 need to enter the command “save” to save the changes. The flight controller will immediately reboot after that. If you exit the CLI without saving, your changes will be lost.
To exit the CLI without changing settings, simply enter the command “exit” and press Enter, click on another tab, or click the top-right “disconnect” button.
Syntax
The syntax in Betaflight CLI is simple and beginner-friendly.
Case Sensitivity
Everything is case-insensitive, you can type commands in any case you want, big letters, small letters, don’t matter, all of the following will work the same:
set serialrx_inverted = on
SET SERIALRX_INVERTED = ON
seT serialRX_inverTED = oN
Space
It doesn’t matter if you put spaces around the equal sign “=”, the CLI can figure out the command, the setting name, and the value regardless of spaces. All the following will work:
set serialrx_inverted = on
set serialrx_inverted=on
set serialrx_inverted =on
set serialrx_inverted = on
Checking Settings in CLI
The most used commands in Betaflight CLI are probably “dump” and “diff.”
When entering “dump,” it will display all the settings in Betaflight in the console. This can be a huge list (typically over 1000 lines).
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 digest if you only want to check altered settings.
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, and 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:
get gps
This will return all the settings that begin with gps, and most likely to be all related to GPS functionality. And if you type get osd, it will suggest all the OSD related settings. Very useful.
Backup and Restore of Betaflight Settings Using CLI
It’s good practice to back up your Betaflight CLI settings before making changes, so you can revert if something goes wrong.
- To back up, 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.
Alternatively you can just use the Preset tab’s Backup and Restore feature, which achieve the same result. And there are multiple ways to backup Betaflight as explained here: https://oscarliang.com/backup-restore-betaflight-config/
Tips and Tricks
Press Tab to Complete a Command
You can start typing the beginning of a CLI command and then press the TAB key to complete it. If there are multiple options, the CLI will suggest all possibilities. This is convenient, especially for long commands.
Don’t Forget to SAVE!
Always enter the command “save” before exiting CLI if you want to save the changes.
Task Command
The task command shows the CPU load of different processes running on the flight controller. This is great for troubleshooting if your FC is experiencing CPU load issues.
Commands Are Always Changing – Get Help!
Different firmware such as BetaFlight and iNav, even though they come from the same origin, could have different sets of commands and command names, and they can also change from version to version.
When in doubt, you can always check the available commands using the help
command in CLI.
Other Useful Betaflight CLI Commands
Here are some frequently used commands that I think you should know about:
Command | Description |
---|---|
defaults | reset controller to defaults and reboot |
dump | print configurable settings in a paste-able form |
diff | dump only the settings that are different from the defaults. Includes only the current PID profile. |
diff all | dump only the settings that are different from the defaults. Includes ALL PID profiles. |
exit | exit without saving |
get | get the value of the specified variable |
help | lists all commands |
save | save settings and reboot |
set | set the the given value to the variable. (name=value or blank or * for list) |
status | show system status |
version | show version |
bl or dfu | enter the DFU mode without pushing the button. Reboots the FC board in bootloader mode. |
bind_rx | activate bind mode on SPI receivers for FC with integrated RX for BF 4.1 and newer |
bind_rx_spi | same as above but for BF 4.0 |
frsky_bind | same as above (BF 3.X) |
Conclusion
Betaflight CLI is an essential tool for any FPV drone pilot looking to fine-tune their setup. By understanding and using CLI commands, you can access advanced features, efficiently troubleshoot issues, and maintain backups of your configurations. Happy flying!
Edit History
- May 2018 – Guide created
- Feb 2019 – Updated guide, added “Syntax”
- May 2021 – Added “tips and tricks”
- Aug 2024 – Updated
10 comments
Hi,
good information to start.
Is there also a possibility to do some “IF / THAN” ?
Thx
Oskar
super informative, thankyou
hello.. i got a lizard95 from eachine ( dsmx reciever) but i cant bind it… it has no binding button and i couldnt bind it from CLI…
thanks in advance
Hi,
I have a tinyhawk 2, I crash and a change the Aio flight controller, I did the bind with the RTF transmitter it binded ok, but some how I push reset settings no Betaflight, now my flight controller si dead. Is there something I can do to recover my flight controller. Right now When I plug the battery I only get a led light sequence 5 blue, 4 green and 1 red then the sequece repeats one more time and then dies.
Hope you can help.
Francisco
Hi There,
This may be silly question but I am trying to activate serialrx_inversion = ON but I cant seem to find the correct command. I’ve done “get serialrx_inverted” to see what its set to but now I need to change and I cant lol. Any smart people out here with the correct command? Thanks in advance :)
Hi I’m building switches for my geprc KHX5 5″ quad and the “Arm” switch says in bright red “Arming Disabled”. How do I enable this arming mode to get it back to yellow or normal?
Quadcopter Doesn’t Arm? Let’s Fix it!
download impulse Rc app it installs dfu to your board.
Hello . If it’s anything like Mamba F22 mini. But more important you have upgraded to latest BetaFlight. Just enter expert mode, by the little tab. connect into the Firmware flasher, you should see the option for DFU mode right around the enable full chip erase area. When your ready to return to COM channel. whichever yours may be. Just exit out . you may need to close and restart BetaFlight depending on your computer’s O.S. or condition/Age. Happy Flashing. And Please Remember to Flash Responsibly.
Hi Oscar,
do you know the Cli command to put the FC-Mamba f405 mini into DFU mode?
I tried “bl” and “DFU”, but it does not work.
Thanks in advance.