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
+52 -1
View File
@@ -119,6 +119,27 @@
overflow: hidden;
transition: border-color .22s, transform .22s, box-shadow .22s;
}
/* ---------- 数据来源角标(WiFi / ECAT / BLE) ----------
右上角小胶囊:标出本格当前数据从哪条链路来。
为双路径无感切换预留:通路变化时 JS 调 setCellSource() 改 data-src + 文案。 */
.src-badge {
position: absolute; top: 5px; right: 5px;
font-family: var(--font-mono); font-size: 9px; font-weight: 600;
letter-spacing: .06em; line-height: 1;
padding: 3px 5px; border-radius: 4px;
border: 1px solid transparent;
opacity: .88; pointer-events: none; user-select: none;
z-index: 2;
}
.src-badge.src-wifi { color: var(--esp32); background: var(--esp32-dim); border-color: rgba(47,216,193,.25); }
.src-badge.src-ecat { color: var(--mem-hi); background: var(--mem-dim); border-color: rgba(168,139,250,.28); }
.src-badge.src-ble { color: var(--ble); background: rgba(95,168,255,.12); border-color: rgba(95,168,255,.25); }
.src-badge.src-dual {
color: var(--text); background: linear-gradient(90deg, var(--esp32-dim), var(--mem-dim));
border-color: rgba(47,216,193,.35);
}
.src-badge.src-off { color: var(--text-label); background: rgba(255,255,255,.04); border-color: var(--border); }
.metric::before {
content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
background: var(--metric-accent, var(--esp32));
@@ -169,8 +190,10 @@
/* ================= 主状态徽章 ================= */
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge-stat {
position: relative; /* src-badge 绝对定位锚点(缺了会飘到卡片/页面角) */
background: var(--bg-elevated); border: 1px solid var(--border);
border-radius: var(--radius); padding: 16px 16px 13px; text-align: center;
border-radius: var(--radius); padding: 22px 16px 13px; text-align: center;
overflow: hidden;
transition: border-color .22s, transform .22s, box-shadow .22s;
}
.badge-stat:hover {
@@ -718,6 +741,34 @@ code { color: var(--esp32-hi); font-family: var(--font-mono); }
.ble-low-table td:nth-child(7), .ble-low-table td:nth-child(9) { text-align: left; }
.ble-low-table td:first-child { color: var(--text-dim); }
/* ================= ESP32 WiFi 使能开关(PC9 / WLESS_EN) ================= */
.wifi-en-inline {
margin-left: auto;
display: flex; align-items: center; gap: 8px;
position: relative; z-index: 2;
}
.wifi-en-inline-label {
font-size: 12px; font-weight: 600; color: var(--text-dim); white-space: nowrap;
}
.wifi-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.wifi-switch--sm { width: 36px; height: 20px; }
.wifi-switch input { opacity: 0; width: 0; height: 0; }
.wifi-slider {
position: absolute; inset: 0; cursor: pointer; border-radius: 999px;
background: #3a4a63; transition: background .18s ease;
}
.wifi-slider::before {
content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
border-radius: 50%; background: #fff; transition: transform .18s ease;
}
.wifi-switch--sm .wifi-slider::before {
width: 14px; height: 14px; left: 3px; top: 3px;
}
.wifi-switch input:checked + .wifi-slider { background: var(--green); }
.wifi-switch input:checked + .wifi-slider::before { transform: translateX(20px); }
.wifi-switch--sm input:checked + .wifi-slider::before { transform: translateX(16px); }
.wifi-switch input:focus-visible + .wifi-slider { outline: 2px solid var(--esp32); outline-offset: 2px; }
/* ================= BLE 连接按钮(launch 风格) =================
圆形物理按键:未连接=暗淡待机;勾选=已连接,蓝光环绕 + 文字波浪动画。
checkbox 隐藏,由 JS setConnectionState 驱动 checked,避免异步连接失败导致状态错位。 */