| | |
| | | checksum = Checksum_u16(lora_sendbuffer,11+data_length); |
| | | memcpy(&lora_sendbuffer[11+data_length],&checksum,2); |
| | | Radio.Send(lora_sendbuffer,data_length+13); |
| | | Delay_Ms(60); |
| | | Delay_Ms(160); |
| | | } |
| | | void LoraRspWriteCommap(uint8_t index) |
| | | { |
| | |
| | | static double tof,distance; |
| | | #define SPEED_OF_LIGHT 299702547 |
| | | u16 count1,count2; |
| | | u16 uwbdistance; |
| | | static void CalculateDists(void) //计算距离 |
| | | { |
| | | for(int i=0;i<MAX_NEARBASE_NUM+10;i++) //因为增加了5个抢占位置,所以最终的计算是总数量+10.考虑实际抢占可能超过5个 |
| | |
| | | { |
| | | count2++; |
| | | taglist_dist[i+taglist_current_index] = distance*100+anc_distoffset[i]; |
| | | uwbdistance=taglist_dist[0]; |
| | | } |
| | | }else{ |
| | | // nearbase_distlist[i] = 0x1ffff; |
| | |
| | | dwt_starttx(DWT_START_TX_IMMEDIATE | DWT_RESPONSE_EXPECTED);//开启发送,发送完成后等待一段时间开启接收,等待时间在dwt_setrxaftertxdelay中设置 |
| | | if(Anchor_Vcc_Flag) |
| | | { |
| | | READC_Init(); |
| | | adc_val_min=0xffff; |
| | | verfint_cal = *(__IO uint16_t *)(0X1FF80078); |
| | | READC_Init(); |
| | | adc_val_min=0xffff; |
| | | verfint_cal = *(__IO uint16_t *)(0X1FF80078); |
| | | } |
| | | start_count=HAL_LPTIM_ReadCounter(&hlptim1); |
| | | poll_timeout=tag_num_tosend*SLOT_SCALE+20; //单位0.1ms |
| | |
| | | bat_volt = 3*(float)verfint_cal/AD_value[50]-0.28; |
| | | bat_percent=bat_volt*100-200; |
| | | } |
| | | #ifdef _USE_BAR_ |
| | | if(taglist_total_num>0) |
| | | { |
| | | GetPressAndHeight(); |
| | | intheight = Height*100; |
| | | intheight = Height*100; |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | |