| | |
| | | uint16_t lastpoll_count,interval_count,slot_startcount,tag_frequency,lastpoll_time,current_time; |
| | | extern uint8_t module_power; |
| | | extern float nomove_count; |
| | | float motor_keeptime; |
| | | uint8_t imu_enable,motor_enable; |
| | | u16 GetLPTime(void) |
| | | { |
| | |
| | | Error_Handler(); |
| | | } |
| | | } |
| | | u16 current_time; |
| | | uint8_t state5v; |
| | | void IdleTask(void) |
| | | {u16 current_time; |
| | | { |
| | | |
| | | UART_CheckReceive(); |
| | | UART_CheckSend(); |
| | |
| | | //motor_state=2; |
| | | if(g_com_map[MOTOR_ENABLE]) |
| | | { |
| | | if(motor_keeptime>0) |
| | | { |
| | | motor_state = 2; |
| | | }else{ |
| | | motor_state = 0; |
| | | } |
| | | switch(motor_state) |
| | | {case 0: |
| | | MOTOR_OFF; |
| | |
| | | Usart1ParseDataCallback = UsartParseDataHandler; |
| | | parameter_init(); |
| | | //deca_sleep(1000); |
| | | g_com_map[VERSION] = 0x0212; |
| | | g_com_map[VERSION] = 0x0213; |
| | | // g_com_map[DEV_ID]=0x11; |
| | | #ifdef DEBUG_MODE |
| | | // g_com_map[DEV_ROLE]=1; |
| | |
| | | { |
| | | waitusart_timer--; |
| | | } |
| | | if(m_bEUARTTxEn==0&&waitusart_timer==0) |
| | | if(m_bEUARTTxEn==0&&waitusart_timer==0&&(motor_state==0||motor_state==3)) |
| | | { |
| | | #ifndef DEBUG_MODE |
| | | if(!HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)) |
| | |
| | | } |
| | | extern u16 tagslotpos; |
| | | extern uint8_t tx_near_msg[80],stationary_flag,gotosleep_flag; |
| | | float key_keeptime,motor_keeptime; |
| | | float key_keeptime; |
| | | extern float motor_ontime; |
| | | void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim) |
| | | { |
| | |
| | | nomove_count+=(float)g_com_map[COM_INTERVAL]/1000; |
| | | if(motor_keeptime>0) |
| | | { |
| | | motor_state = 2; |
| | | motor_keeptime-=(float)g_com_map[COM_INTERVAL]/1000; |
| | | }else{ |
| | | motor_state = 0; |
| | | } |
| | | if(active_flag==0) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | if(motor_ontime>0) |
| | | { |
| | | motor_ontime-=(float)1/tag_frequency; |
| | | motor_state = 2; |
| | | }else{ |
| | | motor_state = 0; |
| | | } |
| | | |
| | | if(!GET_USERKEY) |
| | | { |
| | | key_keeptime+=(float)g_com_map[COM_INTERVAL]/1000; |