feat: DBNetClient Loop命令完善 + vd960DBN 发送调试打印
vd960DBN: - loop_uart_proto.c: 所有发送函数添加 LUP Tx 调试打印 - tcp_json_srv.c: 新增 loop_version_query/loop_reset/loop_factory_init/ loop_sens_read/loop_sens_write 命令处理器 + 延迟响应解析 - 修复 loop_sens_write 未设置命令状态机和错误使用解析函数的问题 DBNetClient: - tcp_json_client.py: 新增 full Loop MCU API (6 条命令) - main.py: 线圈参数标签页增加版本/复位/出厂/灵敏度操作按钮
This commit is contained in:
@@ -483,18 +483,30 @@ void lup_cmd_on_response(const uint8_t *pkg, uint16_t len)
|
||||
* High-level Send Commands
|
||||
*===========================================================================*/
|
||||
|
||||
static void lup_debug_tx(const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
uint8_t i;
|
||||
PRINT("LUP Tx:");
|
||||
for (i = 0; i < len; i++) {
|
||||
PRINT(" %02X", buf[i]);
|
||||
}
|
||||
PRINT("\n");
|
||||
}
|
||||
|
||||
void lup_send_get_version(void)
|
||||
{
|
||||
uint8_t buf[LUP_MAX_PKG_LEN];
|
||||
uint16_t len = lup_build_get_version(buf);
|
||||
lup_debug_tx(buf, len);
|
||||
UART2_SendString(buf, len);
|
||||
lup_cmd_begin(LUP_CMD_GET_VERSION, 200); // 200ms timeout
|
||||
lup_cmd_begin(LUP_CMD_GET_VERSION, 200);
|
||||
}
|
||||
|
||||
void lup_send_reset(void)
|
||||
{
|
||||
uint8_t buf[LUP_MAX_PKG_LEN];
|
||||
uint16_t len = lup_build_reset(buf);
|
||||
lup_debug_tx(buf, len);
|
||||
UART2_SendString(buf, len);
|
||||
// No response expected
|
||||
}
|
||||
@@ -503,6 +515,7 @@ void lup_send_factory_init(void)
|
||||
{
|
||||
uint8_t buf[LUP_MAX_PKG_LEN];
|
||||
uint16_t len = lup_build_factory_init(buf);
|
||||
lup_debug_tx(buf, len);
|
||||
UART2_SendString(buf, len);
|
||||
lup_cmd_begin(LUP_CMD_FACTORY_INIT, 500);
|
||||
}
|
||||
@@ -511,6 +524,7 @@ void lup_send_sensitivity_read(void)
|
||||
{
|
||||
uint8_t buf[LUP_MAX_PKG_LEN];
|
||||
uint16_t len = lup_build_sensitivity_read(buf);
|
||||
lup_debug_tx(buf, len);
|
||||
UART2_SendString(buf, len);
|
||||
lup_cmd_begin(LUP_CMD_SENSITIVITY, 200);
|
||||
}
|
||||
@@ -519,6 +533,7 @@ void lup_send_set_param(const LUP_ParamSet *ps)
|
||||
{
|
||||
uint8_t buf[LUP_MAX_PKG_LEN];
|
||||
uint16_t len = lup_build_set_param(buf, ps);
|
||||
lup_debug_tx(buf, len);
|
||||
UART2_SendString(buf, len);
|
||||
lup_cmd_begin(LUP_CMD_SET_PARAM, 500);
|
||||
}
|
||||
@@ -527,6 +542,7 @@ void lup_send_get_param(void)
|
||||
{
|
||||
uint8_t buf[LUP_MAX_PKG_LEN];
|
||||
uint16_t len = lup_build_get_param(buf);
|
||||
lup_debug_tx(buf, len);
|
||||
UART2_SendString(buf, len);
|
||||
lup_cmd_begin(LUP_CMD_GET_PARAM, 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user