From c58fc126850c37760410a23a9f5e9729591905a0 Mon Sep 17 00:00:00 2001 From: ligenxxxx <59721724+ligenxxxx@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:35:08 +0800 Subject: [PATCH] set uart baudrate only when init --- src/hardware.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/hardware.c b/src/hardware.c index 3764dd9..5693eca 100644 --- a/src/hardware.c +++ b/src/hardware.c @@ -1512,12 +1512,15 @@ void uart_baudrate_detect(void) { // tramp protocol need 115200 bps. return; #else - if (seconds - msp_lst_rcv_sec >= 20) { - msp_lst_rcv_sec = seconds; - BAUDRATE++; - CFG_Back(); - uart_set_baudrate(BAUDRATE); - Setting_Save(); + static uint8_t once_done = 0; + if (once_done == 0) { + if (seconds - msp_lst_rcv_sec >= 10) { + msp_lst_rcv_sec = seconds; + BAUDRATE++; + CFG_Back(); + Setting_Save(); + once_done = 1; + } } #endif }