Refactor the console subsystem

Rename cli.ino => console.ino.
Rename handleInput => handleConsole.
Separate console initialization function.
Always use usb cdc by default on s3/c3 (no configuration needed).
This commit is contained in:
Oleg Kalachev
2026-08-19 05:32:52 +03:00
parent b6c0bebdeb
commit 03084a672a
8 changed files with 31 additions and 18 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ Firmware source files are located in `flix` directory.
* [`control.ino`](../flix/control.ino) — control subsystem, three-dimensional two-level cascade PID controller.
* [`motors.ino`](../flix/motors.ino) — PWM motor output control.
* [`mavlink.ino`](../flix/mavlink.ino) — interaction with QGroundControl or [pyflix](../tools/pyflix) via MAVLink protocol.
* [`cli.ino`](../flix/cli.ino) — serial and MAVLink console.
* [`console.ino`](../flix/console.ino) — serial and MAVLink console.
Utility files:
@@ -60,7 +60,7 @@ To write into the console, `print()` function is used. This function sends data
print("Test value: %.2f\n", testValue);
```
In order to add a console command, modify the `doCommand()` function in `cli.ino` file.
In order to add a console command, modify the `doCommand()` function in `console.ino` file.
> [!IMPORTANT]
> Avoid using delays in in-flight commands, it will **crash** the drone! (The design is one-threaded.)
+2 -2
View File
@@ -54,7 +54,7 @@ Beginners can [download the sources as a ZIP archive](https://github.com/okalach
* `MAVLink`, version 2.0.25.
5. Open the `flix/flix.ino` sketch from downloaded firmware sources in Arduino IDE.
6. Connect your ESP32 board to the computer and choose correct board type in Arduino IDE (*WEMOS D1 MINI ESP32* for ESP32 Mini, *ESP32S3 Dev Module* for ESP32-S3 Super Mini) and the port.
7. Set *Tools**Core Debug Level* to *Error* to see the errors in the serial console. Set *Tools**USB CDC on Boot* to *Enabled* for ESP32-S3/ESP32-C3 boards.
7. Set *Tools**Core Debug Level* to *Error* to see the errors in the serial console.
8. [Build and upload](https://docs.arduino.cc/software/ide-v2/tutorials/getting-started/ide-v2-uploading-a-sketch) the firmware using Arduino IDE.
#### Command line (Windows, Linux, macOS)
@@ -89,7 +89,7 @@ Beginners can [download the sources as a ZIP archive](https://github.com/okalach
For ESP32-S3/ESP32-C3 boards, set the appropriate [FQBN](https://docs.arduino.cc/arduino-cli/FAQ/#whats-the-fqbn-string) using `BOARD` parameter:
```bash
make BOARD=esp32:esp32:esp32s3:FlashSize=4M,CDCOnBoot=cdc upload
make BOARD=esp32:esp32:esp32s3 upload
```
See other available Make commands in [Makefile](../Makefile).