zhunk 1 год назад
Родитель
Сommit
3e0274ec6b

+ 56 - 328
Application_cbd_apm32f1/applications/control.c

@@ -111,98 +111,7 @@ void ctr_turnv5(void)
     rt_pin_write(CLEAR_L,OFF);
     rt_thread_mdelay(300);
 }
-/**************************机器人********************************/
-void ctr_Motor_Robot(uint8_t status_ws)
-{
-    unsigned int close_timeout = 0;
-    unsigned int open_timeout = 0;
-    rt_pin_mode(LIMIT_OPEN, PIN_MODE_INPUT);
-    rt_pin_mode(LIMIT_CLOSE, PIN_MODE_INPUT);
-    rt_pin_mode(Motor_Power, PIN_MODE_OUTPUT);
-    rt_pin_mode(Motor_Direction_Button, PIN_MODE_INPUT);
-    rt_pin_mode(Motor_Direction_Ctr, PIN_MODE_OUTPUT);
-    rt_pin_write(Motor_Power,OFF);
-    rt_pin_write(Motor_Direction_Ctr,ON);
-    rt_pin_mode(CLEAR_R, PIN_MODE_OUTPUT);
-    rt_pin_mode(CLEAR_L, PIN_MODE_OUTPUT);
-    if(status_ws == ON)
-    {
-        //检测按键状态
-        while(rt_pin_read(Motor_Direction_Button)==1)
-        {
-            if(rt_pin_read(LIMIT_CLOSE)==1)
-            {
-                rt_pin_write(Motor_Direction_Ctr,ON);
-                close_timeout++;
-                //打开电机驱动器电源,默认关闭
-                rt_pin_write(Motor_Power,ON);
-                if(close_timeout==2)
-                {
-                    rt_pin_write(CLEAR_R,ON);
-                    rt_pin_write(CLEAR_L,OFF);
-                    rt_pin_write(Motor_Power,OFF);
-                    rt_thread_delay(20);
-                    rt_pin_write(Motor_Power,ON);
-                }
-                rt_thread_delay(20);
-                if(close_timeout>500)
-                {
-                    close_timeout = 600;
-                    rt_pin_write(Motor_Power,OFF);
-                    rt_pin_write(CLEAR_R,OFF);
-                    rt_pin_write(CLEAR_L,OFF);
-                }
-            }
-            else
-            {
-                close_timeout = 0;
-                rt_pin_write(Motor_Power,OFF);  //关闭驱动器电源
-                rt_pin_write(CLEAR_R,OFF);
-                rt_pin_write(CLEAR_L,OFF);
-            }
-            rt_thread_delay(20);
-        }
-        rt_pin_write(Motor_Power,OFF);
-        rt_thread_delay(1000*2);
-        while(rt_pin_read(Motor_Direction_Button)==0)
-        {
-            if(rt_pin_read(LIMIT_OPEN)==1)
-            {
-                open_timeout ++;
-                //打开电机驱动器电源,默认关闭
-                if(open_timeout==2){
-                    rt_pin_write(CLEAR_R,OFF);
-                    rt_pin_write(CLEAR_L,ON);
-                }
-                rt_pin_write(Motor_Power,ON);
-                rt_pin_write(Motor_Direction_Ctr,OFF);
-                if(open_timeout>500)
-                {
-                    open_timeout = 600;
-                    rt_pin_write(Motor_Power,OFF);
-                    rt_pin_write(CLEAR_R,OFF);
-                    rt_pin_write(CLEAR_L,OFF);
-                }
-                rt_thread_delay(20);
-            }
-            if(rt_pin_read(LIMIT_OPEN)==0)
-            {
-                open_timeout = 0;
-                rt_pin_write(Motor_Power,OFF);
-                rt_pin_write(CLEAR_R,OFF);
-                rt_pin_write(CLEAR_L,OFF);
-            }
 
-            rt_thread_delay(20);
-            close_timeout = 0;
-        }
-        open_timeout = 0;
-        close_timeout = 0;
-    }
-    else {
-        rt_pin_write(Motor_Power,OFF);
-    }
-}
 /*************************吸虫塔*********************************/
 //吸虫电机
 uint8_t ctr_Motor_xichong(uint8_t status_ws)
@@ -430,21 +339,34 @@ uint8_t ctr_cangmen_up(uint8_t status_up)
        device_status.ctr_up_motor = 0;
        rt_thread_delay(1000);
    }
+
    if(status_up==OPEN)
    {
        device_status.up_status = 1;
        rt_pin_write(Collect_fan_R,OFF);
        rt_pin_write(Collect_fan_L,OFF);
+#if PCB_V1 == 1
        rt_pin_write(Collect_fan_R,ON);
        rt_pin_write(Collect_fan_L,OFF);
+#else
+       rt_pin_write(Collect_fan_R,OFF);
+       rt_pin_write(Collect_fan_L,ON);
+#endif
    }
+
    if(status_up==CLOSE)
    {
        device_status.up_status = 0;
        rt_pin_write(Collect_fan_R,OFF);
        rt_pin_write(Collect_fan_L,OFF);
+#if PCB_V1 == 1
        rt_pin_write(Collect_fan_R,OFF);
        rt_pin_write(Collect_fan_L,ON);
+#else
+       rt_pin_write(Collect_fan_R,ON);
+       rt_pin_write(Collect_fan_L,OFF);
+#endif
+
    }
    return device_status.up_status;
 }
@@ -759,13 +681,9 @@ void ctr_Motor_Driver(uint8_t EN,uint8_t DIR,rt_uint32_t pwm,rt_uint32_t time_ou
     rt_pin_mode(LIMIT_DOWN, PIN_MODE_INPUT);
     rt_pin_mode(Motor_EN, PIN_MODE_OUTPUT);
     rt_pin_mode(Motor_DIR, PIN_MODE_OUTPUT);
-    if(EN==0)
-    {
-        rt_pin_write(Motor_Power,0);
-    }
-    else{
-        rt_pin_write(Motor_EN, EN);
-    }
+
+    rt_pin_write(Motor_EN, EN);
+
     rt_pin_write(Motor_DIR, DIR);
     beep_set(pwm, pwm/2);      //200kzh - 50%
     while(DIR==1&&rt_pin_read(LIMIT_DOWN)==1)
@@ -1476,10 +1394,6 @@ void ResetInit(void)
                return;
            }
 
-            #if 0//LAMP_EN == 0
-            ctr_Fan_PUT(OFF);
-            ctr_Fan_IN(OFF);
-            #endif
            if(device_status.version_type==4||device_status.version_type==41)
            {
                device_status.clear_status=1;
@@ -1581,29 +1495,6 @@ void Led_Check(uint8_t tp)
         }
     }
 }
-//出厂前自检 0-开机自检  1-屏幕或指令下发手动自检
-void HardWare_Check(uint8_t boot)
-{
-    if(boot==0&&device_status.version_type!=6)
-    {
-        //停止所有动作                                      -完成
-        HardWare_Init(boot);
-    }
-    else {
-        //停止所有动作
-        //读取记录待机功耗(实测大概70mA)
-        //(需减去屏幕的功耗大概120mA)
-        //动作上仓门,读取功率值保存
-        //动作下仓门,读取功率值保存
-        //动作清扫,读取功率值保存
-        //打开镇流器,读取功率值保存
-        //打开海康相机供电,读取功率值保存
-        //打开补光灯,读取功率值保存
-        //打开路由器/RTU供电,读取功率值保存
-        //打开加热,读取功率值保存
-    }
-
-}
 
 void WorkCheck(void)
 {
@@ -1903,18 +1794,6 @@ void WorkTask(void)
         device_status.work_done = 0;
         if(clt_time==0)
         {
-            #if 0
-            if(device_status.version_type==41&&atoi(device_status.power)<350)
-            {
-                LOG_W("相机电流不足!");
-                char *ctr_hk_p_warn = makeJson_Warn("电流不足", "相机");
-                DTU_Write("%s",ctr_hk_p_warn);
-                rt_free(ctr_hk_p_warn);
-            }
-            #endif
-            #if 0//LAMP_EN == 0
-            ctr_Fan_PUT(ON);
-            #endif
             DTU_Write("workstart.mp3");
             if(device_status.debug_ws==1)
             {
@@ -1949,19 +1828,6 @@ void WorkTask(void)
             ctr_lamp(ON,1);
         #endif
         LOG_I("打开灯管!!!");
-        #if 0
-        rt_thread_delay(2000);
-        if(atoi(device_status.power)<450)
-        {
-            LOG_I("Current is:%d",atoi(device_status.power));
-            if(atoi(device_status.power)>50&&atoi(device_status.power)<5000)        //过滤电流检测芯片损坏导致电流异常
-            {
-                char* lamp_err_warn = makeJson_Warn("电流不足", "灯管");
-                DTU_Write("%s",lamp_err_warn);
-                rt_free(lamp_err_warn);
-            }
-        }
-        #endif
         if(device_status.version_type!=5)
         {
             rt_thread_delay(1000);  //待灯管启动再往下执行,否则会触发电机过流
@@ -2063,6 +1929,7 @@ void WorkTask(void)
                     rt_thread_delay(1000);
                 }
             }
+            #if TG_MODULE == 0
             //6.打开下仓门
             if(device_status.rain_status==0)
             {
@@ -2072,6 +1939,7 @@ void WorkTask(void)
                 device_status.ctr_down_motor = 2;
                 device_status.ctr_up_motor = 2;
             }
+
             //待下仓门完全打开
             while(device_status.ctr_down_motor!=0)
             {
@@ -2089,6 +1957,17 @@ void WorkTask(void)
             //2022-04-12add:
              LOG_I("打开上仓门!!!");
              device_status.ctr_up_motor = 1;
+            #else
+            //打开下仓门
+             ctr_cangmen_down(OPEN);
+             while(1)
+             {
+                 if(rt_pin_read(CTR_UPC_LIMIT)==0)  break;
+                 rt_thread_delay(50);
+             }
+             ctr_cangmen_down(OFF);
+            #endif
+
             if(device_status.version_type==4||device_status.version_type==41)
             {
                 //震动
@@ -2096,15 +1975,34 @@ void WorkTask(void)
                 //补光&&拍照
                 LOG_I("拍照!!!");
                 device_status.photo_ws = 1;
-//                ctr_led(ON);
-//                HK_TakePhoto();
-//                //清扫
-//                device_status.clear_status=1;
-//                //清扫失效则使用震动
-//                //ctr_shake(ON, 100);
             }
+#if TG_MODULE == 1
+            while(device_status.photo_ws == 1)
+            {
+                rt_thread_delay(1000);
+                LOG_I("等待拍照完成...");
+            }
+            while(device_status.clear_status==1)
+            {
+                rt_thread_delay(1000);
+                LOG_I("等待清扫完成...");
+            }
+            device_status.ctr_down_motor =1;
+            //待下仓门完全打开
+            while(device_status.ctr_down_motor!=0)
+            {
+                rt_thread_delay(100);
+                rt_kprintf("等待下仓门打开!!!\n");
+            }
+            rt_thread_delay(2000);
+            device_status.photo_ws = 1;
+            //关闭下仓门
+            device_status.ctr_down_motor = 2;
+            device_status.ctr_up_motor = 1; //打开上仓门
+#endif
         }
    }
+
     if(device_status.bat_status == 1 || device_status.temp_status == 1 || device_status.rain_status==1 || device_status.ds==0)
     {
         LOG_I("-------------------not work--------------------");
@@ -2156,171 +2054,6 @@ void slidelock()
 }
 
 
-void motor_zero()
-{
-    rt_pin_mode(Motor_EN, PIN_MODE_OUTPUT); //使能电机驱动引脚   PB14
-    rt_pin_write(Motor_EN, ON);             //引脚输出高使能有效
-
-    rt_pin_mode(CTR_RO_LIMIT, PIN_MODE_OUTPUT);  //CCW  PB15 配置为输出模式
-    rt_pin_mode(CTR_RC_LIMIT, PIN_MODE_OUTPUT);  //CW   PC6  配置为输出模式
-
-    rt_thread_delay(300);
-
-    rt_thread_delay(300);
-
-    rt_pin_mode(Motor_Direction_Button, PIN_MODE_INPUT);   //GET_PIN(B,8)
-    rt_pin_write(CTR_RO_LIMIT, OFF);                   //CCW  back配置
-
-    uint32_t j;
-    for(j=0;j<3200;j++)                          //多配置1600个脉冲,保证肯定能归零;
-    {
-           rt_pin_write(CTR_RC_LIMIT, OFF);
-           rt_thread_delay(PULES);
-           rt_pin_write(CTR_RC_LIMIT, ON);
-           rt_thread_delay(PULES);
-           if( rt_pin_read(Motor_Direction_Button)==0)//判断得到限位信号
-           {
-               rt_thread_delay(5);
-               if( rt_pin_read(Motor_Direction_Button)==0)
-               {
-                   slidelock();
-                   break;
-               }
-           }
-    }
-     rt_thread_delay(300);
-}
-
-
-uint16_t ctr_xmove(uint32_t xdis,uint16_t pulse)
-{
-    //rt_kprintf("run here1");
-    uint32_t j;
-    uint32_t xtemp = 0;
-    xtemp = xdis;                                     //两个脉冲移动0.72度,轴方向上移动2um
-
-    rt_pin_mode(Motor_EN, PIN_MODE_OUTPUT);             //使能电机驱动引脚   PB14
-    rt_pin_write(Motor_EN, ON);                         //引脚输出高使能有效
-
-    rt_pin_mode(CTR_RO_LIMIT, PIN_MODE_OUTPUT);       //CCW  PB15 配置为输出模式
-    rt_pin_mode(CTR_RC_LIMIT, PIN_MODE_OUTPUT);       //CW   PC6  配置为输出模式
-
-
-    //rt_kprintf("run here2");
-    rt_pin_write(CTR_RO_LIMIT, OFF);             //CCW  置高
-    rt_thread_delay(300);
-
-    for(j=0;j<xtemp;j++)
-    {
-        //rt_kprintf("run here4");
-       if((j <= 0.1*xtemp))
-       {
-           //rt_kprintf("run here5");
-           //rt_kprintf("xtemp is %d",xtemp );
-            rt_pin_write(CTR_RC_LIMIT, OFF);
-            //rt_kprintf("run here10");
-            //rt_kprintf("pulse is %d",pulse);
-            //rt_thread_delay(1);  //前10%以线性加速运动
-            rt_hw_us_delay(pulse*(0.1*xtemp - j + 20)/20);  //前10%以线性加速运动
-            rt_pin_write(CTR_RC_LIMIT, ON);
-            //rt_kprintf("run here11");
-            //rt_thread_delay(1);
-            rt_hw_us_delay(pulse*(0.1*xtemp - j + 20)/20);
-            //rt_kprintf("run here9");
-       }
-       if((j >0.1*xtemp)&&(j <= 0.9*xtemp))
-       {
-           //rt_kprintf("run here6");
-             rt_pin_write(CTR_RC_LIMIT, OFF);
-             rt_hw_us_delay(pulse);
-             rt_pin_write(CTR_RC_LIMIT, ON);
-             rt_hw_us_delay(pulse);
-        }
-        if((j > 0.9*xtemp))
-        {
-            //rt_kprintf("run here7");
-             rt_pin_write(CTR_RC_LIMIT, OFF);
-             rt_hw_us_delay(pulse*(j-0.9*xtemp + 20)/20);  //后10%以线性减速运动
-             rt_pin_write(CTR_RC_LIMIT, ON);
-             rt_hw_us_delay(pulse*(j-0.9*xtemp + 20)/20);
-        }
-        //rt_kprintf("run here8");
-     }
-     slidelock();
-     return xdis;
- }
-
-/*
- * 灯管
- *
- * */
-void WorkTask_CB5(void)
-{
-    static int work_loop = 0;
-    while(device_status.work_status==1&&device_status.temp_status==0&&device_status.bat_status==0&&device_status.rain_status==0&&device_status.ds==1)
-    {
-        work_loop++;
-        device_status.work_done = 0;
-        //发送串口消息,通知yolo是被及相机采集模块启动,定期将模块的运行状态展示到屏幕上
-        if(work_loop%60==0||work_loop==1)
-        {
-            DTU_Write("{\"cmd\":\"workstart\"}");
-            //推杆电机1打开,导流板到落虫通道
-            device_status.ctr_up_motor = 1;
-            while(device_status.ctr_up_motor!=0)
-            {
-                rt_thread_delay(2000);
-                LOG_I("等待上仓门打开....");
-            }
-            //推杆电机2关闭,益虫仓门关闭
-            device_status.ctr_down_motor = 2;
-            while(device_status.ctr_down_motor!=0)
-            {
-                rt_thread_delay(2000);
-                LOG_I("等待益虫仓门打开....");
-            }
-            //打开86步进电机驱动器供电
-            ctr_Motor_Driver_Power(ON);
-            //风机启动
-            //打开灯管
-            ctr_lamp(ON,1);
-            //打开补光灯
-            ctr_led(ON);
-            //光栅启动
-            ctr_photo(ON);
-            //
-            pin_guangshan_bind();
-            pin_motor_86_bind();
-        }
-
-        rt_thread_delay(1000);
-    }
-    device_status.work_status = 0;
-    //工作结束
-    if(device_status.work_done==0&&device_status.work_status==0)
-    {
-        pin_guangshan_unbind();
-        pin_motor_86_unbind();
-        //打开推杆电机,益虫放生
-        device_status.ctr_down_motor = 1;
-        DTU_Write("{\"cmd\":\"workdone\"}");
-        ResetInit();
-    }
-    work_loop = 0;
-    while(device_status.work_status==0)
-    {
-        work_loop++;
-        LOG_I("WorkTask_CB5 sleeping......%d",work_loop);
-        if(work_loop>120)
-        {
-            work_loop = 0;
-            DTU_Write("{\"cmd\":\"workdone\"}");
-        }
-        rt_thread_delay(5000);
-    }
-
-}
-
 /* 入口函数-工作状态检测 */
 static void Work_status_thread_entry(void *parameter)
 {
@@ -2348,17 +2081,13 @@ static void Work_Loop_thread_entry(void *parameter)
 {
     rt_thread_delay(1000);
     ResetInit();
+    rt_pin_mode(CTR_UPC_LIMIT, PIN_MODE_INPUT);
     while(1)
     {
-        if(device_status.version_type!=5&&device_status.dtype==3)
+        if(device_status.dtype==3)
         {
             WorkTask();
         }
-
-        if(device_status.version_type==5)
-        {
-            WorkTask_CB5();
-        }
         rt_thread_delay(1000);
     }
 }
@@ -2667,7 +2396,6 @@ void alarm_app_router(void)
 }
 #endif
 
-MSH_CMD_EXPORT(HardWare_Check,HardWare_Check<ON|OFF>);
 MSH_CMD_EXPORT(ctr_lamp,ctr_lamp<ON|OFF>);
 MSH_CMD_EXPORT(ctr_Heat,ctr_Heat<ON|OFF>);
 MSH_CMD_EXPORT(ctr_clear,ctr_clear<ON|OFF>);

+ 4 - 12
Application_cbd_apm32f1/applications/control.h

@@ -17,11 +17,11 @@
 
 
 #define LAMP_EN          0             //李新3灯管:0关闭,1打开
-#define PCB_V1           0             //1-旧PCB,0-新PCB(模块化)
+#define PCB_V1           1             //1-旧PCB,0-新PCB(模块化)
 #define MATCH_DEVICE     0             //比赛设备
 #define SENSOR_EN        1             //温湿度:0关闭,1打开
 #define UART_TEST_EN     0             ///串口测试0-关闭,1-启用
-
+#define TG_MODULE        1             //推杆电机结构模块化控制
 #if MATCH_DEVICE == 1
 #define LAMP_CURRENT    600
 #else
@@ -33,7 +33,7 @@
     #define VERSION_HK_2000W    "1.3led.40(2000W)"       //水稻
 #else
     #define VERSION_HK          "2.5.41(HK)"            //4.0海康-1200W
-    #define VERSION_HK_2000W    "2.23.4(2000W)"         //4.0水稻
+    #define VERSION_HK_2000W    "2.24.4(2000W)"         //4.0水稻
 #endif
 
 #define VERSION_ZP          "1.45.1(ZP)"            //1.0转盘
@@ -289,15 +289,7 @@ void ctr_Petroleum_jelly(rt_uint32_t delay);        //凡士林
 #define FAN_I   GET_PIN(B,11)
 uint8_t ctr_Fan_IN(uint8_t status_ws);
 uint8_t ctr_Fan_PUT(uint8_t status_ws);
-/*******************************定制展厅机器人************************************/
-#define LIMIT_OPEN GET_PIN(B,8)
-#define LIMIT_CLOSE GET_PIN(B,5)
-#define Motor_Power GET_PIN(B,10)                       //电机驱动供电
-#define Motor_Direction_Button GET_PIN(B,9)             //IO输入,检测按键状态,用于控制方向
-#define Motor_Direction_Ctr GET_PIN(B,15)               //IO输出,控制电机运动方向
-#define EMS_Dir GET_PIN(B,14)
-void ctr_Motor_Robot(uint8_t status_ws);
-/***************************************************************/
+
 /***************************************************************/
 uint8_t ctr_Heat(uint8_t status_heat);          //加热
 uint8_t ctr_cangmen_up(uint8_t status_up);      //上仓门

+ 5 - 71
Application_cbd_apm32f1/applications/hmi.c

@@ -1371,6 +1371,7 @@ static void Ctr_Mortor_entry(void* parameter)
    //int current_t[200];
    /*孢子仪拍照数量*/
    rt_uint16_t photo_setup = 0;
+   rt_pin_mode(CTR_UPC_LIMIT, PIN_MODE_INPUT);
     while(1)
     {
         #if 1
@@ -1403,14 +1404,6 @@ static void Ctr_Mortor_entry(void* parameter)
             {
                 ctr_cangmen_up(OFF);
                 num_up_open = 200;
-//                bubblesort(current_t, 200);
-//                if(current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//                {
-//                    LOG_E("上仓门打开电机电流不足:%d!!!",current_t[199]);
-//                    char * ctr_cm_up_warn = makeJson_Warn("电流不足,打开", "上仓门电机");
-//                    DTU_Write("%s",ctr_cm_up_warn);
-//                    rt_free(ctr_cm_up_warn);
-//                }
             }
 //            else {
 //                LOG_D("上仓门打开电流:%d",current_t[num_up_open]);
@@ -1431,53 +1424,24 @@ static void Ctr_Mortor_entry(void* parameter)
             {
                 ctr_cangmen_up(OFF);
                 num_up_close= 200;
-//                bubblesort(current_t, 200);
-//                if(current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//                {
-//
-//                    LOG_E("上仓门电机电流不足!!!-%d",current_t[199]);
-//                    char * ctr_cm_up_warn = makeJson_Warn("电流不足,关闭", "上仓门电机");
-//                    DTU_Write("%s",ctr_cm_up_warn);
-//                    rt_free(ctr_cm_up_warn);
-//                }
             }
             //LOG_D("上仓门关闭电流:%d",current_t[num_up_close]);
         }
         if (device_status.ctr_down_motor == 1)
         {
-//            if(num_down_open==200&&device_status.clear_status==0&&device_status.work_status==1)
-//            {
-//                motor_current = atoi(device_status.power);
-//                LOG_D("下仓门待机电流:%d",motor_current);
-//            }
-//            if(num_down_open<200)
             ctr_cangmen_down(OPEN);
             num_down_open--;
 //            current_t[num_down_open] = atoi(device_status.power);
             //如果关闭仓门1S后检测不到电流增大,则判定为异常
-            if (num_down_open == 0)
+            if (num_down_open == 0)    //2025-07-07,增加限位检测
             {
                 ctr_cangmen_down(OFF);
                 num_down_open = 200;
-//                bubblesort(current_t, 200);
-//                if (current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//                {
-//                    LOG_E("下仓门电机电流不足!!!-%d",current_t[199]);
-//                    char * ctr_cm_down_warn = makeJson_Warn("电流不足,打开", "下仓门电机");
-//                    DTU_Write("%s",ctr_cm_down_warn);
-//                    rt_free(ctr_cm_down_warn);
-//                }
             }
 //            LOG_D("下仓门打开电流:%d",current_t[num_down_open]);
         }
         else if (device_status.ctr_down_motor == 2)
         {
-//            if(num_down_close==200&&device_status.clear_status==0&&device_status.work_status==1)
-//            {
-//                motor_current = atoi(device_status.power);
-//                LOG_D("下仓门待机电流:%d",motor_current);
-//            }
-//            if(num_down_close<200)
             ctr_cangmen_down(CLOSE);
             num_down_close--;
 //            current_t[num_down_close] = atoi(device_status.power);
@@ -1486,16 +1450,6 @@ static void Ctr_Mortor_entry(void* parameter)
             {
                ctr_cangmen_down(OFF);
                num_down_close = 200;
-//               bubblesort(current_t, 200);
-//               //如果关闭仓门5S后检测不到电流增大,则判定为异常
-//               if (current_t[199]-motor_current<100&&device_status.clear_status==0&&device_status.work_status==1&&motor_current!=0&&motor_current<5000)
-//               {
-//                   LOG_E("下仓门关闭电机电流不足!!!-%d",current_t[199]);
-//                   char * ctr_cm_down_warn = makeJson_Warn("电流不足,关闭", "下仓门电机");
-//                   DTU_Write("%s",ctr_cm_down_warn);
-//                   rt_free(ctr_cm_down_warn);
-//
-//               }
             }
 //            LOG_D("下仓门关闭电流:%d",current_t[num_down_close]);
         }
@@ -1607,17 +1561,6 @@ static void Ctr_Mortor_entry(void* parameter)
             device_status.run_sta = 0;
             ef_set_env_blob("run_sta", &device_status.run_sta, sizeof(device_status.run_sta));
          }
-        else if (device_status.autotakepic==10) {
-            hwtimer2_pwm3_output(1,500000,1,0);
-            //ctr_xmove(400,200);
-            device_status.autotakepic = 0;
-        }
-
-        else if (device_status.autotakepic==11) {
-            hwtimer2_pwm3_output(1,500000,1,1);
-            //ctr_xmove(400,200);
-            device_status.autotakepic = 0;
-        }
 
         if(device_status.fsl_sw==1)
         {
@@ -2136,7 +2079,7 @@ void Check_ParamConfig(void)
                 break;
             }
             #else
-            if(connect_num==180) //180
+            if(connect_num==10) //180
             {
                 device_status.timeSwitch = 0;
                 LOG_W("Time not set:%04d-%02d-%02d %02d:%02d:%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
@@ -2164,17 +2107,8 @@ void Check_ParamConfig(void)
         DTU_Write("%s",makeJson_Warn("turnon", "device_stm32"));
         rt_thread_delay(1000);
         dtu_send_data_start();
-        if(device_status.dtype!=7&&device_status.version_type!=30)
-        {
-            Workstatus_check();
-        }
-
-        /********************/
-        //工作流程
-        if(device_status.version_type!=30)
-        {
-            Work_Loop_Task();
-        }
+        Workstatus_check();
+        Work_Loop_Task();
 #if MATCH_DEVICE == 1
         //device_status.selfcheck_ws = 3;
 #endif

+ 2 - 42
Application_cbd_apm32f1/applications/sht30_collect.c

@@ -237,10 +237,6 @@ static void Power_ReadCheck(void *parameter)
         }
         if(atof(device_status.voltage)<22.0)    //小于22.0V,并且持续10S,欠压
         {
-            #if ROBOT_EN == 1
-            ctr_led(OFF);
-            HMI_WRITE("sleep=%d",1);
-            #endif
             bat_cnt++;
         }else if(atof(device_status.voltage)>=24.0)    //大于24.0V,解除欠压
         {
@@ -251,46 +247,10 @@ static void Power_ReadCheck(void *parameter)
             ctr_router(ON);               //打开路由器供电
         #endif
             ctr_photo(ON);                //打开相机供电
-        #if ROBOT_EN == 1
-            ctr_led(ON);        //打开补光灯
-            ctr_lamp(ON, 1);    //打开镇流器输出,用于24V转12V给相机供电
-            ctr_router(ON);
-            HMI_WRITE("sleep=%d",0);
-        #endif
         }
         //
-        if(device_status.dtype==7)
+        if(device_status.dtype==3)
         {
-            //箱体温度
-            RV = 10000 * (4096 - Read_Rain_Voltage()) / Read_Rain_Voltage();
-            if(TempCalculate(RV, 3950, 10000)-TempCalculate(RV, 3950, 10000)>10)
-            {
-                LOG_E("temp value err!!!!");
-            }
-            else
-            {
-                device_status.box_temp = TempCalculate(RV, 3950, 10000);
-                if(device_status.box_temp>160)
-                {
-                    device_status.box_temp = 25;
-                }
-            }
-            //培养仓温度
-            RV = 10000 * (4096 - Read_Light_Voltage()) / Read_Light_Voltage();
-            if(TempCalculate(RV, 3950, 10000)-TempCalculate(RV, 3950, 10000)>10)
-            {
-                LOG_E("temp value err!!!!");
-            }
-            else
-            {
-                device_status.pre_temp = TempCalculate(RV, 3950, 10000);
-                if(device_status.pre_temp>160)
-                {
-                    device_status.pre_temp = 25;
-                }
-            }
-        }
-        else {
             RV = 10000 * (4096 - Read_Ntc_Voltage()) / Read_Ntc_Voltage();
             if(TempCalculate(RV, 3950, 10000)-TempCalculate(RV, 3950, 10000)>10)
             {
@@ -463,7 +423,7 @@ int Read_Light_Voltage(void)
        adc10_rain = rt_adc_read(adc_dev,ADC_DEV_CHANNLE_2);
        rt_adc_disable(adc_dev, ADC_DEV_CHANNLE_2);
        HAL_ADCEx_Calibration_Start(adc_dev->parent.user_data);
-       LOG_I("read light value:%d",adc10_rain);
+       //LOG_I("read light value:%d",adc10_rain);
        return adc10_rain;
 }
 //获取内部温度传感器值

+ 3 - 0
Application_cbd_apm32f1/readme.md

@@ -1,3 +1,6 @@
+#define VERSION_HK_2000W    "2.24.4(2000W)"         //4.0水稻
+ 2025-07-07
+ 上仓门打开和关闭的方向调整
 # 2025-06-28 更新说明
 针对比赛设备:
    定时开关路由器供电可通过屏幕震动  开启;