refactor(printer): remove BLE backend and dependencies

This commit is contained in:
admin
2026-02-28 22:35:08 +08:00
parent d6fae38d46
commit 9deeab738e
14 changed files with 115 additions and 1783 deletions

View File

@@ -2,16 +2,13 @@
ESP32-S3 works as a Wi-Fi REST controller and replaces Android App logic:
- REST client -> ESP32-S3 (`esp_http_server`)
- ESP32-S3 -> BLE printer (`TQPrinter` / `lyfPrinter`, `FFF2` write / `FFF1` notify)
- Command compatibility:
- Print path: `0x00~0x07`
- OTA path: `0xA0~0xA4`
- ESP32-S3 -> onboard direct thermal printer driver
## Features
- Wi-Fi STA-only mode (configured SSID/password; no SoftAP fallback)
- Built-in minimal web UI at `/` for voice tap2talk
- BLE central client auto-scan/connect to printer name
- 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)
@@ -19,12 +16,6 @@ ESP32-S3 works as a Wi-Fi REST controller and replaces Android App logic:
- ES8311 microphone/speaker via `esp_codec_dev`
- raw-opus uplink/downlink via `esp_audio_codec`
- WebSocket transport via `esp_websocket_client`
- Android-compatible print flow:
- `0x00` power on
- `0x03` set print param
- `0x04` chunked raster send + ACK
- `0x00` power off
- `0x02` feed paper
- REST APIs:
- Root:
- `GET /`
@@ -148,17 +139,9 @@ curl http://<esp-ip>/v1/health
```bash
curl -X POST http://<esp-ip>/v1/printer/connect \
-H 'Content-Type: application/json' \
-d '{"name":"TQPrinter","timeout_ms":15000}'
# Legacy device name is also supported:
# -d '{"name":"lyfPrinter","timeout_ms":15000}'
```
Auto-match a compatible printer (by BLE service `0xFFF0`):
```bash
curl -X POST http://<esp-ip>/v1/printer/connect \
-H 'Content-Type: application/json' \
-d '{"name":"*","timeout_ms":20000}'
-d '{"timeout_ms":15000}'
# Optional explicit backend field:
# -d '{"backend":"direct","timeout_ms":15000}'
```
### Raster print
@@ -255,7 +238,6 @@ curl -X POST http://<esp-ip>/v1/voice/session/stop
## Notes
- BLE side is central/client role, not printer peripheral role.
- `base64_msb_1bpp` uses Android-compatible bit order (MSB first).
- `/v1/print/image` supports two modes: JSON prompt generation (DashScope Z-Image) and raw `image/png` upload (no base64 wrapper).
- `/v1/print/text` supports UTF-8 Chinese via embedded 16x16 GB2312 glyphs.