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

+ 83 - 128
Application_CBD/applications/hmi.c

@@ -25,7 +25,7 @@
 #include <shell.h>
 #include <shell.h>
 #include "dtu_uart2.h"
 #include "dtu_uart2.h"
 #include <fal.h>
 #include <fal.h>
-#include "selfcheck.h"
+
 #define DBG_ENABLE
 #define DBG_ENABLE
 #define DBG_COLOR
 #define DBG_COLOR
 #define DBG_TAG "hmi"
 #define DBG_TAG "hmi"
@@ -119,6 +119,7 @@ static rt_err_t uart_input(rt_device_t dev, rt_size_t size)
     {
     {
         /* 消息队列满 */
         /* 消息队列满 */
         LOG_I("hmi message queue full!\n");
         LOG_I("hmi message queue full!\n");
+        rt_mq_control(&rx_mq, RT_IPC_CMD_RESET, RT_NULL); // 清空队列
     }
     }
     return result;
     return result;
 }
 }
@@ -160,23 +161,21 @@ static void Hmi_thread_entry(void *parameter)
 static void t_uart2_callback(void *parameter)
 static void t_uart2_callback(void *parameter)
 {
 {
     HMI_WRITE("sysSet.va0.txt=\"指令超时,请重试...\"");
     HMI_WRITE("sysSet.va0.txt=\"指令超时,请重试...\"");
-    LOG_E("t_uart2_callback");
+    LOG_I("t_uart2_callback");
 }
 }
 
 
-
 void Start_timer_Uart2(void)
 void Start_timer_Uart2(void)
 {
 {
-    if(timer_uart2!=RT_NULL)
-    {
+
+    if(timer_uart2!=RT_NULL){
         rt_timer_start(timer_uart2);
         rt_timer_start(timer_uart2);
     }
     }
     else
     else
     {
     {
         LOG_E("timer_uart2 start Failed!");
         LOG_E("timer_uart2 start Failed!");
     }
     }
-}
-
 
 
+}
 
 
 /***************************** 解析从屏幕收到的数据 begin **********************************/
 /***************************** 解析从屏幕收到的数据 begin **********************************/
 static void HMI_Decode(void)
 static void HMI_Decode(void)
@@ -243,7 +242,6 @@ static void HMI_Decode(void)
             HMI_WRITE("workSta.vbat.txt=\"%s\"",device_status.voltage);
             HMI_WRITE("workSta.vbat.txt=\"%s\"",device_status.voltage);
             //更新电流
             //更新电流
              HMI_WRITE("workSta.power.txt=\"%s\"",device_status.power);
              HMI_WRITE("workSta.power.txt=\"%s\"",device_status.power);
-
             //更新温湿度数据
             //更新温湿度数据
             HMI_WRITE("workSta.envHum.val=%d",atoi(device_status.humidity));
             HMI_WRITE("workSta.envHum.val=%d",atoi(device_status.humidity));
             HMI_WRITE("workSta.envTem.val=%d",atoi(device_status.tempture));
             HMI_WRITE("workSta.envTem.val=%d",atoi(device_status.tempture));
@@ -313,8 +311,17 @@ static void HMI_Decode(void)
         }else if(atoi(device_status.gps)==2){
         }else if(atoi(device_status.gps)==2){
             HMI_WRITE("menu.gps_state.txt=\"定位成功:(基站)\"");
             HMI_WRITE("menu.gps_state.txt=\"定位成功:(基站)\"");
         }
         }
+        if(device_status.sensor_485_sta==1)
+        {
+            HMI_WRITE("menu.sensor_state.txt=\"传感器已连接:(%s lux-%s hpa)\"",device_status.lux,device_status.ap);
+        }
+        else
+        {
+            HMI_WRITE("menu.sensor_state.txt=\"传感器未连接\"");
+        }
         #endif
         #endif
 
 
+
         //更新联网状态
         //更新联网状态
         if(atoi(device_status.net)==1)
         if(atoi(device_status.net)==1)
         {
         {
@@ -436,10 +443,20 @@ static void HMI_Decode(void)
     }
     }
     //拍照
     //拍照
     else if(strstr(rx_buffer,"putTest.switchPhoto=1")!=NULL) {
     else if(strstr(rx_buffer,"putTest.switchPhoto=1")!=NULL) {
+        device_status.photo_ws = 0;
+        rt_thread_delay(500);
         device_status.photo_ws = 1;
         device_status.photo_ws = 1;
+        char *photo = makeJson_Warn("takephoto","control");
+        DTU_Write("%s",photo);
+        rt_free(photo);
     }
     }
     else if (strstr(rx_buffer,"putTest.switchPic=1")!=NULL) {
     else if (strstr(rx_buffer,"putTest.switchPic=1")!=NULL) {
+        device_status.photo_ws = 0;
+        rt_thread_delay(500);
         device_status.photo_ws = 1;
         device_status.photo_ws = 1;
+        char *photo = makeJson_Warn("takephoto","control");
+        DTU_Write("%s",photo);
+        rt_free(photo);
     }
     }
     //转盘复位
     //转盘复位
     else if (strstr(rx_buffer,"turn_init")!=NULL) {
     else if (strstr(rx_buffer,"turn_init")!=NULL) {
@@ -551,7 +568,11 @@ static void HMI_Decode(void)
     //清扫
     //清扫
     else if (strstr(rx_buffer,"clear")!=NULL) {
     else if (strstr(rx_buffer,"clear")!=NULL) {
         rt_kprintf("\n清扫!\n");
         rt_kprintf("\n清扫!\n");
-        if(device_status.version_type==4||device_status.version_type==41)
+        if(device_status.version_type==4||  //水稻
+                device_status.version_type==41||    //4.0
+                device_status.version_type==42||    //低端款
+                device_status.version_type==43||    //中端款
+                device_status.version_type==12)     //高空带拍照
         {
         {
             device_status.clear_status=1;
             device_status.clear_status=1;
         }
         }
@@ -587,6 +608,8 @@ static void HMI_Decode(void)
     else if (strstr(rx_buffer,"putTest.switchLamp=1")!=NULL)
     else if (strstr(rx_buffer,"putTest.switchLamp=1")!=NULL)
     {
     {
         device_status.test_flag=1;
         device_status.test_flag=1;
+        if(Read_Rain_Voltage()<250)
+            device_status.rain_status = 0;
         rt_kprintf("Open Lamp!\n");
         rt_kprintf("Open Lamp!\n");
         ctr_lamp(ON,1);
         ctr_lamp(ON,1);
         #if LAMP_EN == 1
         #if LAMP_EN == 1
@@ -1195,6 +1218,22 @@ static void HMI_Decode(void)
     else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
     else if (strstr(rx_buffer,"DebugDisable")!=NULL) {
         Debug_log_OFF();
         Debug_log_OFF();
     }
     }
+    //高空-带拍照
+    else if (strstr(rx_buffer,"SwversionV12")!=NULL)
+    {
+        device_status.dtype = 3;
+        if(device_status.version_type != 12)
+        {
+            device_status.version_type = 12;
+            sprintf(device_status.driver, "%s",VERSION_GK);
+            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
+            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
+            MA_save();
+        }
+        else {
+
+        }
+    }
     //高空
     //高空
     else if (strstr(rx_buffer,"SwversionV11")!=NULL)
     else if (strstr(rx_buffer,"SwversionV11")!=NULL)
     {
     {
@@ -1210,6 +1249,7 @@ static void HMI_Decode(void)
         else {
         else {
 
 
         }
         }
+        return;
     }
     }
     //1.0
     //1.0
     else if (strstr(rx_buffer,"SwversionV1")!=NULL)
     else if (strstr(rx_buffer,"SwversionV1")!=NULL)
@@ -1226,36 +1266,35 @@ static void HMI_Decode(void)
         else {
         else {
 
 
         }
         }
+        return;
     }
     }
     //中端款
     //中端款
     else if (strstr(rx_buffer,"SwversionV43")!=NULL) {
     else if (strstr(rx_buffer,"SwversionV43")!=NULL) {
         device_status.dtype = 3;
         device_status.dtype = 3;
         if(device_status.version_type != 43)
         if(device_status.version_type != 43)
         {
         {
+            device_status.dtype = 3;
             device_status.version_type = 43;
             device_status.version_type = 43;
             sprintf(device_status.driver, "%s",VERSION_HK_2000W);
             sprintf(device_status.driver, "%s",VERSION_HK_2000W);
             ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
             ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
+            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型+
             MA_save();
             MA_save();
         }
         }
-        else {
-
-        }
+        return;
     }
     }
     //低端款
     //低端款
     else if (strstr(rx_buffer,"SwversionV42")!=NULL) {
     else if (strstr(rx_buffer,"SwversionV42")!=NULL) {
         device_status.dtype = 3;
         device_status.dtype = 3;
         if(device_status.version_type != 42)
         if(device_status.version_type != 42)
         {
         {
+            device_status.dtype = 3;
             device_status.version_type = 42;
             device_status.version_type = 42;
             sprintf(device_status.driver, "%s",VERSION_HK_2000W);
             sprintf(device_status.driver, "%s",VERSION_HK_2000W);
             ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
             ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
+            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型+
             MA_save();
             MA_save();
         }
         }
-        else {
-
-        }
+        return;
     }
     }
     //4.0
     //4.0
     else if (strstr(rx_buffer,"SwversionV41")!=NULL) {
     else if (strstr(rx_buffer,"SwversionV41")!=NULL) {
@@ -1273,6 +1312,7 @@ static void HMI_Decode(void)
         else {
         else {
 
 
         }
         }
+        return;
     }
     }
     //水稻
     //水稻
     else if (strstr(rx_buffer,"SwversionV4")!=NULL) {
     else if (strstr(rx_buffer,"SwversionV4")!=NULL) {
@@ -1289,18 +1329,7 @@ static void HMI_Decode(void)
         else {
         else {
 
 
         }
         }
-    }
-    //5.0测报灯
-    else if (strstr(rx_buffer,"SwversionV5")!=NULL) {
-        device_status.dtype = 3;
-        if(device_status.version_type!=5)
-        {
-            device_status.version_type = 5;
-            sprintf(device_status.driver, "%s",VERSION_V5);
-            ef_set_env_blob("version_type",&device_status.version_type,sizeof(device_status.version_type));        //版本类型
-            ef_set_env_blob("dtype",&device_status.dtype,sizeof(device_status.dtype));        //版本类型
-            MA_save();
-        }
+        return;
     }
     }
     //吸虫塔
     //吸虫塔
     else if (strstr(rx_buffer,"SwversionV6")!=NULL) {
     else if (strstr(rx_buffer,"SwversionV6")!=NULL) {
@@ -1350,7 +1379,6 @@ static void HMI_Decode(void)
     else if(strstr(rx_buffer,"DisplayPower")!=RT_NULL)
     else if(strstr(rx_buffer,"DisplayPower")!=RT_NULL)
     {
     {
         HMI_WRITE("sysTest.sysTest_power.txt=\"%s\"",device_status.power);
         HMI_WRITE("sysTest.sysTest_power.txt=\"%s\"",device_status.power);
-        HMI_WRITE("sysTest.heat_txt.txt=\"%s\"",device_status.heat_power);
 //        HMI_WRITE("sysTest.switchHeat.val=%d",device_status.heat_status);
 //        HMI_WRITE("sysTest.switchHeat.val=%d",device_status.heat_status);
     }
     }
     //立即上传
     //立即上传
@@ -1444,7 +1472,6 @@ static void HMI_Decode(void)
 //入口函数-电机控制及
 //入口函数-电机控制及
 static void Ctr_Mortor_entry(void* parameter)
 static void Ctr_Mortor_entry(void* parameter)
 {
 {
-   rt_int16_t motor_current = 0;     //
    rt_uint16_t num_up_open = 200;    //20s
    rt_uint16_t num_up_open = 200;    //20s
    rt_uint16_t num_up_close = 200;   //
    rt_uint16_t num_up_close = 200;   //
    rt_uint16_t num_down_open = 200;  //
    rt_uint16_t num_down_open = 200;  //
@@ -1455,20 +1482,8 @@ static void Ctr_Mortor_entry(void* parameter)
    //int current_t[200];
    //int current_t[200];
    /*孢子仪拍照数量*/
    /*孢子仪拍照数量*/
    rt_uint16_t photo_setup = 0;
    rt_uint16_t photo_setup = 0;
-   #if Color_EN ==1
-   ctr_Color_board(RESET, 1200);
-   #endif
     while(1)
     while(1)
     {
     {
-        #if Color_EN ==1
-        //定时执行把粘虫板更换的操作,每天一次
-        if(device_status.run_sta==5)
-        {
-            rt_thread_delay(2000);
-            device_status.run_sta = 0;
-            ctr_Color_board(OPEN, 1000);
-        }
-        #endif
         #if 1
         #if 1
         time_t time_reset12V;
         time_t time_reset12V;
         time(&time_reset12V);
         time(&time_reset12V);
@@ -1483,117 +1498,47 @@ static void Ctr_Mortor_entry(void* parameter)
         #endif
         #endif
         if(device_status.ctr_up_motor==1)
         if(device_status.ctr_up_motor==1)
         {
         {
-            #if 0
-            if(num_up_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_up_open<200)
-            #endif
             ctr_cangmen_up(OPEN);
             ctr_cangmen_up(OPEN);
             num_up_open--;
             num_up_open--;
-//            current_t[num_up_open] = atoi(device_status.power);
             if (num_up_open == 0)
             if (num_up_open == 0)
             {
             {
                 ctr_cangmen_up(OFF);
                 ctr_cangmen_up(OFF);
                 num_up_open = 200;
                 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]);
-//            }
+            num_up_close = 200;
         }
         }
         else if(device_status.ctr_up_motor==2)
         else if(device_status.ctr_up_motor==2)
         {
         {
-//            if(num_up_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_up_close<200)
             ctr_cangmen_up(CLOSE);
             ctr_cangmen_up(CLOSE);
             num_up_close --;
             num_up_close --;
-//            current_t[num_up_close] = atoi(device_status.power);
             if (num_up_close == 0)
             if (num_up_close == 0)
             {
             {
                 ctr_cangmen_up(OFF);
                 ctr_cangmen_up(OFF);
                 num_up_close= 200;
                 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]);
+            num_up_open = 200;
         }
         }
         if (device_status.ctr_down_motor == 1)
         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);
             ctr_cangmen_down(OPEN);
             num_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)
             {
             {
                 ctr_cangmen_down(OFF);
                 ctr_cangmen_down(OFF);
                 num_down_open = 200;
                 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]);
+            num_down_close = 200;
         }
         }
         else if (device_status.ctr_down_motor == 2)
         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);
             ctr_cangmen_down(CLOSE);
             num_down_close--;
             num_down_close--;
-//            current_t[num_down_close] = atoi(device_status.power);
-
             if (num_down_close == 0)
             if (num_down_close == 0)
             {
             {
                ctr_cangmen_down(OFF);
                ctr_cangmen_down(OFF);
                num_down_close = 200;
                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]);
+            num_down_open = 200;
         }
         }
         if(device_status.sun_test==1)
         if(device_status.sun_test==1)
         {
         {
@@ -1608,7 +1553,7 @@ static void Ctr_Mortor_entry(void* parameter)
             if(photo_led_sec==900)
             if(photo_led_sec==900)
                 ctr_led(ON);
                 ctr_led(ON);
             //打开补光灯
             //打开补光灯
-            if(photo_led_sec==800)
+            if(photo_led_sec==880)
             {
             {
                 LOG_I("测试拍照!");
                 LOG_I("测试拍照!");
                 #if 1
                 #if 1
@@ -1626,6 +1571,9 @@ static void Ctr_Mortor_entry(void* parameter)
                 rt_thread_delay(1000);
                 rt_thread_delay(1000);
                 LOG_I("测试拍照!");
                 LOG_I("测试拍照!");
                 Hk_Take_io();
                 Hk_Take_io();
+//                char *takephotojson = makeJson_takephoto();
+//                DTU_Write("%s",takephotojson);
+//                rt_free(takephotojson);
             }
             }
             photo_led_sec--;
             photo_led_sec--;
             if(photo_led_sec==300)    //
             if(photo_led_sec==300)    //
@@ -1633,6 +1581,9 @@ static void Ctr_Mortor_entry(void* parameter)
                 ctr_led(OFF);
                 ctr_led(OFF);
                 photo_led_sec = 900;
                 photo_led_sec = 900;
                 device_status.photo_ws = 0;
                 device_status.photo_ws = 0;
+                if(device_status.work_status = 1){
+                    device_status.clear_status = 1;
+                }
                 HMI_WRITE("sysTest.switchPhoto.val=0");
                 HMI_WRITE("sysTest.switchPhoto.val=0");
                 HMI_WRITE("sysTest.switchFill.val=0");
                 HMI_WRITE("sysTest.switchFill.val=0");
             }
             }
@@ -1904,10 +1855,6 @@ int Hmi_Fresh(void)
     }
     }
     //定时器,串口通信超时监测20S
     //定时器,串口通信超时监测20S
     timer_uart2 = rt_timer_create("t_uart2",t_uart2_callback,RT_NULL, 20000, RT_TIMER_FLAG_ONE_SHOT);
     timer_uart2 = rt_timer_create("t_uart2",t_uart2_callback,RT_NULL, 20000, RT_TIMER_FLAG_ONE_SHOT);
-    if(timer_uart2==RT_NULL)
-    {
-        LOG_E("rt_timer_create timer_uart2 failed!");
-    }
     return ret;
     return ret;
 }
 }
 void Check_ParamConfig(void)
 void Check_ParamConfig(void)
@@ -2085,16 +2032,13 @@ void Check_ParamConfig(void)
         {
         {
             rt_sprintf(device_status.driver, "%s",VERSION_GK);
             rt_sprintf(device_status.driver, "%s",VERSION_GK);
         }
         }
-        else if (device_status.version_type==4)
+        else if (device_status.version_type==4||device_status.version_type==42||device_status.version_type==43)
         {
         {
             rt_sprintf(device_status.driver, "%s",VERSION_HK_2000W);
             rt_sprintf(device_status.driver, "%s",VERSION_HK_2000W);
         }
         }
         else if (device_status.version_type==41) {
         else if (device_status.version_type==41) {
             rt_sprintf(device_status.driver, "%s",VERSION_HK);
             rt_sprintf(device_status.driver, "%s",VERSION_HK);
         }
         }
-        else if (device_status.version_type==5) {
-            rt_sprintf(device_status.driver, "%s",VERSION_V5);
-        }
         else if (device_status.version_type==6)
         else if (device_status.version_type==6)
         {
         {
             //打开相机供电;
             //打开相机供电;
@@ -2146,6 +2090,7 @@ void Check_ParamConfig(void)
         LOG_I("PowerType:%d",device_status.Power_Type);
         LOG_I("PowerType:%d",device_status.Power_Type);
         LOG_I("deviceId:%s",device_status.deviceId);
         LOG_I("deviceId:%s",device_status.deviceId);
         LOG_I("handle_bugger:%d",device_status.handle_bugger);
         LOG_I("handle_bugger:%d",device_status.handle_bugger);
+        LOG_W("heat_sw加热开关:%d",device_status.heat_sw);
     }
     }
     //RTC时间判断,如果当前年份小于2020,提示需要设置时间,切换为光控
     //RTC时间判断,如果当前年份小于2020,提示需要设置时间,切换为光控
     if(device_status.update_flag==1)
     if(device_status.update_flag==1)
@@ -2163,6 +2108,10 @@ void Check_ParamConfig(void)
 
 
         ctr_router(ON);
         ctr_router(ON);
         Hmi_Fresh();
         Hmi_Fresh();
+        #if Color_EN == 1
+        Control_clear();
+        Control_heat();
+        #endif
         if(device_status.dtype!=7)
         if(device_status.dtype!=7)
         {
         {
             Control_clear();
             Control_clear();
@@ -2216,6 +2165,7 @@ void Check_ParamConfig(void)
         if(device_status.version_type==6) device_status.timeSwitch = 1;
         if(device_status.version_type==6) device_status.timeSwitch = 1;
         DTU_Write("%s",makeJson_Warn("turnon", "device_stm32"));
         DTU_Write("%s",makeJson_Warn("turnon", "device_stm32"));
         rt_thread_delay(1000);
         rt_thread_delay(1000);
+        dtu_send_data_start();
 #endif
 #endif
     }
     }
 }
 }
@@ -2231,6 +2181,9 @@ void ResetParamDefault(void)
     device_status.collecting_sh2 = 14;
     device_status.collecting_sh2 = 14;
     device_status.collecting_eh2 = 16;
     device_status.collecting_eh2 = 16;
     device_status.Power_Type = 0;
     device_status.Power_Type = 0;
+    device_status.heat_sw = 1;
+
+    ef_set_env_blob("heat_sw", &device_status.heat_sw, sizeof(device_status.heat_sw));
     ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
     ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
 
 
     ef_set_env_blob("dattim",&device_status.dattim,sizeof(device_status.dattim));        //上传时间
     ef_set_env_blob("dattim",&device_status.dattim,sizeof(device_status.dattim));        //上传时间
@@ -2250,7 +2203,7 @@ void ResetParamDefault(void)
         device_status.sunBar = 8;
         device_status.sunBar = 8;
         #endif
         #endif
         device_status.tph = 70;         //高温保护阈值
         device_status.tph = 70;         //高温保护阈值
-        device_status.tpl = -5;          //低温保护阈值
+        device_status.tpl = 5;          //低温保护阈值
         device_status.timeSwitch = 0;   //定时模式:光控
         device_status.timeSwitch = 0;   //定时模式:光控
         device_status.heatvalue=100;    //加热温度
         device_status.heatvalue=100;    //加热温度
         ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
         ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
@@ -2304,7 +2257,7 @@ void ResetParamDefault_DC(void)
     device_status.sunBar = 4;
     device_status.sunBar = 4;
     #endif
     #endif
     device_status.tph = 70;         //高温保护阈值
     device_status.tph = 70;         //高温保护阈值
-    device_status.tpl = -5;          //低温保护阈值
+    device_status.tpl = 5;         //低温保护阈值
     device_status.timeSwitch = 0;   //定时模式
     device_status.timeSwitch = 0;   //定时模式
     device_status.heatvalue=100;
     device_status.heatvalue=100;
     device_status.ds = 1;           //设备状态开机
     device_status.ds = 1;           //设备状态开机
@@ -2313,6 +2266,8 @@ void ResetParamDefault_DC(void)
     device_status.timeSwitch = 0;
     device_status.timeSwitch = 0;
     device_status.Power_Type = 1;
     device_status.Power_Type = 1;
     device_status.handle_bugger = 0;
     device_status.handle_bugger = 0;
+    device_status.heat_sw = 0;
+    ef_set_env_blob("heat_sw",&device_status.heat_sw,sizeof(device_status.heat_sw));        //上传时间
     ef_set_env_blob("dattim",&device_status.dattim,sizeof(device_status.dattim));        //上传时间
     ef_set_env_blob("dattim",&device_status.dattim,sizeof(device_status.dattim));        //上传时间
     ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
     ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
     ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
     ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));

+ 4 - 4
Application_cbd_apm32f1/applications/control.h

@@ -17,15 +17,15 @@
 
 
 
 
 #define LAMP_EN          0             //李新3灯管:0关闭,1打开
 #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 MATCH_DEVICE     0             //比赛设备
 #define SENSOR_EN        0             //温湿度:0关闭,1打开
 #define SENSOR_EN        0             //温湿度:0关闭,1打开
 #define UART_TEST_EN     0             ///串口测试0-关闭,1-启用
 #define UART_TEST_EN     0             ///串口测试0-关闭,1-启用
-#define TG_MODULE        1             //推杆电机结构模块化控制
+#define TG_MODULE        0             //推杆电机结构模块化控制
 #define DINGZHI_0722     0             //控制一个电机每天12点20工作12秒
 #define DINGZHI_0722     0             //控制一个电机每天12点20工作12秒
 
 
 #define QINGSAO_IO       0             //调整清扫顺序20250801
 #define QINGSAO_IO       0             //调整清扫顺序20250801
-
+#define WENKONG          1             //温控功能1-开启 0-关闭
 #if MATCH_DEVICE == 1
 #if MATCH_DEVICE == 1
 #define LAMP_CURRENT    600
 #define LAMP_CURRENT    600
 #else
 #else
@@ -37,7 +37,7 @@
     #define VERSION_HK_2000W    "1.3led.40(2000W)"       //水稻
     #define VERSION_HK_2000W    "1.3led.40(2000W)"       //水稻
 #else
 #else
     #define VERSION_HK          "2.5.41(HK)"            //4.0海康-1200W
     #define VERSION_HK          "2.5.41(HK)"            //4.0海康-1200W
-    #define VERSION_HK_2000W    "2.31tg2.4(2000W)"         //4.0水稻
+    #define VERSION_HK_2000W    "2.31.4(2000W)"         //4.0水稻
 #endif
 #endif
 
 
 #define VERSION_ZP          "2.29.1(ZP)"            //1.0转盘
 #define VERSION_ZP          "2.29.1(ZP)"            //1.0转盘

+ 2 - 0
Application_cbd_apm32f1/applications/sht30_collect.c

@@ -172,6 +172,7 @@ static void sht30_collect_thread_entry(void *parameter)
             }
             }
         }
         }
         //温控
         //温控
+        #if WENKONG==1
         if(atoi(device_status.tempture)>=device_status.tph||atoi(device_status.tempture)<=device_status.tpl)
         if(atoi(device_status.tempture)>=device_status.tph||atoi(device_status.tempture)<=device_status.tpl)
         {
         {
             device_status.C01 |= (1<<7);
             device_status.C01 |= (1<<7);
@@ -182,6 +183,7 @@ static void sht30_collect_thread_entry(void *parameter)
             device_status.C01 &= ~(1<<7);
             device_status.C01 &= ~(1<<7);
             device_status.temp_status = 0;
             device_status.temp_status = 0;
         }
         }
+        #endif
         LOG_I("光控计数:%d-%d",checklightnum,checknightnum);
         LOG_I("光控计数:%d-%d",checklightnum,checknightnum);
         rt_thread_mdelay(5000);
         rt_thread_mdelay(5000);
     }
     }