feat: 添加局域网设备发现功能和链路胶囊优化
- 实现局域网设备发现面板,支持探测ESP32中继板并自动切换端点 - 添加POST /api/lan/probe接口用于设备探测,返回三态判决结果 - 实现快扫和全段扫描两种模式,支持种子地址优先探测 - 添加端点唯一写手机制,防止多处同时修改设备IP - 优化链路胶囊UI显示WiFi/EtherCAT/BLE连接状态和设备名称 - 修复EtherCAT链路OTA刷写期间PDO循环暂停和AL状态处理问题 - 调整PDO周期设置范围为0.125-4ms,支持亚毫秒显示为微秒 - 添加ESP32 WiFi使能开关控件样式和数据来源角标显示
This commit is contained in:
@@ -200,12 +200,15 @@ section("[2c] DC 自愈:证明配错才动总线,证明不了/正在恢复
|
||||
return { delta: after - before, reasons: st.startReasons };
|
||||
};
|
||||
const bad = await run({ dc: 0, dc_cycle_us: 0, period_ms: 4 });
|
||||
check("DC 被证明配错 ⇒ 恰又多一次 motor/start(拉回 250µs)",
|
||||
check("DC 被证明配错(free-run)⇒ 恰又多一次 motor/start(按 period 对齐 DC)",
|
||||
bad.delta === 1, `多 ${bad.delta} 次`);
|
||||
check("DC 自愈带 reason=auto_dc_repair(代理侧据此统一节流)",
|
||||
bad.reasons.some((r) => r === "auto_dc_repair"), bad.reasons.join(","));
|
||||
const good = await run({ dc: 1, dc_cycle_us: 250, period_ms: 0.25 });
|
||||
check("DC 正确 ⇒ 零次 motor/start", good.delta === 0, `多 ${good.delta} 次`);
|
||||
const goodHot = await run({ dc: 1, dc_cycle_us: 500, period_ms: 0.5 });
|
||||
check("热改档 0.5ms/500us 同值 ⇒ 零次 motor/start(不再被当成配错)",
|
||||
goodHot.delta === 0, `多 ${goodHot.delta} 次`);
|
||||
const busy = await run({ dc: 0, dc_cycle_us: 0, period_ms: 4, recovering: 1 });
|
||||
check("native 正在全量重连 ⇒ 即使 DC 配错也不插第二刀", busy.delta === 0, `多 ${busy.delta} 次`);
|
||||
const blind = await run({});
|
||||
@@ -238,8 +241,14 @@ section("[2d] proveEcatLoop / proveEcatDc 三态矩阵");
|
||||
ebus.proveEcatDc({ ok: true }) === "unknown");
|
||||
check("proveEcatDc: dc=1/250/0.25 ⇒ ok",
|
||||
ebus.proveEcatDc({ ok: true, dc: 1, dc_cycle_us: 250, period_ms: 0.25 }) === "ok");
|
||||
check("proveEcatDc: period 掉到 4ms ⇒ misconfigured",
|
||||
ebus.proveEcatDc({ ok: true, dc: 1, dc_cycle_us: 4000, period_ms: 4 }) === "misconfigured");
|
||||
check("proveEcatDc: 热改档 dc=1/500/0.5 ⇒ ok(period 与 DC 同值即合法)",
|
||||
ebus.proveEcatDc({ ok: true, dc: 1, dc_cycle_us: 500, period_ms: 0.5 }) === "ok");
|
||||
check("proveEcatDc: period=4ms 且 DC=4000us ⇒ ok(UI 档位内)",
|
||||
ebus.proveEcatDc({ ok: true, dc: 1, dc_cycle_us: 4000, period_ms: 4 }) === "ok");
|
||||
check("proveEcatDc: period=4ms 但 DC 仍 250us ⇒ misconfigured(不同值)",
|
||||
ebus.proveEcatDc({ ok: true, dc: 1, dc_cycle_us: 250, period_ms: 4 }) === "misconfigured");
|
||||
check("proveEcatDc: free-run ⇒ misconfigured",
|
||||
ebus.proveEcatDc({ ok: true, dc: 0, dc_cycle_us: 0, period_ms: 0.25 }) === "misconfigured");
|
||||
}
|
||||
|
||||
/* ── 2e. OTA 负载页的决策:读数不新鲜 ≠ 循环停了 ── */
|
||||
|
||||
Reference in New Issue
Block a user