diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/loop_uart_proto.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/loop_uart_proto.c index 3c999d2..599c04d 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/loop_uart_proto.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/loop_uart_proto.c @@ -687,7 +687,10 @@ void lup_process_frame(const uint8_t *pkg, uint16_t len) if (len < 6) { FAULT_MARKER(MK_LUP_FRAME_OUT); return; } // Debug: print raw (2026-08-13: 缓冲一次性输出 — 逐字节 PRINT 关中断 ~350us/字节 - // 会屏蔽 UART2 ISR 丢帧, 且高频打印放大 printf 重入窗口) + // 会屏蔽 UART2 ISR 丢帧, 且高频打印放大 printf 重入窗口。 + // 再关闭: 190B 打印 @256000 = 7.4ms 关中断 → UART2(19200) 溢出丢字节 → 粘帧! + // 需要调试时打开 #if 1) +#if 0 { char _hex[224]; int _p = snprintf(_hex, sizeof(_hex), "LUP Rx:"); @@ -696,6 +699,7 @@ void lup_process_frame(const uint8_t *pkg, uint16_t len) } PRINT("%s\n", _hex); } +#endif // --- Checksum --- csr = lup_verify_checksum(pkg, len); diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c index 381711c..e1fbfb3 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/tcp_json_srv.c @@ -883,8 +883,13 @@ static void json_sensor_callback(const uint8_t *pkg, uint16_t len) // Check: socket active, authed, report enabled if (g_json_socket_listen == 0xFF) { PRINT("JSON: sensor_cb skip: no socket\n"); return; } + /* 2026-08-13: not authed 每帧打印太吵 (Loop MCU 高频上报), 且占用主循环 + 关中断窗口 → UART2 丢字节。调试时打开 */ +#if 0 if (g_json_auth_state != JSON_STATE_AUTHED) { PRINT("JSON: sensor_cb skip: not authed\n"); return; } - if (!g_report_cfg.enable) { PRINT("JSON: sensor_cb skip: report disabled\\n"); return; } +#endif + if (g_json_auth_state != JSON_STATE_AUTHED) { return; } + if (!g_report_cfg.enable) { PRINT("JSON: sensor_cb skip: report disabled\n"); return; } LUP_SensorReport sr; memset(&sr, 0, sizeof(sr)); diff --git a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/usart_biz.c b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/usart_biz.c index aeed38e..20db4d6 100644 --- a/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/usart_biz.c +++ b/vd960DBN/BLE/OnlyUpdateApp_Peripheral/APP/usart_biz.c @@ -174,12 +174,19 @@ void uart_srv(void) g_pkg_uart_2.pkg[0] = 0x8F; g_flag_notify_temp = set_response_tran_to_notify(g_pkg_uart_2.pkg, g_pkg_uart_2.offset, &g_notify_buftemp); // 保留给 BLE } - // else: 回调已推送 TCP,直接清理 + /* 2026-08-13 修复: 0xC0 帧消费后必须清 flag — + 原缺失, auth 未通过时 tcp_json_push_sensor 提前 return + 也不清 → 坏帧/正常帧反复处理 (checksum fail 刷屏) */ + InitPkgUart(&g_pkg_uart_2); } else { if(g_flag_bt_state){ g_flag_notify_temp = set_response_tran_to_notify(g_pkg_uart_2.pkg, g_pkg_uart_2.offset, &g_notify_buftemp); InitPkgUart(&g_pkg_uart_2); + } + else { + /* 2026-08-13 修复: 非 0xC0 + 无 BLE 连接也清 flag (原缺失) */ + InitPkgUart(&g_pkg_uart_2); } }