zhunk 5 месяцев назад
Родитель
Сommit
ec6e438a2a

+ 1 - 1
Application_CBD/.settings/language.settings.xml

@@ -5,7 +5,7 @@
 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1274641908815502334" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-411634754427827492" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT ARM Cross GCC Built-in Compiler Settings " parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
 				<language-scope id="org.eclipse.cdt.core.gcc"/>
 				<language-scope id="org.eclipse.cdt.core.g++"/>
 			</provider>

+ 65 - 210
Application_CBD/applications/control.c

@@ -1495,18 +1495,44 @@ void ctr_TG_Clear(uint16_t clear_timeout)
     HMI_WRITE("cangWei.rotateFlag.val=%d",0);
     HMI_WRITE("sysTest.switchClear.val=%d",0);
 }
-//DTU,RTU供电
+
+// 全局静态变量,保存上次关闭的 tick
+static rt_uint32_t s_last_off_tick = 0;
+
 void ctr_RTU_DTU(uint8_t status_rtu)
 {
+    // 1. 先设置引脚模式(只需要设置一次即可,放这里也兼容多次调用)
     rt_pin_mode(RTU_DTU, PIN_MODE_OUTPUT);
-    if(status_rtu==ON)
+
+    if (status_rtu == ON)
     {
-        rt_pin_write(RTU_DTU,ON);
+        // 开机逻辑:必须满足冷却时间才能开机
+        rt_uint32_t current_tick = rt_tick_get();
+        rt_uint32_t cool_ticks = 30 * RT_TICK_PER_SECOND; // 30秒
+        if (s_last_off_tick != 0)
+        {
+            rt_uint32_t diff_tick = current_tick - s_last_off_tick;
+            if (diff_tick < cool_ticks)
+            {
+                // 未冷却完成,计算剩余时间
+                rt_uint32_t wait_ticks = cool_ticks - diff_tick;
+                rt_uint32_t wait_ms   = wait_ticks * (1000 / RT_TICK_PER_SECOND);
+                LOG_W("RTU电源关闭后需等待 %d ms 冷却, 禁止开机", wait_ms);
+                // 阻塞等待冷却(如果不允许阻塞,就直接return,不要delay)
+                rt_thread_delay(wait_ticks);
+            }
+        }
+        // 冷却完成,执行开机
+        rt_pin_write(RTU_DTU, ON);
+        s_last_off_tick = 0; // 清除关机时间
+        LOG_W("RTU电源启动!!!");
     }
     else
     {
-        LOG_W("RTU电源复位!!!");
-        rt_pin_write(RTU_DTU,OFF);
+        // 关机逻辑:记录关机时刻tick
+        rt_pin_write(RTU_DTU, OFF);
+        s_last_off_tick = rt_tick_get();
+        LOG_W("RTU电源关闭:%d",s_last_off_tick);
     }
 }
 //海康拍照
@@ -1727,7 +1753,6 @@ void ResetInit(void)
            if(device_status.power_status==1)
            {
                ctr_router(ON);
-               ctr_RTU_DTU(ON);
                //2.打开相机供电
                ctr_photo(ON);
            }
@@ -1909,199 +1934,7 @@ void HardWare_Check(uint8_t boot)
     }
 
 }
-#if 0
-//工作状态检测
-void WorkCheck(void)
-{
-    static rt_uint32_t light_timeout = 3600;
-    //雨控检测,温控检测,电池电压检测
-    while(device_status.ds==1&&device_status.rain_status==0&&device_status.temp_status==0&&device_status.bat_status==0)
-    {
-        //工作模式检测(RTC时间正常,1-时控/0-光控)(RTC时间异常强行使用光控)
-        if(device_status.timeSwitch==1)
-        {
-            LOG_I("***********时控*****************");
-            if(device_status.startBar==device_status.stopBar&&device_status.startBar==0){
-                device_status.work_status = 1;
-                LOG_I("24 hours work...");
-                #if LAMP_EN == 1
-                device_status.lamp_status = 1;
-                device_status.lamp1_status = 0;
-                device_status.lamp2_status = 0;
-                if(device_status.sun_status==1){
-                    ctr_lamp(OFF, 1);
-                    ctr_lamp(OFF, 2);
-                    ctr_lamp(OFF, 3);
-                }
-                #endif
-            }
 
-            //如果开始和结束是同一天
-            if(device_status.startBar<device_status.stopBar)
-            {
-                LOG_I("开始和结束是同一天");
-                time_t now;
-                time(&now);
-                static struct tm nowtime;   //现在
-                static struct tm starttime; //开始
-                static struct tm endtime;   //结束
-                //获取当前时间戳
-                nowtime =*localtime(&now);
-                nowtime.tm_hour = nowtime.tm_hour-8;
-                //获取定时开始的时间戳
-                starttime = *localtime(&now);
-                starttime.tm_hour = device_status.startBar-8;
-                starttime.tm_min = 0;
-                starttime.tm_sec = 0;
-                //获取定时结束的时间戳
-                endtime = *localtime(&now);
-                endtime.tm_hour = device_status.stopBar-8;
-                endtime.tm_min = 0;
-                endtime.tm_sec = 0;
-                LOG_I("***工作结束在当天:现在时间:%d-开始时间:%d-结束时间:%d***",mktime(&nowtime),mktime(&starttime),mktime(&endtime));
-                //如果当前时间大于开始时间且小于结束时间,且没有开始工作
-                if((difftime(mktime(&nowtime), mktime(&starttime)) >=0) && (difftime(mktime(&nowtime),mktime(&endtime))<0))
-                {
-                    LOG_I("当前时间大于开始时间,小于结束时间,工作中!!!");
-                    device_status.work_status = 1;
-                }
-                //如果当前时间小于开始时间
-                else if(difftime(mktime(&nowtime),mktime(&starttime))<0)
-                {
-                    LOG_I("当前时间小于开始时间,不工作!!!-%d-%d",mktime(&nowtime),mktime(&starttime));
-                    device_status.work_status = 0;
-                }
-                //当前时间大于结束时间
-                else {
-                    LOG_I("当前时间大于结束时间,不工作!!!-%d-%d",mktime(&nowtime),mktime(&starttime));
-                    device_status.work_status = 0;
-                }
-                #if LAMP_EN == 1
-                //如果当前时间超过20点,未到21点
-                if((difftime(mktime(&nowtime), mktime(&starttime)) >=0) && (difftime(mktime(&nowtime),mktime(&starttime)+3600)<0))
-                {
-                    LOG_I("3led:20~21");
-                    device_status.lamp_status = 1;
-                    device_status.lamp1_status = 0;
-                    device_status.lamp2_status = 0;
-                }
-                else if ((difftime(mktime(&nowtime), mktime(&starttime)+3600) >=0) && (difftime(mktime(&nowtime),mktime(&starttime)+7200)<0)) {
-                    LOG_I("3led:21~22");
-                    device_status.lamp1_status = 1;
-                    device_status.lamp_status = 0;
-                    device_status.lamp2_status = 0;
-                }
-                else if ((difftime(mktime(&nowtime), mktime(&starttime)+7200) >=0) && (difftime(mktime(&nowtime),mktime(&starttime)+10800)<0)) {
-                    LOG_I("3led:22~23");
-                    device_status.lamp2_status = 1;
-                    device_status.lamp_status = 0;
-                    device_status.lamp1_status =0;
-                }
-                #endif
-            }
-            //如果结束时间是第二天
-            else if (device_status.startBar>device_status.stopBar) {
-                time_t now;
-                time(&now);
-                static struct tm nowtime;   //现在
-                static struct tm starttime; //开始
-                static struct tm endtime;   //结束
-                //获取当前时间戳
-                nowtime =*localtime(&now);
-                nowtime.tm_hour = nowtime.tm_hour-8;
-                //获取定时开始的时间戳
-                starttime = *localtime(&now);
-                starttime.tm_hour = device_status.startBar-8;
-                starttime.tm_min = 0;
-                starttime.tm_sec = 0;
-                //获取定时结束的时间戳
-                endtime = *localtime(&now);
-                endtime.tm_hour = device_status.stopBar-8;
-                endtime.tm_min = 0;
-                endtime.tm_sec = 0;
-                LOG_I("工作结束在第二天:现在时间:%d-开始时间:%d-结束时间:%d!!!",mktime(&nowtime),mktime(&starttime),mktime(&endtime));
-                //如果当前时间大于开始时间,且没有开始工作 ,注意时间戳日期加1
-                if((difftime(mktime(&nowtime), mktime(&starttime)) > 0 ))
-                {
-                    //获取定时结束的时间戳
-                    endtime = *localtime(&now);  //将获取到的时间转换为时间戳
-                    endtime.tm_hour = device_status.stopBar-8;  //这里需减8用于时区转换
-                    endtime.tm_min = 0;
-                    endtime.tm_sec = 0;
-                    device_status.work_status = 1;
-                    LOG_I("当前前时间大于开始时间,且没有开始工作");
-                }
-                //当前时间小于开始时间
-                else if ((difftime(mktime(&nowtime), mktime(&starttime)) < 0))
-                {
-                    //获取定时结束的时间戳
-                    endtime = *localtime(&now);  //将获取到的时间转换为时间戳
-                    endtime.tm_hour = device_status.stopBar-8;  //这里需减8用于时区转换
-                    endtime.tm_min = 0;
-                    endtime.tm_sec = 0;
-                    //如果当前时间戳小于结束时间戳
-                    if(difftime(mktime(&nowtime),mktime(&endtime)) < 0)
-                    {
-                        LOG_I("当前时间大于开始时间,且没有开始工作,当前时间小于结束时间的情况:计算工作时间:从当前时间工作第二天的结束时间");
-                        device_status.work_status = 1;
-                    }
-                    else
-                    {
-                        LOG_I("当前时间小于开始时间,且没有开始工作,不是重启引起的,即还没到开始时间");
-                        device_status.work_status = 0; //不在工作时间,待机
-                    }
-                }
-            }
-        }
-        else {
-                LOG_I("光控定时模式!");
-                /*
-                time_t now;
-                time(&now);
-                static struct tm nowstamp;
-                nowstamp =*localtime(&now);
-                nowstamp.tm_hour = nowstamp.tm_hour - 8;
-                static rt_uint32_t nowstamp_num = 0;
-                nowstamp_num = mktime(&nowstamp);
-                rt_kprintf("now stamp:%d\n",nowstamp_num);
-                */
-                if(device_status.sun_status==0&&device_status.light_over_tim!=0)
-                {
-
-                    device_status.light_over_tim--;
-                    light_timeout = 3600;
-                    #if LAMP_EN == 1
-                    Led_Check(device_status.sunBar);
-                    #else
-                    device_status.work_status = 1;;
-                    LOG_I("光控定时,计时中>>>>>>>>>:%d",device_status.light_over_tim);
-                    #endif
-                }
-                else
-                {
-                    light_timeout --;
-                    //没有在测试并且没有在自检
-                    if(device_status.test_flag==0&&device_status.selfcheck_ws==0)
-                    {
-                        ctr_lamp(OFF,1);
-                        #if LAMP_EN == 1
-                        ctr_lamp(OFF,2);
-                        ctr_lamp(OFF,3);
-                        #endif
-                    }
-                    device_status.work_status = 0;
-                    if(light_timeout==0) device_status.light_over_tim=0;
-                    if(device_status.light_over_tim==0&&device_status.sun_status==1) device_status.light_over_tim = device_status.sunBar * 3600;
-                    LOG_I("光控中,白天:%d!!!",device_status.sun_status);
-                }
-        }
-        rt_thread_delay(1000);
-    }
-    LOG_I("雨控状态,温控状态,电压状态:%d-%d-%d",device_status.rain_status,device_status.temp_status,device_status.bat_status);
-    device_status.work_status = 0;
-    rt_thread_delay(1000);
-}
-#endif
 void WorkCheck(void)
 {
     static rt_uint32_t light_timeout = 3600;
@@ -2149,9 +1982,12 @@ void WorkCheck(void)
         else // 光控模式
         {
             LOG_I("光控定时模式!");
-            if(device_status.sun_status == 0 && device_status.light_over_tim != 0)
+            if(device_status.sun_status == 0 && device_status.light_over_tim > 0)
             {
-                device_status.light_over_tim--;
+                // 夜晚且有剩余时间:工作
+                if(device_status.light_over_tim > 0) {
+                    device_status.light_over_tim--;
+                }
                 light_timeout = 3600;  // 重置超时计数器
                 device_status.work_status = 1;
                 LOG_I("光控定时,计时中>>>>>>>>>:%d",device_status.light_over_tim);
@@ -2173,22 +2009,14 @@ void WorkCheck(void)
 
                 // 连续1小时白天后重置
                 if(light_timeout == 0) {
-                    device_status.light_over_tim = 0;
-                    light_timeout = 3600;  // 重置防止负数
-                }
-
-                // 白天且倒计时结束:重置夜晚时长
-                if(device_status.light_over_tim == 0 &&
-                   device_status.sun_status == 1)
-                {
                     device_status.light_over_tim = device_status.sunBar * 3600;
+                    light_timeout = 3600;  // 重置防止负数
                 }
             }
         }
         rt_thread_delay(1000);
     }
-
-    // 异常状态处理
+    // 异常状态处理while之外
     device_status.work_status = 0;
     rt_thread_delay(1000);
 }
@@ -2897,4 +2725,31 @@ int Work_Loop_Task(void)
 MSH_CMD_EXPORT(HardWare_Check,HardWare_Check<ON|OFF>);
 MSH_CMD_EXPORT(ctr_lamp,ctr_lamp<ON|OFF>);
 MSH_CMD_EXPORT(ctr_clear,ctr_clear<ON|OFF>);
+
+// RTU/DTU 电源控制 shell 命令
+static void ctr_rtu_dtu(int argc, char** argv)
+{
+    if(argc != 2)
+    {
+        rt_kprintf("Usage: ctr_rtu_dtu <ON|OFF>\n");
+        return;
+    }
+    
+    if(strcmp(argv[1], "ON") == 0 || strcmp(argv[1], "on") == 0)
+    {
+        ctr_RTU_DTU(ON);
+        rt_kprintf("RTU/DTU Power ON\n");
+    }
+    else if(strcmp(argv[1], "OFF") == 0 || strcmp(argv[1], "off") == 0)
+    {
+        ctr_RTU_DTU(OFF);
+        rt_kprintf("RTU/DTU Power OFF\n");
+    }
+    else
+    {
+        rt_kprintf("Invalid parameter: %s\n", argv[1]);
+        rt_kprintf("Usage: ctr_rtu_dtu <ON|OFF>\n");
+    }
+}
+MSH_CMD_EXPORT(ctr_rtu_dtu,ctr_rtu_dtu<ON|OFF>);
 MSH_CMD_EXPORT(ctr_led,sample:ctr_led <ON|OFF>);

+ 8 - 5
Application_CBD/applications/control.h

@@ -21,22 +21,22 @@
 
 #define BOOT_ERR         1              //1-新bootloader,0-旧bootloader()2023年9月份之前的设备升级需要设置为0
 #define DZ_250723        0              //触发雨控后隔天再解除
-#define DZ_260519        1              //进入工作后,每小时转一次仓
+#define DZ_260519        0              //进入工作后,每小时转一次仓
 ////////////////////////////////////////////////////////////////
 #if LAMP_EN == 1
     #define VERSION_HK          "1.(3ledV9).41(HK)"      //4.0海康-三色光源
     #define VERSION_HK_2000W    "1.3led0.40(2000W)"       //水稻
 #else
-    #define VERSION_HK          "1.67.41(HK)"            //4.0海康-1200W
-    #define VERSION_HK_2000W    "1.67.40(2000W)"         //4.0水稻
+    #define VERSION_HK          "1.68.41(HK)"            //4.0海康-1200W
+    #define VERSION_HK_2000W    "1.68.40(2000W)"         //4.0水稻
 #endif
 #if DZ_260519 == 0
-#define VERSION_ZP          "1.67.1(ZP)"            //1.0转盘
+#define VERSION_ZP          "1.68.1(ZP)"            //1.0转盘
 #else
 #define VERSION_ZP          "DZ_260519"            //1.0转盘
 #endif
 
-#define VERSION_GK          "1.67.1(GK)"            //1.0高空
+#define VERSION_GK          "1.68.1(GK)"            //1.0高空
 
 #define VERSION_XCT         "1.13.6(HK)"            //吸虫塔-海康
 #define VERSION_Robot       "1.0(robot)"            //展厅机器人
@@ -125,15 +125,18 @@ typedef struct  _packed
     uint8_t heat_sta;        //加热报警0-正常,1-异常
     uint8_t led_sta;         //补光灯报警0-正常,1-异常
     uint8_t selfcheck_ws;    //自检开关
+    uint8_t rtu_isboot;      //RTU启动状态:0-正常,1-异常
     #if BOOT_ERR == 1
     uint8_t gps_inuse;
     uint8_t gps_view;
     uint8_t _lamp;
+    uint8_t mock_uart2_timer_flag;
     #endif
     uint16_t dattim;         //数据上传间隔
     uint16_t shake_sec;      //震动时间
     uint16_t thsp;           //息屏时间
     uint16_t C01;            //故障码
+
     rt_uint32_t num_updata;         //
     rt_uint32_t rebootcnt;          //启动次数
     rt_uint32_t light_over_tim;     //光控定时差秒数,镇流器的结束时间

+ 10 - 10
Application_CBD/applications/dtu_uart2.c

@@ -1535,12 +1535,11 @@ int parseDtu(char *json_string)
 
           }
           if(JSONRPC!=NULL){
-                if(RESULT!=NULL&&RESULT->type==cJSON_String)
-                {
-                    if(strcmp(RESULT->valuestring,"success")==0){
-                        if(device_status.C01==100){
-                            device_status.C01 = 0;
-                            Stop_timer_Uart2();
+                if(RESULT!=NULL && RESULT->type==cJSON_Object){
+                    cJSON* message = cJSON_GetObjectItem(RESULT, "message");
+                    if(message!=NULL && message->type==cJSON_String){
+                        if(strcmp(message->valuestring,"success")==0){
+                            device_status.rtu_isboot = 0;
                         }
                     }
                 }
@@ -1553,7 +1552,7 @@ int parseDtu(char *json_string)
           item_ext=cJSON_GetObjectItem(root,"ext");
           if(cam_cmd!=NULL){
               //先检查定时器状态,否则会崩溃
-              rt_timer_stop(timer_uart2);
+              Stop_timer_Uart2();
               LOG_I("cam_code");
               if(cam_cmd->valueint==0){
                   ctr_led(ON);
@@ -1661,9 +1660,10 @@ int parseDtu(char *json_string)
                   if(strstr(type->valuestring,"rtu_off_on")!=RT_NULL)
                   {
                       LOG_W("DTU 12V Power down");
-                      ctr_RTU_DTU(OFF);
-                      rt_thread_delay(5000);
-                      ctr_RTU_DTU(ON);
+                      device_status.rtu_isboot = 1;
+                      char *tmp = makeJson_Warn("rtu will reboot for repower!","control");
+                      DTU_Write("%s",tmp);
+                      rt_free(tmp);
                   }
                   //对焦拍照
                   else if(strstr(type->valuestring,"auto_takephoto")!=RT_NULL)

+ 30 - 198
Application_CBD/applications/hmi.c

@@ -45,7 +45,6 @@ static char msg_pool[512];
 
 static char rx_buffer[HMI_UART_RXBUFFER_SIZE + 1];
 
-static rt_bool_t uart2_timeout_flag = RT_FALSE;
 
 void list_mem(void);
 int mb_master_samlpe();
@@ -68,8 +67,6 @@ static rt_thread_t hmi1 = RT_NULL;
 static rt_thread_t ctr_motor = RT_NULL;
 rt_device_t serial;   /*串口设备句柄*/
 
-rt_timer_t timer_uart2 = RT_NULL;
-
 
 static upgrade_state_t current_state = STATE_IDLE;
 uint32_t total_file_size = 0;
@@ -306,37 +303,14 @@ static void Hmi_thread_entry(void *parameter)
     }
 }
 /*******************************************************************************************/
-static void t_uart2_callback(void *parameter)
-{
-    HMI_WRITE("sysSet.va0.txt=\"指令超时,请重试...\"");
-    LOG_I("t_uart2_callback");
-    uart2_timeout_flag = RT_TRUE;
-}
-
 void Start_timer_Uart2(void)
 {
-
-    if(timer_uart2!=RT_NULL){
-        rt_timer_start(timer_uart2);
-    }
-    else
-    {
-        LOG_E("timer_uart2 start Failed!");
-    }
-
+    device_status.mock_uart2_timer_flag = 1;
 }
 
 void Stop_timer_Uart2(void)
 {
-
-    if(timer_uart2!=RT_NULL){
-        rt_timer_stop(timer_uart2);
-    }
-    else
-    {
-        LOG_E("timer_uart2 stop Failed!");
-    }
-
+    device_status.mock_uart2_timer_flag = 0;
 }
 
 /***************************** 解析从屏幕收到的数据 begin **********************************/
@@ -1300,7 +1274,7 @@ static void HMI_Decode(void)
         strncpy(shakesec_str,var,2);
         if(atoi(shakesec_str)>=0&&atoi(shakesec_str)<=10)
         {
-            device_status.shake_sec =atoi(shakesec_str)*10; //
+            device_status.shake_sec = atoi(shakesec_str);   //2026-06-01:修复*10导致震动很久
         }
         else {
             LOG_E("设置失败!!!");
@@ -1655,9 +1629,8 @@ static void Ctr_Mortor_entry(void* parameter)
    rt_int16_t photo_led_sec = 900;  //55S
    rt_uint8_t num_tg_open = 200;    //20S
    rt_uint8_t num_tg_init = 200;
-   //int current_t[200];
-   /*孢子仪拍照数量*/
-   rt_uint16_t photo_setup = 0;
+   static rt_uint16_t rtu_isboot_cnt = 0;
+   static rt_uint16_t mock_uart_timer2_cnt = 0;
     while(1)
     {
         #if 1
@@ -1669,20 +1642,38 @@ static void Ctr_Mortor_entry(void* parameter)
         {
             char *rep = makeJsonRpc2_0("reboot",NULL, 1);
             if(rep){
-                device_status.C01 = 100;
+                device_status.rtu_isboot = 1;
                 DTU_Write(rep);
                 //启动超时定时器
-                Start_timer_Uart2();
                 free(rep);
             }
             rt_thread_delay(1000);
         }
-        if(uart2_timeout_flag==RT_TRUE)
+        if(device_status.rtu_isboot==1)
         {
-            uart2_timeout_flag = RT_FALSE;
-            ctr_RTU_DTU(OFF);
-            rt_thread_delay(1000*30);
-            ctr_RTU_DTU(ON);
+            rtu_isboot_cnt ++;
+            if(rtu_isboot_cnt>=10*20){
+                rtu_isboot_cnt = 0;
+                device_status.rtu_isboot=0;
+                LOG_W("软重启超时,触发硬重启!");
+                ctr_RTU_DTU(OFF);
+                rt_thread_delay(1000*31);
+                ctr_RTU_DTU(ON);
+                rt_thread_delay(1000);
+            }
+        }else{
+            rtu_isboot_cnt = 0;
+        }
+        if(device_status.mock_uart2_timer_flag==1)
+        {
+            mock_uart_timer2_cnt++;
+            if(mock_uart_timer2_cnt>=200){
+                device_status.mock_uart2_timer_flag = 0;
+                HMI_WRITE("sysSet.va0.txt=\"指令超时,请重试...\"");
+                LOG_I("t_uart2_callback");
+            }
+        }else{
+            mock_uart_timer2_cnt = 0;
         }
         #endif
         if(device_status.ctr_up_motor==1)
@@ -1792,72 +1783,6 @@ static void Ctr_Mortor_entry(void* parameter)
         }else{
             photo_led_sec = 900;
         }
-        /*对焦拍照*/
-        if(device_status.autotakepic==1)
-        {
-            DTU_Write("autotakephoto");
-            HMI_WRITE("sysTest.auto_flag.txt=\"Autotest\"");
-            //打开步进电机驱动器电源
-            ctr_lamp(ON, 1);
-            //打开补光灯
-            ctr_led(ON);
-            //电机向下运动
-            ctr_Motor_Driver(1, 1, 1000000,1000);
-            rt_thread_delay(1000);
-            LOG_I("电机到达下方!!!");
-            Hk_Take_io();
-            rt_thread_delay(1000);
-            LOG_I("电机开始向上!!!");
-            rt_pin_write(Motor_EN, 1);
-            rt_pin_write(Motor_DIR, 0);
-            beep_set(1000000, 200000);      //2kzh - 50%
-            while(rt_pin_read(LIMIT_UP)==1)
-            {
-                HMI_WRITE("sysTest.result.txt=\"对焦拍照触发次数:%d\"",photo_setup);
-                HMI_WRITE("sysTest.auto_flag.txt=\"AutoTeststart\"");
-                rt_pin_write(Motor_EN, 0);
-                beep_set(0, 0);//驱动器失能
-                Hk_Take_io();              //触发拍照
-                rt_thread_mdelay(200);   //10ms
-                rt_pin_write(Motor_EN, 1);
-                beep_set(1000000, 200000); //驱动器使能
-                rt_thread_mdelay(100);   //10ms
-                beep_set(0, 0); //驱动器失能
-                rt_pin_write(Motor_EN, 0);
-                if(photo_setup>300)         //限制最大拍照数量
-                {
-                    ctr_led(OFF);
-                    device_status.autotakepic=0;
-                    rt_pin_write(Motor_EN, 0); //驱动器失能
-                    beep_set(1000000, 0);      //2kzh - 50%
-                    HMI_WRITE("sysTest.switchAutopic.val=%d",0);
-                    HMI_WRITE("sysTest.auto_flag.txt=\"\"");
-                    ctr_lamp(OFF, 1);
-                    break;
-                }
-                photo_setup++;
-                LOG_I("对焦拍照:%d",photo_setup);
-            }
-            DTU_Write("takephotodone");
-            ctr_led(OFF);
-            rt_pin_write(Motor_EN, 0); //驱动器失能
-            beep_set(1000000, 0);      //2kzh - 50%
-            HMI_WRITE("sysTest.switchAutopic.val=%d",0);
-            device_status.autotakepic=0;
-            photo_setup = 0;
-            HMI_WRITE("sysTest.auto_flag.txt=\"\"");
-            HMI_WRITE("sysTest.switchAutopic.val=%d",0);
-            //关闭步进电机驱动器电源
-            ctr_lamp(OFF, 1);
-            //重置运行标志位
-            device_status.run_sta = 0;
-            ef_set_env_blob("run_sta", &device_status.run_sta, sizeof(device_status.run_sta));
-         }
-        if(device_status.fsl_sw==1)
-        {
-            ctr_Petroleum_jelly(10);
-        }
-
         if(device_status.collt_box_sta==111){
             ctr_Fan_IN(ON);   //推杆电机收缩(供电打开,复位)
             num_tg_init--;
@@ -1918,95 +1843,6 @@ static void Ctr_Mortor_entry(void* parameter)
                 device_status.run_sta=0;
             }
         }
-        //一键测试
-        if(device_status.auto_test_sw==1)
-        {
-            HMI_WRITE("sysTest.auto_flag.txt=\"Autotest\"");
-            //转盘复位
-            LOG_I("转盘复位!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:转盘复位!\"");
-            rt_thread_delay(2000);
-            ctr_turn(0,0);
-            //转90
-            LOG_I("第一次转盘!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:第一次转盘!\"");
-            ctr_turn(90,0);
-            rt_thread_delay(2000);
-            //推杆电机:测试粘附:
-            LOG_I("涂凡士林!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:涂凡士林!\"");
-            ctr_Petroleum_jelly(10);
-            rt_thread_delay(2000);
-            //转90
-            LOG_I("第二次转盘!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:第二次转盘!\"");
-            ctr_turn(90,0);
-            rt_thread_delay(2000);
-            //采集,打开风机
-            LOG_I("采集,打开风机!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:采集,打开风机!\"");
-            ctr_Collect_Fan(ON);
-            rt_thread_delay(5000);
-            LOG_I("采集结束,关闭风机!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:采集结束,关闭风机!\"");
-            rt_thread_delay(2000);
-            ctr_Collect_Fan(OFF);
-            //散热
-            LOG_I("打开散热!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:打开散热!\"");
-            rt_thread_delay(2000);
-            ctr_Cool_Fan(ON);
-            rt_thread_delay(5000);
-            LOG_I("关闭散热!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:关闭散热!\"");
-            rt_thread_delay(2000);
-            ctr_Cool_Fan(OFF);
-            //转90
-            LOG_I("第三次转盘!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:第三次转盘!\"");
-            ctr_turn(90,0);
-            rt_thread_delay(5000);
-            //滴液
-            LOG_I("开始滴液!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:开始滴液!\"");
-            rt_thread_delay(2000);
-            ctr_shake(ON,device_status.shake_sec);
-            rt_thread_delay(5000);
-            LOG_I("停止滴液!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:停止滴液!\"");
-            rt_thread_delay(2000);
-            //加热
-            LOG_I("开始加热!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:开始加热!\"");
-            rt_thread_delay(2000);
-            ctr_Heat(ON);
-            rt_thread_delay(5000);
-            LOG_I("停止加热!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:停止加热!\"");
-            rt_thread_delay(2000);
-            ctr_Heat(OFF);
-            //制冷
-            LOG_I("开始制冷!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:开始制冷!\"");
-            rt_thread_delay(2000);
-            ctr_Cold(ON);
-            rt_thread_delay(5000);
-            LOG_I("停止制冷!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:停止制冷!\"");
-            rt_thread_delay(2000);
-            ctr_Cold(OFF);
-            //转90
-            LOG_I("第四次转盘!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:第四次转盘!\"");
-            ctr_turn(90,0);
-            LOG_I("打开补光灯!!!");
-            HMI_WRITE("sysTest.result.txt=\"一键测试:打开补光灯!\"");
-            rt_thread_delay(2000);
-            ctr_led(ON);
-            device_status.autotakepic=1;
-            device_status.auto_test_sw=0;
-            HMI_WRITE("sysTest.auto_flag.txt=\"\"");
-        }
         if(device_status.selfcheck_ws==2)
         {
             selfcheck(1);
@@ -2054,8 +1890,6 @@ int Hmi_Fresh(void)
     {
        ret = RT_ERROR;
     }
-    //定时器,串口通信超时监测20S
-    timer_uart2 = rt_timer_create("t_uart2",t_uart2_callback,RT_NULL, 20000, RT_TIMER_FLAG_ONE_SHOT);
     return ret;
 }
 void Check_ParamConfig(void)
@@ -2348,8 +2182,6 @@ void Check_ParamConfig(void)
         //等待联网,
         while(atoi(device_status.net)==1)
         {
-            if(Read_Real_Voltage()/100>5&&device_status.power_status==0)
-            ctr_RTU_DTU(ON);
             if(device_status.dtype==7)
             HMI_WRITE("sysTest.auto_flag.txt=\"0\"");
             char *readinfo =  makeJson_ReadInfo();

+ 1 - 1
Application_CBD/applications/main.c

@@ -141,7 +141,7 @@ static void idle_hook(void)
          }
      }
 #endif
-    if((alarm_new.tm_hour)==8&&(alarm_new.tm_min==20)&&(alarm_new.tm_sec==0))
+    if((alarm_new.tm_hour)==8&&(alarm_new.tm_min==25)&&(alarm_new.tm_sec==0))
     {
         rt_hw_cpu_reset();
     }

+ 9 - 0
Application_CBD/readme.md

@@ -1,3 +1,12 @@
+# 2026-06-01 更新说明
+	#define VERSION_HK          "1.68.41(HK)"            //4.0海康-1200W
+    #define VERSION_HK_2000W    "1.68.40(2000W)"         //4.0水稻
+	#define VERSION_ZP          "1.68.1(ZP)"            //1.0转盘
+	#define VERSION_GK          "1.68.1(GK)"            //1.0高空
+	1. 修复屏幕修改震动时间后,测试震动不停震动问题;
+	2. 修复触发RTU定时重启,定时器超时无法停止,还是触发硬重启导致RTU启动保护;
+		处理措施:取消定时器超时,使用标志位;
+		RTU电源控制函数增加间隔限制;
 # 2026-05-22 更新说明
 	#define VERSION_HK          "1.67.41(HK)"            //4.0海康-1200W
     #define VERSION_HK_2000W    "1.67.40(2000W)"         //4.0水稻

+ 1 - 1
Application_CBD/rtconfig.h

@@ -17,7 +17,7 @@
 #define IDLE_THREAD_STACK_SIZE 1024
 #define RT_USING_TIMER_SOFT
 #define RT_TIMER_THREAD_PRIO 4
-#define RT_TIMER_THREAD_STACK_SIZE 256
+#define RT_TIMER_THREAD_STACK_SIZE 1024
 
 /* Inter-Thread communication */