feat(factory): support USB CDC alongside UART CLI

This commit is contained in:
chenjintao
2026-10-27 15:04:14 +08:00
parent 6116a67d5f
commit 002967b21f
13 changed files with 583 additions and 69 deletions
@@ -130,7 +130,10 @@ CONFIG_TQ_FACTORY_CLI_ENABLE=y
control_plane_factory_cli_start();
```
它创建名为 `factory_cli` 的 FreeRTOS 任务,通过 Console UART 读取以 `\r` 或 `\n` 结束的命令。
它创建单个名为 `factory_cli` 的 FreeRTOS 任务,同时轮询 UART0 与原生 USB Serial/JTAG CDC,
读取以 `\r` 或 `\n` 结束的命令。新增 `CONFIG_TQ_FACTORY_CLI_USB_CDC_ENABLE=y` 默认启用CDC,
两路各自维护行缓冲、工厂模式和待保存身份字段,回复只发给命令来源。
详见 [工厂CLI串口与CDC使用说明](../工厂CLI串口与CDC使用说明.zh-CN.md)。
关键参数:
@@ -138,8 +141,8 @@ control_plane_factory_cli_start();
| --- | ---: |
| 最大命令行长度 | 512 B |
| 最大参数数量 | 8 |
| 串口读取超时 | 100 ms |
| 任务栈 | 12 KiB |
| 接收调度 | 两路非阻塞读取,每路每轮最多64字节,每轮让出1 tick |
| 任务栈 | 默认7 KiB(`CONFIG_TQ_FACTORY_CLI_TASK_STACK_BYTES`) |
| 任务优先级 | 4 |
| 运行核心 | `CONFIG_TQ_LOCAL_TASK_CORE` |
@@ -186,8 +189,8 @@ get_device_info
`set_device_id` 和 `set_serial_number` 只将值暂存在 RAM:
```c
s_pending_device_id
s_pending_serial_number
s_current_session->pending_device_id
s_current_session->pending_serial_number
```
只有执行 `save_config` 后,才会调用: