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
+3 -3
View File
@@ -1,7 +1,7 @@
/**
* test_ecat_autostart.mjs — EtherCAT 自动接入链条自测(Node,无浏览器)
*
* 跑法:node scripts/test_ecat_autostart.mjs [--port 8080]
* 跑法:node scripts/test_ecat_autostart.mjs [--port 2625]
*
* 测什么:**真的 import 生产代码** transport-ecat.js,验证"自动接入"这条
* 四级链条的每一级都被正确驱动,且失败原因可读。
@@ -108,7 +108,7 @@ section("[1] probe() 自动开网卡 + 自动起循环(四级链条的 2/3/4
un(); srv.close();
check("先探 status 发现未连接", st.calls[0] === "/ecat/api/status", st.calls[0]);
check("自动调用 /api/open(代替用户去点连接按钮)", st.calls.includes("/ecat/api/open"));
check("open 用默认网卡子串 I226", st.openSubstr === "I226", String(st.openSubstr));
check("open 用默认网卡子串 I210", st.openSubstr === "I210", String(st.openSubstr));
check("随后自动调用 /api/motor/start(进 OP + 起后台循环)", st.started === true);
check("open 在 start 之前", st.calls.indexOf("/ecat/api/open") < st.calls.indexOf("/ecat/api/motor/start"));
check("periodMs 由后端回报写入", tp.debug().periodMs === 4, String(tp.debug().periodMs));
@@ -133,7 +133,7 @@ section("[2] 已连接则不重复 open(幂等)");
/* ── 3. 网卡打不开 → 报错要冒泡且**不**标 transient(否则页面一直转圈不给红灯)── */
section("[3] 打不开网卡时的错误语义");
{
const { srv, port } = await makeStub({ failOpen: "没有找到描述包含 'I226' 的适配器" });
const { srv, port } = await makeStub({ failOpen: "没有找到描述包含 'I210' 的适配器" });
const un = bindFetch(port);
const tp = createEcatTransport(CTX);
let err = null;