| | |
| | | extern uint8_t DMA_RXBuf_BT[200]; |
| | | extern uint8_t report_ancnum; |
| | | extern uint8_t report_ancnum_bt; |
| | | uint32_t BT_SEND_flag=0; |
| | | uint8_t BT_NUM=0; |
| | | void LoraReportPoll(void) |
| | | { |
| | | // delay_ms(100); |
| | |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | uint8_t LORA_RETRANSNUSSION_BT=0; |
| | | if(0<report_ancnum_bt&&report_ancnum_bt<11) |
| | | BT_NUM=DMA_RXBuf_BT[0]; |
| | | if(0<BT_NUM&&BT_NUM<11) |
| | | { |
| | | lora_sendbuffer[MSG_TYPE_IDX] = LORA_MSGTYPE_TAGMSGTOWG_BT; |
| | | LORA_RETRANSNUSSION_BT=ANCID_IDX+report_ancnum*4; |
| | | //LORA_RETRANSNUSSION_BT report_ancnum_bt |
| | | lora_sendbuffer[LORA_RETRANSNUSSION_BT] = 0x2D; //蓝牙上传标识符 |
| | | memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+1],&DMA_RXBuf_BT[0],report_ancnum_bt*2+1); //基站ID |
| | | memcpy(&lora_sendbuffer[LORA_RETRANSNUSSION_BT+report_ancnum_bt*2+2],&DMA_RXBuf_BT[1+report_ancnum_bt*2],report_ancnum_bt*2);//基站距离 |
| | | lora_sendbuffer[MSG_LENGTH] = 4*report_ancnum+4*report_ancnum_bt+ANCID_IDX+4; |
| | | 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] = 4*report_ancnum+4*BT_NUM+ANCID_IDX+2; |
| | | } |
| | | if(lora_sendbuffer[LORA_RETRANSNUSSION_BT]==0x2D) |
| | | { |
| | | checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum_bt+4*report_ancnum+ANCID_IDX+2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum_bt*4+report_ancnum*4+2],&checksum,2); |
| | | checksum = Checksum_u16(lora_sendbuffer,4*BT_NUM+4*report_ancnum+ANCID_IDX+2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+BT_NUM*4+report_ancnum*4+2],&checksum,2); |
| | | BT_SEND_flag++; |
| | | } |
| | | else |
| | | { |
| | | checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | | } |
| | | //rf_enter_continous_tx(); |
| | | // LORA_3029_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+2); |
| | | LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+report_ancnum_bt*4+4,0); |
| | | |
| | | |
| | | LORA_3029_SINGLE_SEND(lora_sendbuffer,ANCID_IDX+report_ancnum*4+BT_NUM*4+4,0); |
| | | memset(DMA_RXBuf_BT, 0,200); |
| | | memset(&lora_sendbuffer[ANCID_IDX],0,200); |
| | | // rf_single_tx_data(lora_sendbuffer,ANCID_IDX+report_ancnum*4+2,2); |
| | | //rf_enter_continous_rx(); |
| | | |
| | | //LED_TB_ON; |
| | | // bat_percent=Get_Battary(); |
| | | |
| | | |
| | | for(uint8_t i=0;i<3;i++) |
| | | recnum[i] = 0; |