yincheng.zhong
2023-05-25 b6edb254b755b782652684ac6c79b42ef9259192
Src/main.c
@@ -31,7 +31,7 @@
#define NSH1 0x0001
#define GP   0x0002
#define DEBUG_MODE
//#define DEBUG_MODE
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -137,6 +137,7 @@
u16 current_time;
float motor5s_timer=1000;
uint8_t state5v,motorskip_flag;
extern uint8_t outside_count;
void IdleTask(void)
{
   
@@ -158,22 +159,22 @@
    //motor_state = 1;
if(g_com_map[MOTOR_ENABLE])
{
    static u8 motor5s_state = 0,outside_count=0;
   static u8 motor5s_state = 0;
    if(motorskip_flag==0)
    {
        if(motor_state==2)
        { 
            outside_count =0;
            if(motor5s_state)
            {
                if(motor5s_timer>4)
                if(motor5s_timer>2)
                {
                    motor5s_timer = 0;
                    motor5s_state = 0;
                    JianXieMotorProcess();
                }
            }else{           
                if(motor5s_timer>300)
                if(motor5s_timer>30)
                {
                    motor5s_timer = 0;
                    motor5s_state = 1;
@@ -181,14 +182,14 @@
                } 
            }
        }else{
            if(outside_count++>3)
            if(outside_count>3&&motor5s_state)
            {
                motor5s_state = 1;
                motor5s_state = 0;
                motor5s_timer = 0;  
            }                
        }
    }else{
        if(motor5s_timer>7200)  //2个小时 7200
        if(motor5s_timer>7200)  //2??? 7200
        {
           motorskip_flag = 0;
           motor5s_timer = 1000; 
@@ -314,7 +315,7 @@
   hardware_pici= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2);
   hardware_type= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4);
   //deca_sleep(1000);
   g_com_map[VERSION] = (2<<8)|8;
   g_com_map[VERSION] = (2<<8)|14;
    
//   g_com_map[DEV_ID]=0x7;
#ifdef DEBUG_MODE
@@ -971,6 +972,7 @@
    tagslotpos = current_slotpos%200;
    flag_tagnewpos = 0;
}
uint16_t motorkeeptime_u16,last_motorkeep;
float lptimedelay=0;
void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim)
{
@@ -1002,6 +1004,12 @@
   if(motor_keeptime>0)
   {   
        motor_keeptime-=lptimedelay;
        motorkeeptime_u16 = motor_keeptime;
        if(motorkeeptime_u16%3==0&&motorkeeptime_u16!=last_motorkeep)
        {
            last_motorkeep=motorkeeptime_u16;
            JianXieMotorProcess();
        }
   }
    if(motor_keeptime<0)
    {motor_keeptime = 0;}