This commit is contained in:
jeremygan2021
2026-03-03 22:11:26 +08:00
parent fc92a5feaf
commit 700bc55657
7 changed files with 138 additions and 124 deletions

View File

@@ -6,6 +6,9 @@ import network
import st7789py as st7789
from config import CURRENT_CONFIG
from audio import AudioPlayer, Microphone
# Define colors that might be missing in st7789py
DARKGREY = 0x4208
from display import Display
from websocket_client import WebSocketClient
import uselect
@@ -89,7 +92,7 @@ def draw_mic_icon(display, x, y, active=True):
if not display or not display.tft:
return
color = st7789.GREEN if active else st7789.DARKGREY
color = st7789.GREEN if active else DARKGREY
display.tft.fill_rect(x + 5, y, 10, 5, color)
display.tft.fill_rect(x + 3, y + 5, 14, 10, color)
@@ -137,7 +140,7 @@ def draw_progress_bar(display, x, y, width, height, progress, color=st7789.CYAN)
if not display or not display.tft:
return
display.tft.fill_rect(x, y, width, height, st7789.DARKGREY)
display.tft.fill_rect(x, y, width, height, DARKGREY)
if progress > 0:
bar_width = int(width * min(progress, 1.0))
display.tft.fill_rect(x, y, bar_width, height, color)
@@ -176,7 +179,7 @@ def render_confirm_screen(display, asr_text=""):
display.tft.fill_rect(0, 0, 240, 30, st7789.CYAN)
display.text("说完了吗?", 75, 8, st7789.BLACK)
display.tft.fill_rect(10, 50, 220, 80, st7789.DARKGREY)
display.tft.fill_rect(10, 50, 220, 80, DARKGREY)
display.text(asr_text if asr_text else "未识别到文字", 20, 75, st7789.WHITE)
display.tft.fill_rect(20, 150, 80, 30, st7789.GREEN)