| | |
| | | /*Enter the Standby mode*/ |
| | | HAL_PWR_EnterSTANDBYMode(); |
| | | } |
| | | extern u16 tagslotpos; |
| | | extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag,current_sync_sec,tagpoll_sync_sec; |
| | | |
| | | extern u16 tagslotpos,current_slotpos; |
| | | extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag,current_sync_sec,tagpoll_sync_sec,flag_tagnewpos; |
| | | float key_keeptime; |
| | | extern float motor_ontime; |
| | | extern uint16_t rec_tagperiod; |
| | | void GetRandomPos(void) |
| | | { |
| | | current_slotpos = HAL_LPTIM_ReadCounter(&hlptim1)%max_slotpos; //如果丢失连接超过5次就随机换个时间片 |
| | | tagpoll_sync_sec = current_slotpos/200; |
| | | tagslotpos = current_slotpos%200; |
| | | flag_tagnewpos = 0; |
| | | } |
| | | void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) |
| | | { |
| | | static uint8_t i=0; |
| | |
| | | |
| | | // current_slotnum++; |
| | | // SetNextPollTime(tagslotpos); |
| | | |
| | | if(current_slotpos>=max_slotpos) |
| | | { |
| | | GetRandomPos(); |
| | | } |
| | | if(current_sync_sec==tagpoll_sync_sec) |
| | | { |
| | | g_start_send_flag=1; |