feat(transport): 添加SPI Ready握手引脚支持并优化GPIO驱动依赖

添加ESP32-C3 GPIO驱动组件以支持SPI Ready握手机制,新增
SPI_READY_GPIO(10)引脚配置用于监测GD32 PB6就绪状态,避免SPI
通信时从机未准备好的丢帧问题。
This commit is contained in:
小龙虾
2026-07-06 19:14:13 +08:00
parent 2fe5393769
commit 069ce8e6a5
17 changed files with 251 additions and 76 deletions
+15 -6
View File
@@ -1039,12 +1039,6 @@
return json;
}
function buildSendResponseText(result) {
if (result.status === 'ok') {
return result.recv ? ('0x' + result.recv + ' (' + result.recv_len + ' 字节)') : '无响应数据';
}
return '发送失败: code=' + result.code;
}
function updateResponseBox(box, textEl, result, mode) {
if (!box || !textEl) return;
@@ -1478,5 +1472,20 @@
setTimeout(testConnection, 150);
}
var CAN_SEND_ERR_DESC = {
'-1': '参数错误(通道/ID/DLC 无效)',
'-2': 'SPI 通信失败(ESP32 与 GD32 通信异常)',
'-3': 'GD32 CAN 总线拒绝(BUS_OFF / TEC 过高 / 邮箱满)',
};
function buildSendResponseText(result) {
if (result.status === 'ok') {
return result.recv ? ('0x' + result.recv + ' (' + result.recv_len + ' 字节)') : '无响应数据';
}
var code = String(result.code);
var desc = CAN_SEND_ERR_DESC[code] || '未知错误';
return '发送失败: ' + desc + ' (code=' + result.code + ')';
}
init();
})();