feat(ecat): PDO 快发 ESF1 桌面强制直通,堵死慢发回落
桌面 APP 下 ECAT motor 发送只走 pywebview ESF1→native TCP; 删除桥内 HTTP/JSON 回落。附延迟测量与 pack 自测脚本与规格文档。
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
*
|
||||
* 电机页在 tabs.html 的 iframe 内:pywebview 只注入顶层窗口,同源 iframe
|
||||
* 必须向上找 window.parent / window.top 上的 pywebview.api。
|
||||
*
|
||||
* PDO 快发(pdo-fast-send):桌面壳且 native 带 fast_send_port 时,ECAT
|
||||
* motor 发送优先 desktopEcatSendRaw(GUI 侧 ESF1 二进制直通入队)。
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
@@ -59,7 +62,26 @@ export async function desktopEcatPost(path, body, timeoutMs) {
|
||||
return api.ecat_api(path, body == null ? {} : body, timeoutMs || 4000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 桌面桥 PDO 快发(ESF1)。frames=[{ch,id,dlc,data(hex)}]。
|
||||
* @returns {Promise<object>} {ok,queued,backlog,path,log};path=fast_tcp|http_send_raw|http_motor_send
|
||||
*/
|
||||
export async function desktopEcatSendRaw(frames, timeoutMs) {
|
||||
const api = getDesktopEcatApi();
|
||||
if (!api || typeof api.ecat_send_raw !== "function") {
|
||||
throw new Error("desktop fast-send unavailable");
|
||||
}
|
||||
return api.ecat_send_raw(frames, timeoutMs || 2000);
|
||||
}
|
||||
|
||||
/** @description 桌面桥是否暴露 ecat_send_raw(方法在,不代表 native 快发口一定在)。 */
|
||||
export function hasDesktopFastSend() {
|
||||
const api = getDesktopEcatApi();
|
||||
return !!(api && typeof api.ecat_send_raw === "function");
|
||||
}
|
||||
|
||||
/** @description 状态栏用:当前 ECAT 控制通道形态。 */
|
||||
export function desktopBridgeLabel() {
|
||||
return getDesktopEcatApi() ? "APP 原生桥" : "HTTP 代理";
|
||||
if (!getDesktopEcatApi()) return "HTTP 代理";
|
||||
return hasDesktopFastSend() ? "APP 二进制快发" : "APP 原生桥";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user