from pathlib import Path
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
def read_text(path: str) -> str:
|
return (ROOT / path).read_text(encoding="utf-8")
|
|
|
def require(condition: bool, message: str) -> None:
|
if not condition:
|
raise SystemExit(message)
|
|
|
def main() -> None:
|
app = read_text("main/application.cc")
|
board = read_text("main/boards/sening-xiaozhi-s3/sening_xiaozhi_s3.cc")
|
system = read_text("main/boards/sening-xiaozhi-s3/system.c")
|
header = read_text("main/boards/sening-xiaozhi-s3/system.h")
|
mqtt = read_text("main/boards/sening-xiaozhi-s3/mqtt.c")
|
mqtt_header = read_text("main/boards/sening-xiaozhi-s3/mqtt.h")
|
|
require(
|
"void SDCard_Show_Matching_JPG_For_MP3_Path(const char *mp3_path);" in header,
|
"system.h must expose a helper for showing the matching JPG for an MP3 path",
|
)
|
require(
|
"void SDCard_Show_Matching_JPG_For_MP3_Path(const char *mp3_path)" in system,
|
"system.c must implement matching JPG display for direct MP3 paths",
|
)
|
require(
|
"SDCard_Show_Matching_JPG_For_MP3_Path(path);" in system,
|
"manual MP3 playback should share the matching JPG display helper",
|
)
|
require(
|
mqtt.find("SDCard_Show_Matching_JPG_For_MP3_Path(item.sd_path);") < mqtt.find("SDCard_Play_MP3_File_With_Speed(item.sd_path, item.speed);") ,
|
"MQTT playlist must show the matching JPG before starting MP3 playback",
|
)
|
require(
|
"void BoardMqtt_StopPlaylistPlayback(void);" in mqtt_header,
|
"mqtt.h must expose a public playlist stop API",
|
)
|
require(
|
"Board_Show_Black_Screen();" in mqtt,
|
"playlist stop should clear the screen to black",
|
)
|
require(
|
"void Board_Show_Black_Screen(void)" in board,
|
"board must implement a black-screen helper",
|
)
|
require(
|
"uint16_t black_line[SCREEN_WIDTH] = {0};" in board,
|
"black-screen helper must use a low-memory line buffer",
|
)
|
require(
|
"Board_Show_Black_Screen();" in board,
|
"board init should use the black-screen helper",
|
)
|
require(
|
"for (size_t y = 0; y < height; ++y)" in system,
|
"JPG display must draw line by line to reduce DMA pressure",
|
)
|
require(
|
"esp_lcd_panel_draw_bitmap(panel, 0, 0, JPG_REQUIRED_WIDTH, JPG_REQUIRED_HEIGHT, image);" not in system,
|
"JPG display must not use a full-frame draw path",
|
)
|
require(
|
"esp_lcd_panel_draw_bitmap(panel, 0, y, width, y + 1, image + y * stride);" in system,
|
"JPG display must use the line-by-line draw path",
|
)
|
require(
|
"sdcard_mp3_stop_requested_ = true;\n BoardMqtt_StopPlaylistPlayback();" in app,
|
"self.mp3.stop must terminate the MQTT playlist as well as the local MP3",
|
)
|
|
|
if __name__ == "__main__":
|
main()
|