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:
cbb
2026-10-13 00:48:34 +08:00
parent 514070b36d
commit eac3717f9a
41 changed files with 4229 additions and 934 deletions
+15 -2
View File
@@ -17,6 +17,8 @@
* reportedIp(data) -> string|null 设备回报 IP(ECAT 恒 null)
* fetchMotorState() -> {have_data, age_ms, active_count, boot_active, motors[]}
* fetchFeedback() -> {channels:[{ch,enabled,valid,rx,tx,err,tec,rec,bus_state}]}
* bus_state 位图:bit0=init bit1=控制器睡眠 bit2=error_passive bit3=bus_off
* bit4=error_warning bit5=只听不发(收发器 Silent,本端 S 脚)
* sendFrames(frames, {ch}) -> results[] frames=[{id,dlc,data}]
* sendBurst(frames, {suffix,dlc}) -> results[]
* fetchVersionNode(node) -> {node,seq,version,at?}|null
@@ -25,13 +27,24 @@
* teardown() -> void 切走时收尾
* 可选:takeNodeIdReport(node)、debug()
*
* 电机 OTA(supportsOta=true 时必须整套实现;流程只在 ota.js 里写一遍):
* otaHostSendsBootFrame: bool 进 BOOT 帧由上位机发(WiFi)还是 GD32 在已加锁
* 的通道上自己发(EtherCAT)
* otaIntegrity: string 完整性口径,UI 文案照它写,不许互相冒充:
* 'sha256-esp32-flash' | 'crc32-verify-in-slave'
* otaUploadAttempt(bytes, shaHex, {ch, node}) -> {ok, note, size?}
* otaStartRelay(ch, node) -> {ok} 抛错=没起来
* otaStatus() -> {state, error, session_error, packets_acked, total_packets, note}
* state 用 WiFi 那套字符串(ECAT 由传输层翻译)
* otaCancel() -> {ok, note?}
*
* motors[] 每项的字段契约(ECAT 实现负责补平差异):
* {node, ch, online, dlc, rx_count, seq, data(64hex), config_data(48hex|"")}
*/
"use strict";
import { createWifiTransport } from "./transport-wifi.js";
import { createEcatTransport } from "./transport-ecat.js?v=20260923i";
import { createWifiTransport } from "./transport-wifi.js?v=20261011b";
import { createEcatTransport } from "./transport-ecat.js?v=20261011b";
/** localStorage key:记住上次选的传输,刷新页面后保持 */
export const LS_TRANSPORT = "dcu_motor_transport";