feat(voice): migrate to push2talk and serialize websocket text sends

This commit is contained in:
admin
2026-03-01 01:21:18 +08:00
parent 9deeab738e
commit dd108e2658
19 changed files with 891 additions and 224 deletions

View File

@@ -7,12 +7,12 @@ ESP32-S3 works as a Wi-Fi REST controller and replaces Android App logic:
## Features
- Wi-Fi STA-only mode (configured SSID/password; no SoftAP fallback)
- Built-in minimal web UI at `/` for voice tap2talk
- Built-in minimal web UI at `/` for voice status and MIC_KEY guidance
- Direct thermal printer control with sensor precheck
- Async print queue with jobs (`queued/running/success/failed/canceled`)
- Printer precheck (paper / battery / temperature)
- Built-in UTF-8 text rendering with Chinese support (GB2312 character set, 16x16 bitmap)
- Tap2talk multimodal voice interaction over DashScope WebSocket:
- Push2talk multimodal voice interaction over DashScope WebSocket:
- ES8311 microphone/speaker via `esp_codec_dev`
- raw-opus uplink/downlink via `esp_audio_codec`
- WebSocket transport via `esp_websocket_client`
@@ -125,7 +125,7 @@ http://<esp-ip>/
```
The page provides a minimal voice console:
- single-round tap2talk button
- MIC_KEY(IO14) trigger guide (press to talk, release to process)
- voice status display
## REST Examples
@@ -205,20 +205,20 @@ curl http://<esp-ip>/v1/jobs
curl http://<esp-ip>/v1/jobs/1
```
### Voice tap2talk
### Voice push2talk
Start session:
```bash
curl -X POST http://<esp-ip>/v1/voice/session/start
```
Start one tap2talk round:
Press-to-talk start (sends `SendSpeech` when entering `Listening`):
```bash
curl -X POST http://<esp-ip>/v1/voice/tap/start
```
Cancel current tap2talk round:
Release-to-stop (sends `StopSpeech`):
```bash
curl -X POST http://<esp-ip>/v1/voice/tap/cancel
@@ -244,7 +244,8 @@ curl -X POST http://<esp-ip>/v1/voice/session/stop
- Characters outside embedded glyph set are rendered as square fallback boxes.
- Large buffers for image upload/decode prefer PSRAM first, then fallback to internal RAM.
- Partition table uses `partitions.csv` with a 4MB `factory` app partition on 16MB flash modules.
- Voice flow is now single-round: audio uplink stops after `SpeechEnded`, then `LocalRespondingEnded` and `Stop` are sent after local playback drain.
- Voice flow uses `push2talk`: client sends `SendSpeech` to start uplink and `StopSpeech` on release to end input.
- Voice flow is now single-round: after recognition/response completes, `LocalRespondingEnded` and `Stop` are sent after local playback drain.
- Voice flow blocks starting the next round while voice is Thinking/Responding, marker image generation is running, or printer queue is still busy.
## Font Assets