RS485 send: disable RX during tx + drain/clear after (anti-loopback); COM_DEBUG on with RX byte trace

This commit is contained in:
2026-10-09 19:58:51 +08:00
parent 5771fee576
commit 318d4c60f4
3 changed files with 18 additions and 1 deletions
+5
View File
@@ -463,6 +463,11 @@ void command_process(void) {
int byte = rs485_rx_get();
if (byte < 0) break;
#if COM_DEBUG == CFG_ENABLE
/* 调试:打印 RS485 收到的每个原始字节 */
printf("[RX] %02X\r\n", (uint8_t)byte);
#endif
if (cmd_len == 0) {
if ((uint8_t)byte == PROTOCOL_PACKAGE_HEADER) {
cmd_buf[cmd_len++] = (uint8_t)byte;