| | |
| | | lora_sendbuffer[HB_LORAPOWER_IDX] = g_com_map[LORA_POWER];//将距离校准改为了TX发射功率设置 |
| | | checksum = Checksum_u16(lora_sendbuffer,14); |
| | | memcpy(&lora_sendbuffer[14],&checksum,2); |
| | | // Radio.Send(lora_sendbuffer,16); |
| | | Radio.Send(lora_sendbuffer,16); |
| | | |
| | | /*****************************心跳包上传内容*************************************/ |
| | | |
| | | } |
| | | #define HEATBEAT_UPDATE_TIME 100 |
| | | #define HEATBEAT_UPDATE_TIME 20 |
| | | uint16_t heatbeat_count = HEATBEAT_UPDATE_TIME-1 ; |
| | | uint16_t flag_getwgresp = 0; |
| | | int16_t intheight; //气压 |
| | |
| | | checksum = Checksum_u16(lora_sendbuffer,11+data_length); |
| | | memcpy(&lora_sendbuffer[11+data_length],&checksum,2); |
| | | // LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+13,0); |
| | | // Radio.Send(lora_sendbuffer,data_length+13); |
| | | Radio.Send(lora_sendbuffer,data_length+13); |
| | | //++; |
| | | // Delay_Ms(100); |
| | | } |
| | |
| | | memcpy(&lora_sendbuffer[7], &g_com_map[index/2], data_length); |
| | | checksum = Checksum_u16(lora_sendbuffer,9+data_length); |
| | | memcpy(&lora_sendbuffer[9+data_length],&checksum,2); |
| | | // Radio.Send(lora_sendbuffer,data_length+11); |
| | | Radio.Send(lora_sendbuffer,data_length+11); |
| | | |
| | | // LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+11,0); |
| | | //LORA_3029_SINGLE_SEND(lora_sendbuffer,data_length+11,0); |
| | | // Delay_Ms(100); |
| | | } |
| | | uint8_t t22[20],ti; |
| | |
| | | switch(RX_Buffer[PWTAG_RW_FLAG_IDX]) |
| | | { |
| | | case WGRSP_RWTAG_NONE: |
| | | REV_WG_pack++; |
| | | wg_report_freq = RX_Buffer[POLL_FREQ_IDX]+400; |
| | | memcpy(&rec_delaytime,&RX_Buffer[NEXTPOLL_TIME_IDX],2); |
| | | // REV_WG_pack++; |
| | | // wg_report_freq = RX_Buffer[POLL_FREQ_IDX]+400; |
| | | // memcpy(&rec_delaytime,&RX_Buffer[NEXTPOLL_TIME_IDX],2); |
| | | |
| | | if(report_ancnum<2) |
| | | { |
| | | datalen_offset = report_ancnum*85; |
| | | }else{ |
| | | datalen_offset = (report_ancnum-1)*46+85; |
| | | } |
| | | rec_secdelay = RX_Buffer[PWTAG_SECDELAY_IDX]; |
| | | if(BufferSize!=13||rec_secdelay>20) |
| | | { |
| | | rec_secdelay = 0; |
| | | } |
| | | if(rec_delaytime<500) |
| | | { |
| | | int t; |
| | | t++; |
| | | } |
| | | // sleep_time_count =(__MS_TO_32K_CNT(rec_delaytime)/10)- delaytime-datalen_offset; |
| | | sleep_time_count =(__MS_TO_32K_CNT(rec_delaytime)/10); |
| | | while(sleep_time_count>=32768) |
| | | { |
| | | sleep_time_count-=32768; |
| | | } |
| | | while(sleep_time_count<2000) |
| | | { |
| | | sleep_time_count+=10000; |
| | | } |
| | | // if(report_ancnum<2) |
| | | // { |
| | | // datalen_offset = report_ancnum*85; |
| | | // }else{ |
| | | // datalen_offset = (report_ancnum-1)*46+85; |
| | | // } |
| | | // rec_secdelay = RX_Buffer[PWTAG_SECDELAY_IDX]; |
| | | // if(BufferSize!=13||rec_secdelay>20) |
| | | // { |
| | | // rec_secdelay = 0; |
| | | // } |
| | | // if(rec_delaytime<500) |
| | | // { |
| | | // int t; |
| | | // t++; |
| | | // } |
| | | //// sleep_time_count =(__MS_TO_32K_CNT(rec_delaytime)/10)- delaytime-datalen_offset; |
| | | // sleep_time_count =(__MS_TO_32K_CNT(rec_delaytime)/10); |
| | | // while(sleep_time_count>=32768) |
| | | // { |
| | | // sleep_time_count-=32768; |
| | | // } |
| | | // while(sleep_time_count<2000) |
| | | // { |
| | | // sleep_time_count+=10000; |
| | | // } |
| | | // if(REV_WG_pack==1) |
| | | // { |
| | | // sleep_time_count_LAST=sleep_time_count; |
| | | // } |
| | | // 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; |