docs: 新增 .qoder Repowiki 知识库文档

This commit is contained in:
cbb
2026-09-07 12:19:26 +08:00
parent 43d42ad891
commit ef9472334a
105 changed files with 1313322 additions and 263 deletions
+8 -5
View File
@@ -122,13 +122,13 @@ g_job = None # Job Object 句柄: 父进程一死内核连坐杀服务
# 电机页的 EtherCAT 传输要打 tools/ecat 的 EtherCAT 服务(native)的 /api/motor/*,
# 但那个服务**只绑 127.0.0.1 且完全没有 CORS**(无 Access-Control-Allow-Origin,
# 也没有 do_OPTIONS —— 预检直接 501)。而我们的 API 是 POST + JSON,
# 属非简单请求, 浏览器必发预检 → 从本页面(:8080)直接 fetch 它(:8090)必然失败。
# 属非简单请求, 浏览器必发预检 → 从本页面(:2625)直接 fetch 它(:8090)必然失败。
#
# 三种解法里选反向代理:
# 1) 改 EtherCAT 后端加 CORS —— 那是另一个仓库, 不该为本页面改;
# 2) 把电机页搬进 EtherCAT 后端的静态白名单 —— 且会让
# WiFi 版和 ECAT 版分裂成两份页面, 正好违背"所有组件复用"的要求;
# 3) 本服务代理 —— 页面永远同源(:8080), 两个仓库都不用动。
# 3) 本服务代理 —— 页面永远同源(:2625), 两个仓库都不用动。
# 端口自动探测: EtherCAT 服务(含 native)会在 8090..8095 间漂移。
ECAT_PROXY_PREFIX = "/ecat/api/"
ECAT_PORTS = (8090, 8091, 8092, 8093, 8094, 8095)
@@ -228,10 +228,13 @@ def _ecat_autostart():
try:
# --parent-pid: 跳过 native 侧的清场逻辑, 并让它在本服务退出后
# 自我了断(不留孤儿占 Npcap/端口)。
# --mask 0x10: PDO 自旋线程钉 LP4(i7-14700K P核2), 避开 DPC 集中的
# 核0 与 E 核, 与 ecat_web.bat 同值, 换机需按拓扑改。不钉的话
# 自旋线程随调度器漂移, 1ms 档周期抖动明显放大。
# cwd=tools/ecat: --web 的相对路径(src/web)按此解析。
g_ecat_child = subprocess.Popen(
[ECAT_NATIVE_EXE, "--substr", "I226", "--web", "src/web",
"--parent-pid", str(os.getpid())],
[ECAT_NATIVE_EXE, "--substr", "I210", "--mask", "0x10",
"--web", "src/web", "--parent-pid", str(os.getpid())],
cwd=ECAT_DIR,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
stdin=subprocess.DEVNULL,
@@ -957,7 +960,7 @@ def _gui_bringToFront():
def main():
ap = argparse.ArgumentParser(description="ESP32 调试控制台页面服务器")
ap.add_argument("--port", type=int, default=8080)
ap.add_argument("--port", type=int, default=2625)
ap.add_argument("--no-browser", action="store_true")
ap.add_argument("--window", action="store_true",
help="pywebview 桌面窗口模式")