[DOC] Cli.md: add missing 2.6 items (bind_rx, safehome), make references clickable...
[inav/snaewe.git] / docs / Cli.md
blob04332e2fbf02796fd734da0f09c55f69ba9fd818
1 # Command Line Interface (CLI)
3 INAV has a command line interface (CLI) that can be used to change settings and configure the FC.
5 ## Accessing the CLI.
7 The CLI can be accessed via the GUI tool or via a terminal emulator connected to the CLI serial port.
9 1. Connect your terminal emulator to the CLI serial port (which, by default, is the same as the MSP serial port)
10 2. Use the baudrate specified by msp_baudrate (115200 by default).
11 3. Send a `#` character.
13 To save your settings type in 'save', saving will reboot the flight controller.
15 To exit the CLI without saving power off the flight controller or type in 'exit'.
17 To see a list of other commands type in 'help' and press return.
19 To dump your configuration (including the current profile), use the 'dump' or 'diff' command.
21 See the other documentation sections for details of the cli commands and settings that are available.
23 ## Backup via CLI
25 Disconnect main power, connect to cli via USB/FTDI.
27 dump using cli
29 ```
30 profile 0
31 dump
32 ```
34 dump profiles using cli if you use them
36 ```
37 profile 1
38 dump profile
39 profile 2
40 dump profile
41 ```
43 copy screen output to a file and save it.
45 Alternatively, use the `diff` command to dump only those settings that differ from their default values (those that have been changed).
48 ## Restore via CLI.
50 Use the cli `defaults` command first.
52 When restoring from backup it's a good idea to do a dump of the latest defaults so you know what has changed - if you do this each time a firmware release is created you will be able to see the cli changes between firmware versions. If you blindly restore your backup you would not benefit from these new defaults or may even end up with completely wrong settings in case some parameters changed semantics and/or value ranges.
54 It may be good idea to restore settings using the `diff` output rather than complete `dump`. This way you can have more control on what is restored and the risk of mistakenly restoring bad values if the semantics changes is minimised.
56 To perform the restore simply paste the saved commands in the Configurator CLI tab and then type `save`.
58 After restoring it's always a good idea to `dump` or `diff` the settings once again and compare the output with previous one to verify if everything is set as it should be.
61 ## CLI Command Reference
63 | `Command`        | Description                                    |
64 |------------------|------------------------------------------------|
65 | `1wire <esc>`    | passthrough 1wire to the specified esc         |
66 | `adjrange`       | show/set adjustment ranges settings            |
67 | `aux`            | show/set aux settings                          |
68 | `beeper`         | show/set beeper (buzzer) [usage](Buzzer.md)    |
69 | `bind_rx`        | Initiate binding for RX_SPI or SRXL2 receivers |
70 | `mmix`           | design custom motor mixer                      |
71 | `smix`           | design custom servo mixer                      |
72 | `color`          | configure colors                               |
73 | `defaults`       | reset to defaults and reboot                   |
74 | `dump`           | print configurable settings in a pastable form |
75 | `diff`           | print only settings that have been modified    |
76 | `exit`           |                                                |
77 | `feature`        | list or -val or val                            |
78 | `get`            | get variable value                             |
79 | `gpspassthrough` | passthrough gps to serial                      |
80 | `help`           |                                                |
81 | `led`            | configure leds                                 |
82 | `map`            | mapping of rc channel order                    |
83 | `motor`          | get/set motor output value                     |
84 | `msc`            | Enter USB Mass storage mode. See [USB MSC documentation](USB_Mass_Storage_(MSC)_mode.md) for usage information.|
85 | `play_sound`     | index, or none for next                        |
86 | `profile`        | index (0 to 2)                                 |
87 | `rxrange`        | configure rx channel ranges (end-points) |
88 | `safehome`      | Define safe home locations. See the [safehome documentation](Safehomes.md) for usage information. |
89 | `save`           | save and reboot                                |
90 | `serial`         | Configure serial ports                         |
91 | `serialpassthrough <id> <baud> <mode>`| where `id` is the zero based port index, `baud` is a standard baud rate, and mode is `rx`, `tx`, or both (`rxtx`) |
92 | `set`            | name=value or blank or * for list              |
93 | `status`         | show system status                             |
94 | `temp_sensor`    | list or configure temperature sensor(s). See [temperature sensors documentation](Temperature sensors.md) for more information. |
95 | `wp`             | list or configure waypoints. See more in the [navigation documentation](Navigation.md#cli-command-wp-to-manage-waypoints). |
96 | `version`        | Displays version information,                  |
98 ### serial
100 The syntax of the `serial` command is `serial <id>  <function_value> <msp-baudrate> <gps-baudrate> <telemetry-baudate> <peripheral-baudrate>`.
102 A shorter form is also supported to enable and disable a single function using `serial <id> +n` and `serial <id> -n`, where n is the a serial function identifier. The following values are available:
104 | Function              | Bit Identifier | Numeric value |
105 |-----------------------|---------------|----------------|
106 | MSP                   | 0             | 1 |
107 | GPS                   | 1             | 2 |
108 | TELEMETRY_FRSKY       | 2             | 4 |
109 | TELEMETRY_HOTT        | 3             | 8 |
110 | TELEMETRY_LTM         | 4             | 16 |
111 | TELEMETRY_SMARTPORT   | 5             | 32 |
112 | RX_SERIAL             | 6             | 64 |
113 | BLACKBOX              | 7             | 128 |
114 | TELEMETRY_MAVLINK     | 8             | 256 |
115 | TELEMETRY_IBUS        | 9             | 512 |
116 | RCDEVICE              | 10            | 1024 |
117 | VTX_SMARTAUDIO        | 11            | 2048 |
118 | VTX_TRAMP             | 12            | 4096 |
119 | UAV_INTERCONNECT      | 13            | 8192 |
120 | OPTICAL_FLOW          | 14            | 16384 |
121 | LOG                   | 15            | 32768 |
122 | RANGEFINDER           | 16            | 65536 |
123 | VTX_FFPV              | 17            | 131072 |
125 Thus, to enable MSP and LTM on a port, one would use the function **value** of 17 (1 << 0)+(1<<4), aka 1+16, aka 17.
128 serial 0 17 57600 57600 57600 57600
130 but to remove LTM using the +/- shorthand, use the **bit Id** (4, TELEMETRY_LTM):
133 serial 0 -4
136 `serial` can also be used without any argument to print the current configuration of all the serial ports.
138 ## Flash chip management
140 For targets that have a flash data chip, typically used for blackbox logs, the following additional comamnds are provided.
142 | Command | Effect |
143 | ------- | ------ |
144 | `flash_erase` | Erases the  flash chip |
145 | `flash_info` | Displays flash chip information (used, free etc.) |
146 | `flash_read <length> <address>` | Reads `length` bytes from `address` |
147 | `flash_write <address> <data>` | Writes `data` to `address` |
149 ## CLI Variable Reference
150 See [Settings.md](Settings.md).