1
This commit is contained in:
9
main.py
9
main.py
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user