This commit is contained in:
jeremygan2021
2026-03-03 23:31:06 +08:00
parent 0aa8f5f473
commit 20d2e72c51
10 changed files with 220 additions and 201 deletions

View File

@@ -851,6 +851,17 @@ async def websocket_endpoint(websocket: WebSocket):
# 4. 如果有识别结果发送ASR文字到ESP32
if asr_text:
print(f"ASR result: {asr_text}")
# 主动下发字体数据
try:
unique_chars = set(asr_text)
code_list = [str(ord(c)) for c in unique_chars]
print(f"Sending font data for {len(code_list)} characters...")
success_count, failed = await send_font_batch_with_retry(websocket, code_list)
print(f"Font data sent: {success_count} success, {len(failed)} failed")
except Exception as e:
print(f"Error sending font data: {e}")
# 发送 ASR 文字到 ESP32 显示
await websocket.send_text(f"ASR:{asr_text}")