| | |
| | | uint8_t uwb_active_flag = 0; |
| | | u8 active_flag=0; |
| | | u16 nomovesleep_time=0,interval; |
| | | void UpdateFreq(u16 time) |
| | | { |
| | | g_com_map[COM_INTERVAL] = time; |
| | | tag_frequency = 1000/time; |
| | | bigslot_num = TOTAL_SLOTNUM/tag_frequency; |
| | | } |
| | | void Program_Init(void) |
| | | { float temp; |
| | | uint16_t temp2; |
| | |
| | | tyncpoll_time=(g_com_map[DEV_ID]%max_slotpos)*slottime; |
| | | slot_startcount=tyncpoll_time*1000/LPTIMER_LSB; |
| | | lastpoll_time=tyncpoll_time; |
| | | |
| | | bigslot_num = TOTAL_SLOTNUM/tag_frequency; |
| | | current_slotnum=1; |
| | | current_time=GetLPTime(); |
| | | nomovesleep_time = g_com_map[NOMOVESLEEP_TIME]; |
| | |
| | | motor_enable=0; |
| | | } |
| | | tag_frequency = 1000/interval; |
| | | bigslot_num = TOTAL_SLOTNUM/tag_frequency; |
| | | if (HAL_LPTIM_TimeOut_Start_IT(&hlptim1, LPTIMER_1S_COUNT, slot_startcount) != HAL_OK) //system time is 1010ms 1 puls=30.518us |
| | | { |
| | | Error_Handler(); |
| | |
| | | if(nomove_count>g_com_map[STATIONARY_TIME]) |
| | | { |
| | | stationary_flag = 1; |
| | | UpdateFreq(1000); |
| | | if(tagslotpos<10) |
| | | { |
| | | tagslotpos=HAL_LPTIM_ReadCounter(&hlptim1)%200; |
| | | } |
| | | }else{ |
| | | stationary_flag = 0; |
| | | UpdateFreq(50); |
| | | if(tagslotpos>=10) |
| | | { |
| | | tagslotpos=HAL_LPTIM_ReadCounter(&hlptim1)%10; |
| | | } |
| | | } |
| | | if(nomove_count>=nomovesleep_time-1&&imu_enable) |
| | | { |