zhyinch
2020-12-25 3a1d007b19b92f62bbbb8f14cbbdb26a61ac05f5
Src/main.c
@@ -88,6 +88,7 @@
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)
{
@@ -104,9 +105,10 @@
    Error_Handler();
   }
}
u16 current_time;
uint8_t state5v;
void IdleTask(void)
{u16 current_time;
{
   
         UART_CheckReceive();
      UART_CheckSend();
@@ -125,6 +127,12 @@
   //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;
@@ -255,7 +263,7 @@
   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;
@@ -438,7 +446,7 @@
      {
         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))
@@ -830,7 +838,7 @@
}
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)
{
@@ -842,10 +850,7 @@
   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)
   {
@@ -881,13 +886,7 @@
   }
      
   }
   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;