Parcourir la source

修复urat连续接收数据长之后,并且间隔小于2ms,出现帧溢出,导致解析数据错位问题

CN\houcf5 il y a 4 mois
Parent
commit
2ad26278d0
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      3.BasicFunction/Source/usart.c

+ 3 - 0
3.BasicFunction/Source/usart.c

@@ -131,6 +131,9 @@ void UsartRx_Process(USART_Buf_TypeDef *USARTx_RxBuf_Struct, USART_Buf_TypeDef *
         Lanfeng9_USART_RxData_Process(USARTx_TxBuf_Struct, data, datacount);
         TORG4BB_USART_RxData_Process(USARTx_TxBuf_Struct, data, datacount);
         /*clear*/
+        if(USARTx_RxBuf_Struct->ucBufRdInde!=USARTx_RxBuf_Struct->ucBufWrInde)
+        USARTx_RxBuf_Struct->ucBufRdInde=USARTx_RxBuf_Struct->ucBufWrInde;
+
         USART_RxFrameBuf_Struct->uwDataCount[USART_RxFrameBuf_Struct->ucBufRdIndex] = 0;
         USART_RxFrameBuf_Struct->uwFramecount--;
         USART_RxFrameBuf_Struct->ucBufRdIndex++;