zack 1 anno fa
parent
commit
1999d5037f
2 ha cambiato i file con 2245 aggiunte e 2215 eliminazioni
  1. 29 9
      Core/Src/mba32a.c
  2. 2216 2206
      Output/dtu.hex

+ 29 - 9
Core/Src/mba32a.c

@@ -79,10 +79,14 @@ void MBA32A_Init(void)
 		{
 			if(sendCmd_BT("AT+DEV?\r\n","+DEV:0,101000000003",1,1))
 			{
-				printf("设备已连接\r\n");
 				startdtu=false;	//关闭开始界面
 				BT_CONN=true;
 				connected=true;
+				if(sendCmd_BT("AT+AUTO_CFG=1\r\n","OK",1,1))
+				{
+					printf("自动重连打开\r\n");
+				}
+				printf("设备已连接\r\n");
 				//L1bd=true;
 				break;
 			}
@@ -174,10 +178,14 @@ void MBA32A_Init(void)
 			{
 				if(sendCmd_BT("AT+CONN=101000000003\r\n","+CONNECTED:0,101000000003",3,3))
 				{           
-					printf("连接成功!");
 					startdtu=false;	//关闭开始界面
 					BT_CONN=true;
 					//L1bd=true;
+					if(sendCmd_BT("AT+AUTO_CFG=1\r\n","OK",1,1))
+					{
+						printf("自动重连打开\r\n");
+					}
+					printf("连接成功!");
 					break;
 				}
 				else if(sendCmd_BT("AT+CONN=101000000003\r\n","+CONNECT TIMEOUT",3,5))
@@ -265,6 +273,7 @@ void lock_searchInfo(void)		//
 	uint8_t serchInfo_CMD[] = {0x01, 0x00};//查询信息命令帧
 	sendCombinedArray(header,sizeof(header),serchInfo_CMD,sizeof(serchInfo_CMD));
 	Echo_BT(20);
+
 }
 
 /**
@@ -311,11 +320,11 @@ void workinfo_W(void)
 
 void Scan_lock_status(void)
 {
-	if(bt_lock_machinesta==0x01 && bt_lock_ropesta==0x00)//0x01电机关 0x00锁绳插入
+	if(bt_lock_machinesta==0x01 && bt_lock_ropesta==0x00 && g_MBA32A_8buf_Down[0]==0x66)//0x01电机关 0x00锁绳插入
 	{
 		menu.home=0xF000;//关(全部关闭)
 	}
-	else if(bt_lock_machinesta==0x00 && bt_lock_ropesta==0x01)
+	else if(bt_lock_machinesta==0x00 && bt_lock_ropesta==0x01 && g_MBA32A_8buf_Down[0]==0x66)
 	{
 		menu.home=0x1000;//开(全部开启)
 	}
@@ -323,7 +332,10 @@ void Scan_lock_status(void)
 	{
 		menu.home=0x1000;//开(电机打开,锁绳插入,可按键拔出)
 	}
-
+	else if(bt_lock_ropesta==0x01 && bt_lock_machinesta==0x00 && g_MBA32A_8buf_Down[0]==0x66)
+	{
+		menu.home=0x1000;//开(电机关闭,锁绳拔出)
+	}
 }
 
 
@@ -373,10 +385,6 @@ void close_lock(Bt_frame btFrame)					//
 
 
 
-
-
-
-
 void Seal_Unseal(void)
 {
 	if (menu.enter == 4)
@@ -387,14 +395,26 @@ void Seal_Unseal(void)
 			{
 				// 施封操作
 				close_lock(btFrame);
+				HAL_Delay(1000);
+				menu.current=0;
+				refresh=true;
 				
 			}
 			else if (menu.up == 0)
 			{
 				// 解封操作
 				open_lock(btFrame);
+				HAL_Delay(1000);
+				menu.current=0;
+				refresh=true;
 			}
 		}
 	}
 }
 
+
+void tips()
+{
+	
+}
+

File diff suppressed because it is too large
+ 2216 - 2206
Output/dtu.hex