Files
qing 01126a5786 feat(mtc): .mt 脚本编译器落地 + pybot 扬声器静音语义
mtc 新模块:命令式动作脚本(Python DSL)→ .mt 矩阵编译器,非阻塞时间轴 IR(重叠截断/rest 静止值)+ 10ms 栅格化,产物可由 pybot/bot4cj 直接执行;34 测试全绿(含 pybot parser e2e)。

pybot speaker.py:frequency<=0 改为静音节拍(仅 sleep 保时序,不再钳到 min_f 低鸣),对齐仓颉版 sleep 占位语义;mtc Beep 通道 rest=0,段前/段间/段后回落静音,两侧语义闭环。

修复 test_actpred_compatibility 过时断言(99c1bc1 首行分解为重复微步 19→20 帧时漏改,14→15)。

文档三处同步:根 README 回填 memdb/pybot/actpred 并新增 mtc(模块表+端口一览+章节),MODULES/ARCHITECTURE 同步 mtc,新建 mtc/README.md。
2026-08-15 13:54:47 +08:00

26 lines
908 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""pytest 公共配置:mtc 根入 sys.path;pybot parser 独立加载(绕包 __init__)
Windows 开发机无 fcntl:import pybot 会经 robot.py → hd/i2c.py 触发
fcntl 导入失败。e2e 仅需 MatrixParser,而 parser.py 只依赖 logging,
用 spec_from_file_location 独立加载即可(与 pybot tests/conftest.py
的符号链接 fallback 同属 Windows 兼容层)。
"""
import importlib.util
import sys
from pathlib import Path
MTC_ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(MTC_ROOT))
PYBOT_PARSER = MTC_ROOT.parent / "pybot" / "pybot" / "parser.py"
def load_pybot_parser():
"""独立加载 pybot/parser.py(不触发 pybot/__init__ 的硬件链)"""
spec = importlib.util.spec_from_file_location(
"pybot_parser_standalone", PYBOT_PARSER)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod