| | |
| | | wg_state_enum wg_state = WG_Lost; |
| | | uint8_t lora_sendbuffer[200]; |
| | | u8 seq_num; |
| | | extern u8 wg_lost_count; |
| | | extern u32 wg_lost_count; |
| | | uint16_t wg_report_freq,wg_report_id; |
| | | #define WG_LOST_SWITCH_THRES 5 |
| | | #define WG_LOST_NOUWB_COUNT 60 |
| | |
| | | } |
| | | } |
| | | } |
| | | lora_sendbuffer[BAT_IDX] = group_mindist_index;//测距基站数量 |
| | | |
| | | if(report_ancnum>LORA_REPORT_MAXANC_NUM) //考虑lora传输时间,最多发送10个基站数据。 |
| | | report_ancnum = LORA_REPORT_MAXANC_NUM; |
| | | #ifdef USE_GPS |
| | |
| | | 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[BAT_IDX] = bat_percent; |
| | | lora_sendbuffer[STATE_IDX] = !GET_USERKEY|stationary_flag<<1; |
| | | #ifdef USE_GPS |
| | | memcpy(&lora_sendbuffer[GPS_JINGDU_IDX],&gps_jingdu,8); |
| | |
| | | lora_sendbuffer[GPS_CHAFENLINGQI] = gps_chafenlingqi; |
| | | #endif |
| | | // memcpy(&lora_sendbuffer[BAR_HEIGHT_IDX],&bar_height,2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],recnum,6); |
| | | report_ancnum+=3; |
| | | |
| | | lora_sendbuffer[ANCNUM_IDX] = report_ancnum; |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,(report_ancnum-3)*2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX],report_ancid,report_ancnum*2); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*2],report_ancdist,report_ancnum*2); |
| | | checksum = Checksum_u16(lora_sendbuffer,4*report_ancnum+ANCID_IDX); |
| | | memcpy(&lora_sendbuffer[ANCID_IDX+report_ancnum*4],&checksum,2); |
| | |
| | | { |
| | | Lora_send_flag=0; |
| | | #ifdef GROUPID_SWITCH |
| | | // if(rec_secdelay>0) |
| | | // { |
| | | // rec_secdelay--; |
| | | if(rec_secdelay>0) |
| | | { |
| | | rec_secdelay--; |
| | | // if(lora_jianting_flag) |
| | | // { |
| | | // if(++group_id>GROUP_NUM) |
| | |
| | | // SwitchLoraSettings(UWB_CHANNEL_FRQ+group_id,UWB_CHANNEL_SF,0); |
| | | // Radio.Rx(0); |
| | | // } |
| | | // return; |
| | | // } |
| | | return; |
| | | } |
| | | // //找3个小组中最近距离最大的小组,上传报文后切换到这个小组,因为上传报文会时间占用。 |
| | | // if(group_min_dist[1]>group_min_dist[2]) //如果1大于2 |
| | | // { |