Browse Source

Signed-off-by: zhuhongbin <kptzhu@163.com>

zhuhongbin 1 year ago
parent
commit
f2f4a9f8d0
6 changed files with 18 additions and 12 deletions
  1. 1 1
      Src/main.c
  2. 9 4
      tmr/buffer.c
  3. 3 2
      tmr/button.c
  4. 1 1
      tmr/display.c
  5. 3 3
      tmr/flash.c
  6. 1 1
      tmr/weight.c

+ 1 - 1
Src/main.c

@@ -155,7 +155,7 @@ int main(void)
   MX_DMA_Init();
   MX_USART1_UART_Init();
   MX_UART4_Init();
-  MX_UART5_Init();
+  //MX_UART5_Init();
   MX_USART2_UART_Init();
   MX_USART3_UART_Init();
   MX_IWDG_Init();

+ 9 - 4
tmr/buffer.c

@@ -68,6 +68,7 @@ static unsigned char XbeeConst_ReadNum0 = 0;
 static unsigned char XbeeConst_FrameLength0_Remote = 0, XbeeConst_ReadNum0_Remote = 0;
 
 unsigned char XbeeConst_FrameNumLast=0;  //上次发送的帧编号
+unsigned char RemoteFrameNumLast = 0xFF;  //铲车接收的上次帧编号
 unsigned char XbeeConst_FTxBuf0[50];        //处理发送无线临时表
 
 unsigned char* XbeeConst_PTxBuf0;        //处理发送无线临时表
@@ -562,6 +563,7 @@ void RX_Remote(void) {
 
                 if ((0xff - checksum) == XbeeConst_FRxBuf0_Remote[XbeeConst_FrameLength0_Remote])  //校验成功
                 {
+									  
                     if (
                         (((XbeeConst_FRxBuf0_Remote[2] & 0x1F) == XbeeConst_RemoteAddress && (WeightConst_SBType == 2 || WeightConst_SBType == 7))
                          ||
@@ -690,7 +692,8 @@ void RX_Remote(void) {
                             }
 
                             RemoteSendDisplay = 1;
-                            if (XbeeConst_FRxBuf0_Remote[4]==0x01 && button_state.b1==0)//收到1号键
+                            if (XbeeConst_FRxBuf0_Remote[4]==0x01 && button_state.b1==0 
+															&& RemoteFrameNumLast != XbeeConst_FRxBuf0_Remote[XbeeConst_FRxBuf0_Remote[1]])//收到1号键
                             {
                                 if (pf_comp.data.needBegin == 1 && WeightConst_WeightHaveBegin==0)
                                 {
@@ -718,7 +721,8 @@ void RX_Remote(void) {
 																		}
 															  }
                             }
-                            else if (XbeeConst_FRxBuf0_Remote[4]==0x02 && button_state.b2==0) //收到2号键
+                            else if (XbeeConst_FRxBuf0_Remote[4]==0x02 && button_state.b2==0 
+															&& RemoteFrameNumLast != XbeeConst_FRxBuf0_Remote[XbeeConst_FRxBuf0_Remote[1]]) //收到2号键
                             {
                                 if(!WeightConst_DELAYON>0)
 																{
@@ -731,8 +735,9 @@ void RX_Remote(void) {
                                 button_state.b2=1;  //5秒内不可按键
                             }
                         }
-                    }
-                }
+                    }                
+								    RemoteFrameNumLast =  XbeeConst_FRxBuf0_Remote[XbeeConst_FRxBuf0_Remote[1]];
+								}
                 XbeeConst_ReadNum0_Remote = 0; //循环计数清零
                 XbeeConst_FrameLength0_Remote = 0;
             } else {

+ 3 - 2
tmr/button.c

@@ -69,7 +69,8 @@ static void CheckMenuButton_entry(void *parameter) {
 		if (button_state.b4>=5)	button_state.b4 = 0;
 		if (button_state.b5>=5)	button_state.b5 = 0;
 		if (button_state.b7>=15)	button_state.b7 = 0;
-		if (WeightConst_SBType == 3 && isnewBan==1)
+		if (//WeightConst_SBType == 3 && 
+			isnewBan==1)
 					{	
 			if (HAL_GPIO_ReadPin(pwr_GPIO_Port, pwr_Pin) == 0) {
 				rt_thread_mdelay(2000);
@@ -467,7 +468,7 @@ static void CheckButton_entry(void *parameter) {
 				if (button_state.b4>=5)	button_state.b4 = 0;
 				
 				if (button_state.b7>=15)	button_state.b7 = 0;
-				if (WeightConst_SBType == 3 &&
+				if (//WeightConst_SBType == 3 &&
 					isnewBan==1)
 				{					
 					if ((HAL_GPIO_ReadPin(pwr_GPIO_Port, pwr_Pin) == 0) ) {

+ 1 - 1
tmr/display.c

@@ -844,7 +844,7 @@ static void Display_entry(void *parameter) {
 							}
 					  }
 						if (isn>=1){
-								rt_thread_mdelay(600);							 
+								rt_thread_mdelay(500);							 
 						}
 						else{
 				        rt_thread_mdelay(300);

+ 3 - 3
tmr/flash.c

@@ -9,8 +9,8 @@
 
 uint8_t  isCC = 0 ;
 uint8_t  isBLE =0;  //用蓝牙传输
-uint8_t  isNsmall =0;  //新小屏
-uint8_t  isnewBan =1;  //隔离主板
+uint8_t  isNsmall = 0;  //新小屏
+uint8_t  isnewBan = 0;  //隔离主板
 uint8_t  isnewLora =0;  //用lora协议
 const uint8_t  isTag = 0 ; //是否含识读标签
 unsigned char  isn = 0;  //是否新大屏
@@ -18,7 +18,7 @@ unsigned char  remote_sumweight = 0;  //远
 unsigned char  iscowweight = 0;  //是否奶牛秤
 unsigned char eid[10];    //电子耳标,0为长度
 
-uint8_t XbeeConst_DeviceAddress = 0x02;         
+uint8_t XbeeConst_DeviceAddress = 0x01;         
 uint8_t XbeeConst_NetAddress = 0x00;
 uint8_t XbeeConst_UseAPI = 0x01;
 uint8_t WeightConst_TQ = 0x05;//0x05;

+ 1 - 1
tmr/weight.c

@@ -712,7 +712,7 @@ static void P_TMI_III() {
 				}
 				else if (WeightConst_RecWeightPoint1>4 && WeightConst_RecWeightData1[WeightConst_RecWeightPoint1-1] != 0x20) {
 					 //2D 33 36 35 34 0D
-					 readnumber(WeightConst_RecWeightData1,WeightConst_RecWeightPoint1,0, 5,5,0x2d, 0xFF);                
+					 readnumber(WeightConst_RecWeightData1,WeightConst_RecWeightPoint1,0, 5, 0xff,0x2d, 0xFF);                
 				}
 				WeightConst_RecWeightPoint1 = 0; //Ö¸Õ뻹ԭ
 		} else {