| | |
| | | uint16_t vel_factor,pos_factor; |
| | | |
| | | extern u8 module_power; |
| | | u16 slottime,max_slotnum,current_slotpos; |
| | | u16 slottime,max_slotnum,current_slotpos,dist_threshold; |
| | | void Program_Init(void) |
| | | {uint16_t i; |
| | | float temp; |
| | |
| | | group_id=g_com_map[GROUP_ID]; |
| | | vel_factor=g_com_map[FILTER_COEFFICIENT]; |
| | | pos_factor=g_com_map[FILTER_COEFFICIENT]; |
| | | dist_threshold = (g_com_map[SPEEDFILTER_THRES]*10)/(1000/g_com_map[COM_INTERVAL]); |
| | | if(dist_threshold<300) |
| | | {dist_threshold = 300;} |
| | | if(dist_threshold>15000) |
| | | {dist_threshold = 15000;} |
| | | if(dev_id==0) |
| | | sync_mainbase=1; |
| | | module_power = g_com_map[POWER]; |
| | |
| | | { |
| | | module_power=67; |
| | | } |
| | | g_com_map[VERSION] = 0x0123; |
| | | g_com_map[VERSION] = 0x0127; |
| | | temp=(float)g_com_map[MAX_REPORT_ANC_NUM]*4/3; |
| | | temp2=g_com_map[MAX_REPORT_ANC_NUM]*4/3; |
| | | if(temp2<temp) |
| | |
| | | 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]); |