|
|
@@ -8,12 +8,14 @@
|
|
|
#include "Log_Module.h"
|
|
|
#include "CONFIG.h"
|
|
|
|
|
|
+#define LENGTH 1024
|
|
|
+
|
|
|
|
|
|
// AT指令
|
|
|
struct AT_Struct
|
|
|
{
|
|
|
enum AT_Status status;
|
|
|
- uint8_t result[1024];
|
|
|
+ uint8_t result[LENGTH];
|
|
|
uint16_t result_length;
|
|
|
};
|
|
|
static struct AT_Struct at_Struct = {
|
|
|
@@ -26,6 +28,11 @@ void USART2_IRQHandler(void)
|
|
|
if(USART_GetFlagStatus(USART2, USART_IT_RXNE) == SET)
|
|
|
{
|
|
|
uint8_t RxData = USART_ReceiveData(USART2);
|
|
|
+ // 判断数组写入长度,防止过界
|
|
|
+ if(at_Struct.result_length >= (LENGTH-1))
|
|
|
+ {
|
|
|
+ at_Struct.result_length = 0;
|
|
|
+ }
|
|
|
// 写入缓存
|
|
|
at_Struct.result[at_Struct.result_length++] = RxData;
|
|
|
|