From 8d1562d3849e43da41dfc74bdc88dcd159c6be67 Mon Sep 17 00:00:00 2001 From: wu58430 Date: Thu, 7 Dec 2023 17:34:13 +0800 Subject: [PATCH] fix https://github.com/losehu/uv-k5-firmware-chinese/issues/15 --- app/mdc1200.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/mdc1200.c b/app/mdc1200.c index c49bd09..c9c0895 100644 --- a/app/mdc1200.c +++ b/app/mdc1200.c @@ -471,8 +471,7 @@ uint8_t mdc1200_rx_ready_tick_500ms; void MDC1200_process_rx(const uint16_t interrupt_bits) { - char b[2]="R0"; - UART_Send((uint8_t *)&b,2); + const uint16_t rx_sync_flags = BK4819_ReadRegister(0x0B); const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11)); @@ -520,22 +519,19 @@ void MDC1200_process_rx(const uint16_t interrupt_bits) mdc1200_rx_buffer[mdc1200_rx_buffer_index++] = (word >> 8) & 0xff; } - char a[2]="R1"; - UART_Send((uint8_t *)&a,2); + if (mdc1200_rx_buffer_index >= sizeof(mdc1200_rx_buffer)) { BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59); BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59); - char a[2]="RE"; - UART_Send((uint8_t *)&a,2); + if (MDC1200_process_rx_data( mdc1200_rx_buffer, mdc1200_rx_buffer_index, &mdc1200_op, &mdc1200_arg, &mdc1200_unit_id)) { - char a[2]="OK"; - UART_Send((uint8_t *)&a,2); + mdc1200_rx_ready_tick_500ms = 2 * 5; // 6 second MDC display time gUpdateDisplay = true;