From 39842cc2707c7ceb890bd963d1d226cc7542bc91 Mon Sep 17 00:00:00 2001 From: zhangbo <zhangbo@qq.com> Date: 星期五, 16 五月 2025 17:47:05 +0800 Subject: [PATCH] 对比PCA9555的修改 --- keil/include/src/Radio/lora_1268.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/keil/include/src/Radio/lora_1268.c b/keil/include/src/Radio/lora_1268.c index 7cefa82..3997f6b 100644 --- a/keil/include/src/Radio/lora_1268.c +++ b/keil/include/src/Radio/lora_1268.c @@ -15,6 +15,7 @@ #include "HIDO_TypeDef.h" #include "PCA9555.h" #include "mk_misc.h" +//#include "lis3dh_driver.c" /********************************************结构体**************************************************************/ typedef enum { @@ -183,6 +184,10 @@ extern uint8_t stationary_flag; extern uint8_t SOS_KEY_STATE; uint32_t LORA_POLL_COUNT=0; +extern uint32_t step_count; +uint8_t step_count_rep; +//extern u16_m f_step; +extern uint8_t uwbled,gpsled,loraled,powerled; void LoraReportPoll(void) { // delay_ms(100); @@ -201,7 +206,7 @@ flag_getwgresp = 0; SwitchLoraSettings(wg_report_freq,REPORT_CHANNEL_SF,22); - + mir3da_get_step(); if(heatbeat_count++>HEATBEAT_UPDATE_TIME && WG_Connected == wg_state) //如果心跳包到达上传时间,并且网关处于链接状态,就上传心跳包 { heatbeat_count = 0; @@ -278,12 +283,18 @@ memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+1],&DMA_RXBuf_BT[0],BT_NUM*2+1); //基站ID memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+BT_NUM*2+2],&DMA_RXBuf_BT[1+BT_NUM*2],BT_NUM*2);//基站距离 lora_sendbuffer[MSG_LENGTH] = LORA_RETRANSNUSSION_BT+4*BT_NUM+2; + + if(step_count < 0) + step_count=0; +// lora_sendbuffer[STEP_COUNT] = (uint8_t)(step_count % 256); + // } // if(lora_sendbuffer[LORA_RETRANSNUSSION_BT]==0x2D) // { checksum = Checksum_u16(lora_sendbuffer,4*BT_NUM+4*report_ancnum+BT_ANCID_IDX+3); memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+BT_NUM*4+2],&checksum,2); BT_SEND_flag=BT_ANCID_IDX+report_ancnum*4+BT_NUM*4+5; + Radio.Send(lora_sendbuffer,BT_SEND_flag); LORA_POLL_COUNT++; // LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+4,0); @@ -300,7 +311,7 @@ memset(DMA_RXBuf_BT, 0,200); memset(&lora_sendbuffer[ANCID_IDX],0,200); //LED_TB_ON; - LORA_LED_ON; + loraled=1; for(uint8_t i=0;i<3;i++) recnum[i] = 0; @@ -314,7 +325,7 @@ //uint16_t rec_value,rec_delaytime,rx_count,datalen_offset; uint8_t shengji_flag,time=5; -extern uint32_t uwbled,gpsled,loraled,powerled; +//extern uint32_t uwbled,gpsled,loraled,powerled; extern struct RxDoneMsg RxDoneParams; //extern uint8_t Lora_tx_ancnum; @@ -442,7 +453,7 @@ else { Radio.Rx( 50 ); - LORA_LED_OFF; + } } #define BUFFER_SIZE 255 // Define the payload size here @@ -543,7 +554,7 @@ // } // if(abs(sleep_time_count_LAST-sleep_time_count)>2000||REV_WG_pack==1) // { - sleep_timer_start(sleep_time_count); +// sleep_timer_start(sleep_time_count); time_count++; // } break; -- Gitblit v1.9.3