From 9aed5d7e7b3c7bf09da712e9c272ece401a7acc9 Mon Sep 17 00:00:00 2001
From: QuakeGod <QuakeGod@sina.com>
Date: 星期一, 25 十一月 2024 14:51:23 +0800
Subject: [PATCH] add UltraSonic and MultiWireLess

---
 CCT6_TestApp1/Src/stm32f0xx_it.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/CCT6_TestApp1/Src/stm32f0xx_it.c b/CCT6_TestApp1/Src/stm32f0xx_it.c
index 9d86dbd..2b04ba7 100644
--- a/CCT6_TestApp1/Src/stm32f0xx_it.c
+++ b/CCT6_TestApp1/Src/stm32f0xx_it.c
@@ -247,18 +247,22 @@
 
 	if (LL_USART_IsActiveFlag_RXNE(USART1))
 	{
-		Uart1BaudGot=1;
-		Uart1BaudFirstGot=1;
-		Uart1Stat.RXNECount++;
+//		Uart1BaudGot=1;
+//		Uart1BaudFirstGot=1;
+//		Uart1Stat.RXNECount++;
 		unsigned char ch=LL_USART_ReceiveData8(USART1);
 		// PushOne(&Uart1Stat.QRx,ch);
 		Uart1Stat.RecvBytes++;
-		Uart1RecvBuf1[Uart1RecvBuf1DataLen++]=ch;
+		Uart1RecvBuf1[Uart1RecvBuf1DataLen]=ch;
+		if (Uart1RecvBuf1DataLen <RX1BUFSIZE -1 ) {
+			Uart1RecvBuf1DataLen++;
+		}
 		//LL_USART_TransmitData8(USART1,ch);
 	}
 	if (LL_USART_IsActiveFlag_ORE(USART1))
 	{
 		LL_USART_ClearFlag_ORE(USART1);
+		LL_USART_DisableOverrunDetect(USART1);
 		Uart1Stat.OverRunCount++;
 	}
 	if (LL_USART_IsEnabledIT_IDLE(USART1)&&LL_USART_IsActiveFlag_IDLE(USART1))
@@ -294,6 +298,7 @@
 	if (LL_USART_IsActiveFlag_ORE(USART2))
 	{
 		LL_USART_ClearFlag_ORE(USART2);
+		LL_USART_DisableOverrunDetect(USART2);		
 		Uart2Stat.OverRunCount++;
 	}
 	if (LL_USART_IsEnabledIT_IDLE(USART2)&&LL_USART_IsActiveFlag_IDLE(USART2))
@@ -340,6 +345,7 @@
 	if (LL_USART_IsActiveFlag_ORE(USART3))
 	{
 		LL_USART_ClearFlag_ORE(USART3);
+		LL_USART_DisableOverrunDetect(USART3);
 //		Uart3Stat.OverRunCount++;
 	}
 	if (LL_USART_IsEnabledIT_IDLE(USART3)&&LL_USART_IsActiveFlag_IDLE(USART3))

--
Gitblit v1.9.1