| | |
| | | } |
| | | u16 tyncpoll_time; |
| | | u16 slottime,max_slotpos; |
| | | extern u8 module_power; |
| | | void Program_Init(void) |
| | | { float temp; |
| | | u16 temp2; |
| | |
| | | slottime=ceil((double)g_com_map[MAX_REPORT_ANC_NUM]/4)+4; |
| | | max_slotpos=g_com_map[COM_INTERVAL]/slottime; |
| | | tyncpoll_time=(g_com_map[DEV_ID]%max_slotpos)*slottime; |
| | | module_power = g_com_map[POWER]; |
| | | if(module_power>67) |
| | | { |
| | | module_power=67; |
| | | } |
| | | |
| | | 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{ |
| | | |
| | | // 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]); |
| | | // } |
| | | 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]); |
| | |
| | | extern u16 ancidlist_rec[20],ancidlist_send[20]; |
| | | void IdleTask(void) |
| | | { |
| | | main_logic(); |
| | | |
| | | UART_CheckReceive(); |
| | | UART_CheckSend(); |
| | | if(heartbeat_timer>1000) |
| | |
| | | // Delay_ms(100); |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软å¤ä½åå°bootloader |
| | | } |
| | | if(g_com_map[CNT_REBOOT]==1) |
| | | { |
| | | g_com_map[CNT_REBOOT]=0; |
| | | g_com_map[MAP_SIGN_INDEX]=0; |
| | | save_com_map_to_flash(); |
| | | delay_ms(100); |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软å¤ä½åå°bootloader |
| | | } |
| | | if(g_com_map[CNT_RESTART]==1) |
| | | { |
| | | g_com_map[CNT_RESTART]=0; |
| | | save_com_map_to_flash(); |
| | | delay_ms(100); |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软å¤ä½åå°bootloader |
| | | } |
| | | |
| | | } |
| | | int main(void) |