| | |
| | | #define GET_USERKEY gpio_pin_get_val(SOS_PIN) |
| | | void LoraReportPoll(void) |
| | | { |
| | | //// // delay_ms(100); |
| | | |
| | | ////#ifdef _USE_BAR |
| | | //// GetPressAndHeight(); |
| | | //// intheight = Height*100; |
| | | ////#endif |
| | | ////#ifdef _SMT_TEST |
| | | //// printf("气压值:%d",intheight); |
| | | ////#endif |
| | | |
| | | ////// TagListUpdate(); |
| | | |
| | | //// LoraReportFreqPoll(); |
| | | //// flag_getwgresp = 0; |
| | | |
| | | // SwitchLoraSettings(478,REPORT_CHANNEL_SF,22); |
| | | |
| | | //// if(heatbeat_count++>HEATBEAT_UPDATE_TIME && WG_Connected == wg_state) //如果心跳包到达上传时间,并且网关处于链接状态,就上传心跳包 |
| | | //// { |
| | | //// heatbeat_count = 0; |
| | | //// LoraHeartBeartPoll(); |
| | | //// return; |
| | | //// } |
| | | //// for(uint16_t i=0; i<report_ancnum-1; i++) |
| | | //// { |
| | | //// for(uint16_t j=0; j<report_ancnum-1-i; j++) |
| | | //// { |
| | | //// if(report_ancdist[j]>report_ancdist[j+1]) |
| | | //// { |
| | | //// uint16_t id,dist; |
| | | //// uint8_t bat; |
| | | //// id = report_ancid[j]; |
| | | //// dist = report_ancdist[j]; |
| | | //// report_ancid[j] = report_ancid[j+1]; |
| | | //// report_ancdist[j] = report_ancdist[j+1]; |
| | | //// report_ancid[j+1] = id; |
| | | //// report_ancdist[j+1] = dist; |
| | | //// } |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// if(report_ancnum>LORA_REPORT_MAXANC_NUM) //考虑lora传输时间,最多发送10个基站数据。 |
| | | //// { |
| | | //// report_ancnum = LORA_REPORT_MAXANC_NUM; |
| | | //// } |
| | | //// |
| | | ////#ifdef USE_GPS |
| | | //// lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_GPS; |
| | | //// lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+30; |
| | | ////#else |
| | | //// BT_NUM=DMA_RXBuf_BT[0]; |
| | | //// if(SOS_KEY_STATE) |
| | | //// { |
| | | //// BT_NUM=0; |
| | | ////// } |
| | | //// lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG; |
| | | // lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_BT; |
| | | // //lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+4*BT_NUM+ANCID_IDX+3; |
| | | ////#endif |
| | | // memcpy(&lora_sendbuffer[SOURCE_ID_IDX],&g_com_map[DEV_ID],2); |
| | | // memcpy(&lora_sendbuffer[DEST_ID_IDX],&wg_report_id,2); |
| | | // lora_sendbuffer[SEQNUM_IDX] = seq_num++; |
| | | // lora_sendbuffer[BAT_IDX] = bat_percent; |
| | | //// lora_sendbuffer[STATE_IDX] = !GET_USERKEY|stationary_flag<<1; |
| | | //// //GET_USERKEY这个是那个lora——busy那个引脚 |
| | | ////// lora_sendbuffer[STATE_IDX]=0x01; |
| | | ////// lora_sendbuffer[GATEWAY_CHANL]=0x02; |
| | | ////// lora_sendbuffer[CHANL_NUM]=0x03; |
| | | //// |
| | | ////#ifdef USE_GPS |
| | | //// memcpy(&lora_sendbuffer[GPS_JINGDU_IDX],&gps_jingdu,8); |
| | | //// memcpy(&lora_sendbuffer[GPS_WEIDU_IDX],&gps_jingdu,8); |
| | | //// memcpy(&lora_sendbuffer[GPS_HEIGHT_IDX],&gps_height,8); |
| | | //// lora_sendbuffer[GPS_STATE_IDX] = gps_state; |
| | | //// lora_sendbuffer[GPS_SATEL_NUM_IDX] = gps_satel_num; |
| | | //// lora_sendbuffer[GPS_SPOWER_IDX] = gps_signalpower; |
| | | //// lora_sendbuffer[GPS_CHAFENLINGQI] = gps_chafenlingqi; |
| | | ////#endif |
| | | //// memcpy(&lora_sendbuffer[BAR_HEIGHT_IDX],&intheight,2); |
| | | //// lora_sendbuffer[BT_ANCID_IDX] = report_ancnum; |
| | | //// memcpy(&lora_sendbuffer[BT_ANCID_IDX+1],report_ancid,report_ancnum*2); |
| | | //// memcpy(&lora_sendbuffer[BT_ANCID_IDX+report_ancnum*2+1],report_ancdist,report_ancnum*2); |
| | | //// uint8_t LORA_RETRANSNUSSION_BT=0; |
| | | ////// |
| | | ////// num[0]=REV_RX_NUM; |
| | | ////// num[1]=REV_POLL_NUM; |
| | | ////// num[2]=REPLY_POLL_NUM; |
| | | //// LORA_RETRANSNUSSION_BT=BT_ANCID_IDX+report_ancnum*4+1; |
| | | //// lora_sendbuffer[LORA_RETRANSNUSSION_BT] = 0x2D; //蓝牙上传标识符 |
| | | |
| | | //// 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(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); |
| | | ////// } |
| | | ////// else |
| | | ////// { |
| | | ////// checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | ////// memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | | ////// Radio.Send(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+2); |
| | | ////// } |
| | | |
| | | |
| | | #ifdef _USE_BAR |
| | | GetPressAndHeight(); |
| | | intheight = Height*100; |
| | |
| | | switch(RX_Buffer[PWTAG_RW_FLAG_IDX]) |
| | | { |
| | | case WGRSP_RWTAG_NONE: |
| | | // REV_WG_pack++; |
| | | // wg_report_freq = RX_Buffer[POLL_FREQ_IDX]+400; |
| | | 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) |
| | |
| | | g_com_map[rec_index/2] = rec_value; |
| | | save_com_map_to_flash(); |
| | | LoraRspWriteCommap(SUBMSG_WRITE_ANCPARA); |
| | | //flag_writepara_needreset = 1; |
| | | flag_writepara_needreset = 1; |
| | | no_rx_flag = 1; |
| | | } |
| | | |