From 26b1bee0d753aff0d2967002193d24ac2a3e50f7 Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期三, 21 二月 2024 09:40:59 +0800 Subject: [PATCH] 调试成功网关读写配置 --- Src/main.c | 95 +++-------------------------------------------- 1 files changed, 6 insertions(+), 89 deletions(-) diff --git a/Src/main.c b/Src/main.c index 92e041b..80fa0e2 100644 --- a/Src/main.c +++ b/Src/main.c @@ -247,34 +247,7 @@ u16 total_slotnum,current_slotnum; extern int32_t offsettimeus; //u16 last_lpcount = 0; -void SetNextPollTime(u16 time) -{ - int32_t lpcount1,lptime1,target_time1; -int32_t last_lpcount1; -// if(current_slotnum>=total_slotnum) -// current_slotnum-=total_slotnum; -// -// target_time=((current_slotnum*g_com_map[COM_INTERVAL])+time)*1000; -// //if(target_time<90000) -// { -// lptime=target_time-offsettimeus; -// lpcount = lptime/LPTIMER_LSB; -// if(lpcount>LPTIMER_1S_COUNT) -// lpcount-=LPTIMER_1S_COUNT; -// if(lpcount<0) -// { -// lpcount+=LPTIMER_1S_COUNT; -// } - last_lpcount1=HAL_LPTIM_ReadCounter(&hlptim1); - lpcount1 = last_lpcount1+32.768*time; - while(lpcount1>LPTIMER_1S_COUNT) - { - lpcount1-=LPTIMER_1S_COUNT; - } -// last_lpcount = lpcount; - __HAL_LPTIM_COMPARE_SET(&hlptim1, lpcount1+32768); -} /* 返回ch字符在sign数组中的序号 */ int getIndexOfSigns(char ch) @@ -370,7 +343,7 @@ current_slotnum=1; // current_time=GetLPTime(); - if (HAL_LPTIM_TimeOut_Start_IT(&hlptim1, LPTIMER_1S_COUNT, 0) != HAL_OK) //system time is 1010ms 1 puls=30.518us +if (HAL_LPTIM_TimeOut_Start_IT(&hlptim1, LPTIMER_1S_COUNT, 0) != HAL_OK) //system time is 1010ms 1 puls=30.518us { Error_Handler(); } @@ -478,29 +451,6 @@ uint8_t lora_tx_flag; uint8_t lora_txanchor_power_flag; -u8 lora_seq_nb1; -static uint8_t send_frame1[EUART_RX_BUF_SIZE]; -uint8_t data_length1; -void LoraSendComMap(uint8_t data_length, uint8_t index) -{ - uint16_t checksum = 0; - send_frame1[0] = 0x55; - send_frame1[1] = 0xAA; - send_frame1[2] = 0x39; - send_frame1[3] = data_length+5; - send_frame1[4] = 3; - send_frame1[5] = index; - send_frame1[6] = data_length; - memcpy(&send_frame1[7], &g_com_map[index], data_length); - for(int i = 0; i<(data_length+5); i++) - { - checksum += send_frame1[2+i]; - } - checksum = Checksum_u16(&send_frame1[2],5+data_length); - memcpy(&send_frame1[7+data_length],&checksum,2); - data_length1=data_length+9; -// UART_PushFrame(send_frame1, data_length+9); -} extern uint8_t GPSchangdu; uint8_t no_yingdaflag; extern uint8_t GPS_GGAdate[200]; @@ -602,8 +552,8 @@ if(yuyin_sendflag) { yuyin_sendflag=0; - SYN_FrameInfo(0,yuyin_yinliang);//设置音量等级V10 - delay_ms(10); + // SYN_FrameInfo(0,yuyin_yinliang);//设置音量等级V10 + // delay_ms(10); SYN_FrameInfo(0,xiafayuyin_data); //播放内容 // HAL_UART_Receive_IT(&huart6, &Get_Uart6_data, 1); memset(xiafayuyin_data,0,sizeof(xiafayuyin_data)); @@ -1287,45 +1237,12 @@ { // uint8_t pinlv; SystemClock_Config(); + uwbled = BLUE; Set4LEDColor(uwbled,gpsled,loraled,powerled); LoraReportPoll(); - lp_time++; - - no_data_chongqi_num++; - stationary_num++; - flag_onesecond = 1; - if(no_yingdaflag==1) - { - no_yingdatime++; - if(no_yingdatime>=5) - { - no_yingdaflag=0; - no_yingdatime=0; - } - } - - if( no_data_chongqi_num>600) - {NVIC_SystemReset();} - SetNextPollTime(0); - - if(lp_time%(g_com_map[COM_INTERVAL]/1000)==0) - { - lora_txanchor_power_flag=0; - } - - if(stationary_num>=30) - {stationary_num=0; - stationary_flag=1; - } - yuyinzidongguan_time++; - if(yuyinzidongguan_time>10) - { - yuyinzidongguan_time=0; - HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); - HAL_GPIO_WritePin(GPIOC, GPIO_PIN_12, GPIO_PIN_RESET); - yuyin_no_sleep_flag=0; - } + uwbled = LEDOFF; + Set4LEDColor(uwbled,gpsled,loraled,powerled); } /* USER CODE END 4 */ -- Gitblit v1.9.3