From 114944d512d07f1fdbfcaa13d582944e49b8961d Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期二, 24 九月 2024 15:28:16 +0800 Subject: [PATCH] 1.31,修复不能测距的bug。 --- Src/main.c | 29 +++++++++++++++++++---------- 1 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Src/main.c b/Src/main.c index 50a9dd2..1021ece 100644 --- a/Src/main.c +++ b/Src/main.c @@ -316,7 +316,7 @@ hardware_pici = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2); hardware_type = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4); //deca_sleep(1000); - g_com_map[VERSION] = (1<<8)|29; + g_com_map[VERSION] = (1<<8)|31; // g_com_map[DEV_ID]=1158; // #ifdef DEBUG_MODE // // g_com_map[GROUP_ID]=21; @@ -373,7 +373,7 @@ // } //g_com_map[NOMOVESLEEP_TIME]=5; printf("固件版本: URT-LORA-GPS版本 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff); - memcpy(g_com_map2,g_com_map,COM_MAP_SIZE); +// memcpy(g_com_map2,g_com_map,COM_MAP_SIZE); // printf("DEVICE PAIRID: %d .\r\n",g_com_map[PAIR_ID]); // printf("DEVICE ALARM DISTANCE: 1.%d 2.%d 3.%d .\r\n",g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],g_com_map[ALARM_DISTANCE3]); @@ -444,6 +444,7 @@ uint16_t irq_num; u8 lora_irq_flag,lora_working_flag; //u8 uwb_irq_flag; +extern uint8_t LoraUp_flag; void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { if(GPIO_Pin == RADIO_DIO1_Pin) @@ -451,8 +452,15 @@ // SystemClock_Config(); irq_num++; - lora_irq_flag = 1; + + if(LoraUp_flag) + { RadioIrqProcess(); + } + else + { + lora_irq_flag = 1; + } } if(GPIO_Pin == GPIO_PIN_1)//按键 { @@ -741,6 +749,7 @@ Error_Handler(); } HAL_TIM_Base_Start_IT(&htim6); + memcpy(g_com_map2,g_com_map,COM_MAP_SIZE); /* USER CODE END 2 */ /* Infinite loop */ @@ -759,13 +768,13 @@ else { // HAL_IWDG_Refresh(&hiwdg); -// if(lora_irq_flag) -// { -// lora_irq_flag = 0; -// lora_working_flag = 1; -// RadioIrqProcess(); -// lora_working_flag = 0; -// } + if(lora_irq_flag) + { + lora_irq_flag = 0; + lora_working_flag = 1; + RadioIrqProcess(); + lora_working_flag = 0; + } // if(uwb_irq_flag) // { // MbxTagUwbRec(); -- Gitblit v1.9.3