| | |
| | | #include "dw_app_anchor.h" |
| | | #include "HIDO_TypeDef.h" |
| | | #include "PCA9555.h" |
| | | #include "mk_misc.h" |
| | | /********************************************结构体**************************************************************/ |
| | | typedef enum |
| | | { |
| | |
| | | uint8_t BT_NUM=0; |
| | | extern uint16_t report_ancdist[ANC_MAX_NUM],report_ancid[ANC_MAX_NUM]; |
| | | extern uint8_t bat_percent; |
| | | extern uint16_t REV_RX_NUM; |
| | | extern uint16_t REV_POLL_NUM; |
| | | extern uint16_t REPLY_POLL_NUM; |
| | | uint16_t num[3]={0,0,0}; |
| | | void LoraReportPoll(void) |
| | | { |
| | | // delay_ms(100); |
| | |
| | | printf("气压值:%d",intheight); |
| | | #endif |
| | | |
| | | TagListUpdate(); |
| | | // TagListUpdate(); |
| | | |
| | | LoraReportFreqPoll(); |
| | | flag_getwgresp = 0; |
| | |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | uint8_t LORA_RETRANSNUSSION_BT=0; |
| | | BT_NUM=DMA_RXBuf_BT[0]; |
| | | num[0]=REV_RX_NUM; |
| | | num[1]=REV_POLL_NUM; |
| | | num[2]=REPLY_POLL_NUM; |
| | | // REV_RX_NUM=0; |
| | | // REV_POLL_NUM=0; |
| | | // REPLY_POLL_NUM=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],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);//基站距离 |
| | |
| | | |
| | | void OnRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ) |
| | | { |
| | | |
| | | |
| | | uint16_t checksum1; |
| | | BufferSize = size; |
| | | memcpy( RX_Buffer, payload, BufferSize ); |
| | |
| | | switch(RX_Buffer[PWTAG_RW_FLAG_IDX]) |
| | | { |
| | | case WGRSP_RWTAG_NONE: |
| | | // 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; |
| | | // } |
| | | // sleep_time_count = rec_delaytime - delaytime-datalen_offset; |
| | | // while(sleep_time_count>=1000) |
| | | // sleep_time_count-=1000; |
| | | 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; |
| | | } |
| | | sleep_time_count =(__MS_TO_32K_CNT(rec_delaytime)/10)- delaytime-datalen_offset; |
| | | while(sleep_time_count>=32768) |
| | | { |
| | | sleep_time_count-=32768; |
| | | } |
| | | // sleep_timer_start(sleep_time_count); |
| | | |
| | | break; |
| | | case WGRSP_RWTAG_READ: |
| | | no_rx_flag = 1; |