2 Commits e40204bcbc ... 150acb3fca

Autore SHA1 Messaggio Data
  龙三郎 150acb3fca Merge branch 'master' of http://192.168.100.32:3000/longsanlang/Network-Modules 7 mesi fa
  龙三郎 3cbeb5266a 修改网络模组串口出现数组越界的问题 7 mesi fa
4 ha cambiato i file con 12 aggiunte e 5 eliminazioni
  1. 2 2
      Drivers/CONFIG.h
  2. 8 1
      Drivers/Modules/At_Module.c
  3. 1 1
      Drivers/Modules/bc260y/Bc260y_Regist.c
  4. 1 1
      User/main.c

+ 2 - 2
Drivers/CONFIG.h

@@ -12,9 +12,9 @@
 
 
 
-//#define EC800M 1 //4G开关,不能数字开头
+#define EC800M 1 //4G开关,不能数字开头
 //#define BC260Y 1  // NB
-#define ESP32 1		//WiFi
+//#define ESP32 1		//WiFi
 //#define AIWB2	1	//WIFI_AIWB2-32S
 
 

+ 8 - 1
Drivers/Modules/At_Module.c

@@ -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;
 		

+ 1 - 1
Drivers/Modules/bc260y/Bc260y_Regist.c

@@ -28,7 +28,7 @@ static struct TUORENIOT_RegistRequestStruct regist_request = {
 	.networkProtocol = 1,
 	.productId = "1dbfd476b7nm2",
 	.deviceId = "3431228A1936013C",
-	.userId = "1000",
+	.userId = "1226",
 	.sim = "",
 };
 

+ 1 - 1
User/main.c

@@ -27,7 +27,7 @@
 
 
 // 6365736869303036
-uint8_t mcu_id[8] = "ceshi006";
+uint8_t mcu_id[8] = "ceshi007";
 
 // ¼ÆÊ±Æ÷
 static struct TIMER_Struct timer;