| | |
| | | max_slotnum=g_com_map[COM_INTERVAL]/temp2; |
| | | current_slotpos=g_com_map[DEV_ID]; |
| | | tyncpoll_time=(current_slotpos%max_slotnum)*slottime; |
| | | if(g_com_map[DEV_ROLE]) |
| | | { |
| | | printf("æ ç¾ID: %d .\r\n",dev_id); |
| | | printf("é讯é´é: %d ms.\r\n",g_com_map[COM_INTERVAL]); |
| | | printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | }else{ |
| | | anchor_type = dev_id%g_com_map[MAX_REPORT_ANC_NUM]; |
| | | printf("åºç«ID: %x .\r\n",dev_id); |
| | | printf("åºç«ç±»å: %c .\r\n",anchor_type+0x41); |
| | | printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | } |
| | | // if(g_com_map[DEV_ROLE]) |
| | | // { |
| | | // printf("æ ç¾ID: %d .\r\n",dev_id); |
| | | // printf("é讯é´é: %d ms.\r\n",g_com_map[COM_INTERVAL]); |
| | | // printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | // }else{ |
| | | // anchor_type = dev_id%g_com_map[MAX_REPORT_ANC_NUM]; |
| | | // printf("åºç«ID: %x .\r\n",dev_id); |
| | | // printf("åºç«ç±»å: %c .\r\n",anchor_type+0x41); |
| | | // printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | // } |
| | | OUT485_DISABLE; |
| | | // printf("DEVICE PAIRID: %d .\r\n",g_com_map[PAIR_ID]); |
| | | // printf("DEVICE ALARM DISTANCE: 1.%d 2.%d 3.%d .\r\n",g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],g_com_map[ALARM_DISTANCE3]); |
| | |
| | | |
| | | Device_Init(); |
| | | Program_Init(); |
| | | Dw1000_Init(); |
| | | delay_ms(10); |
| | | Dw1000_App_Init(); |
| | | /* Loop forever initiating ranging exchanges. */ |
| | | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); |
| | | usart_send[0]=0x55; |
| | | usart_send[1]=0xAA; |
| | | Modbus_RegMap(); |
| | | printf("è¾åºæ°ç»ï¼1 1 2 3 5 8 13 21.....å°1000ä½"); |
| | | while(1) |
| | | { |
| | | if(g_com_map[0] != 0x55AA) |
| | | { |
| | | while(1) |
| | | IdleTask(); |
| | | } |
| | | if(g_start_send_flag) |
| | | { |
| | | g_start_send_flag = 0; |
| | | temp=dwt_readtempvbat(1); |
| | | dw_vbat=(float)((temp&0xff)-173)/173+3.3; |
| | | if(dw_vbat>2.8) |
| | | Tag_App(); |
| | | }//else{ |
| | | IdleTask(); |
| | | // } |
| | | // |
| | | if(g_com_map[DEV_ROLE]==0) |
| | | Anchor_App(); |
| | | |
| | | |
| | | |
| | | } |