From fec9d2d13928a44c1f7433a7892cc5dbd842b525 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期三, 27 九月 2023 11:08:19 +0800 Subject: [PATCH] 1 --- Src/main.c | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Src/main.c b/Src/main.c index 92e97d9..f3d8ea1 100644 --- a/Src/main.c +++ b/Src/main.c @@ -38,7 +38,7 @@ #define NSH1 0x0001 #define GP 0x0002 #define FLASH_HARDWARE_VERSION_MAP (uint32_t)0x08004F00 //硬件版本号和批次信息位置 -#define DEBUG_MODE +//#define DEBUG_MODE /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -227,7 +227,7 @@ hardware_type = STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4); //deca_sleep(1000); g_com_map[VERSION] = (1<<8)|68; - + g_com_map[DEV_ID]=1158; #ifdef DEBUG_MODE // g_com_map[GROUP_ID]=21; // g_com_map[DEV_ID]=4; @@ -349,6 +349,7 @@ { if(GPIO_Pin == GPIO_PIN_11) { + SystemClock_Config(); // l_bIsVibration = HIDO_TRUE; // nomove_time=0; // printf("RXD :77777\r\n"); @@ -409,7 +410,7 @@ MX_DMA_Init(); // MX_IWDG_Init(); /* USER CODE BEGIN 2 */ - LED_LG_ON; +// LED_LG_ON; Program_Init(); // LIS3DH_Data_Init(); // Uwb_Lora_Switch(1,0); @@ -418,8 +419,8 @@ Delay_Ms(10); // Uwb_Lora_Switch(0,0); // HardWareTypeDiffConfig(); -// dwt_configuresleep(DWT_PRESRV_SLEEP | DWT_CONFIG, DWT_WAKE_CS | DWT_WAKE_WK| DWT_SLP_EN); -// dwt_entersleep(); + dwt_configuresleep(DWT_PRESRV_SLEEP | DWT_CONFIG, DWT_WAKE_CS | DWT_WAKE_WK| DWT_SLP_EN); + dwt_entersleep(); if(HAL_UART_Receive_DMA(&huart1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE)) { Error_Handler(); @@ -427,6 +428,7 @@ HAL_Delay(2000); // Uwb_Lora_Switch(0,1); Lora_Init(); +// Radio.Sleep( ); Delay_Ms(10); // Uwb_Lora_Switch(0,0); printf("RXD :66666\r\n"); @@ -446,6 +448,8 @@ /* USER CODE BEGIN 3 */ Lora_rx_open(); + + // HAL_IWDG_Refresh(&hiwdg); // IdleTask(); // Radio.IrqProcess( ); // Process Radio IRQ @@ -868,10 +872,23 @@ float key_keeptime; extern float freqlost_count,range_lost_time; uint32_t lp_time; +extern uint8_t lora_yingda_flag; +uint8_t lora_yingdatime; +extern uint8_t lora_chongfuyingda_flag; void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) { + SystemClock_Config(); lp_time++; - + if(lora_yingda_flag) + { + lora_yingdatime++; + if(lora_yingdatime>=2) + {lora_yingdatime=0; + lora_yingda_flag=0; + Lora_tx_mode(); + Radio.Send( usart_send, 2); + } + } } /* USER CODE END 4 */ -- Gitblit v1.9.3