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

+ 0 - 3
Application_cbd_apm32f1/applications/control.c

@@ -498,14 +498,11 @@ uint8_t ctr_led(uint8_t status_led)
         rt_pin_write(LED_SW,ON);
         if(device_status.version_type==6)
         rt_pin_write(LED_P,ON);
-        HMI_WRITE("sysTest.switchFill.val=%d",ON);
     }
     else if(status_led==OFF){
         rt_pin_write(LED_SW,OFF);
         if(device_status.version_type==6)
             rt_pin_write(LED_P,OFF);
-        HMI_WRITE("sysTest.switchPhoto.val=%d",OFF);
-        HMI_WRITE("sysTest.switchFill.val=%d",OFF);
     }
     return status_led;
 }

+ 29 - 3
Application_cbd_apm32f1/applications/control.h

@@ -181,17 +181,36 @@ typedef struct
     char OP_24V_2[8];               //24V输出通道2负载电流
     char OP_24V_3[8];               //24V输出通道3负载电流
     char OP_24V_4[8];               //24V输出通道4负载电流
+
+    char OP_12V_1[8];
+    char OP_12V_2[8];
+
+    char OP_5V_1[8];
+
     char OP_MOTOR_1[8];
     char OP_MOTOR_2[8];
     char OP_MOTOR_3[8];
+
+    uint16_t ADC_1;                 //ADC通道1数值
+    uint16_t ADC_2;                 //ADC通道2数值
+    uint16_t ADC_3;                 //ADC通道3数值
+
+    uint8_t ADC1_STA;               //ADC通道1检测结果,0通过,1失败
+    uint8_t ADC2_STA;               //ADC通道2检测结果,0通过,1失败
+    uint8_t ADC3_STA;               //ADC通道3检测结果,0通过,1失败
+
     uint8_t  OP_24V_1_STA;          //24V输出通道1检测结果,0通过,1失败
     uint8_t  OP_24V_2_STA;          //24V输出通道1检测结果,0通过,1失败
     uint8_t  OP_24V_3_STA;          //24V输出通道1检测结果,0通过,1失败
     uint8_t  OP_24V_4_STA;          //24V输出通道1检测结果,0通过,1失败
 
-    uint8_t  OP_MOTOR_1_STA;
-    uint8_t  OP_MOTOR_2_STA;
-    uint8_t  OP_MOTOR_3_STA;
+    uint8_t  OP_12V_1_STA;          //12V输出通道1检测结果,0通过,1失败
+    uint8_t  OP_12V_2_STA;          //12V输出通道2检测结果,0通过,1失败
+    uint8_t  OP_5V_1_STA;           //5V输出通道1检测结果,0通过,1失败
+
+    uint8_t  OP_MOTOR_1_STA;        //电机驱动1检测结果,0通过,1失败
+    uint8_t  OP_MOTOR_2_STA;        //电机驱动2检测结果,0通过,1失败
+    uint8_t  OP_MOTOR_3_STA;        //电机驱动3检测结果,0通过,1失败
 
     uint8_t  UATR_4_RX_STA;
     uint8_t  UATR_4_TX_STA;
@@ -199,7 +218,14 @@ typedef struct
     uint8_t  UATR_2_RX_STA;
     uint8_t  UATR_2_TX_STA;
 
+    uint8_t  UART_485_STA;
+
+    uint8_t  VOLTAGE_24V_STA;
+    uint8_t  CURRENT_24V_STA;
+    uint8_t  FLASH_WRITE_STA;
+    uint8_t  FLASH_READ_STA;
 
+    uint8_t  RESULT;                //自检结果,0-通过,1-失败
     uint8_t list_all;               //检测总数
     uint8_t checked;                //已检测
 

+ 31 - 161
Application_cbd_apm32f1/applications/dtu_uart2.c

@@ -38,6 +38,7 @@
 
 
 Device_Status_typedef device_status;
+CheckResult check_results;
 DataTemp data_arry;
 
 void list_mem(void);
@@ -209,24 +210,9 @@ static void dtu_thread_entry_recv(void *parameter)
                        rt_memset(rx_buffer_tmp,0,sizeof(rx_buffer_tmp));
                        rt_memset(rx_buffer_tmp2,0,sizeof(rx_buffer_tmp2));
                    }
-                 }
+             }
 
          }
-        else {
-               rx_err ++;
-               if(rx_err==54000)//90分钟未接收到数据
-               {
-                    ctr_RTU_DTU(OFF);
-                    device_status.C01 |= (1<<13);    //灯管 故障
-               }
-               else if (rx_err>54100&&device_status.bat_status==0)
-               {
-                   LOG_W("通信中断,RTU重新上电");
-                   rx_err = 0;
-                   ctr_RTU_DTU(ON);
-                   ctr_photo(ON);
-               }
-         }
    }
         #endif
 }
@@ -287,149 +273,6 @@ int hasElementGreater_lessThan400(uint16_t arr[], int size) {
     return 0; // 遍历完数组,没有找到大于 100 的元素,返回 0
 }
 
-/*入口函数-指令发送*/
-static void dtu_thread_entry_send(void *parameter)
-{
-
-    device_status.power_status = 1;
-    device_status.num_updata = 0;
-    static uint16_t current_arry[10];
-    static uint8_t record_current = 0;
-    static uint8_t lamp_sta_cnt = 0;
-    rt_thread_delay(10000);
-    static rt_uint16_t wait_i = 0;
-    static rt_uint8_t check_i = 0;
-    static rt_uint8_t power_i = 0;
-    while(1)
-    {
-        time_t now_t;
-        time(&now_t);
-        static struct tm now_tm;   //现在
-        //获取当前时间戳
-        now_tm =*localtime(&now_t);
-        if(atoi(device_status.net)==0 || (now_tm.tm_year+1900 >=2025))    //当前时间大于2024
-        {
-            if(device_status.rain_status==1||device_status.temp_status==1)
-            {
-                if(check_i==0)
-                {
-                    check_i = 1;
-                    device_status.num_updata = 0;
-                }
-            }
-            else {
-                check_i = 0;
-            }
-            if(device_status.num_updata!=0)
-            {
-                device_status.num_updata--;
-                //屏幕休眠
-                if(device_status.num_updata==(device_status.dattim * 60-10))
-                {
-                    HMI_WRITE("sleep=%d",1);
-                }
-                LOG_I("掉电检测:%d-%d",atoi(device_status.voltage),device_status.power_status);
-                //检测到电源掉电
-                if(atoi(device_status.voltage)<5&&device_status.power_status==1)
-                {
-                    power_i++;
-                    //确定网络状态
-                    if(power_i==10)
-                    {
-                        device_status.bat_status = 1;
-                        rt_sprintf(device_status.net, "1");
-                        HMI_WRITE("sleep=%d",1);    //屏幕休眠
-                        DTU_Write("%s",makeJson_Warn("power down","power"));
-                        device_status.power_status = 0;
-                        rt_thread_delay(5000);
-                        ctr_router(OFF);
-                        ctr_RTU_DTU(OFF);
-                        power_i = 0;
-                    }
-                }
-                if(atoi(device_status.voltage)>12&&device_status.power_status==0)      //电压正常
-                {
-                    device_status.power_status = 1;
-                    //重启
-                    rt_hw_cpu_reset();
-                }
-                if(device_status.work_status==1&&device_status.num_updata%10==0&&atoi(device_status.power)>20)    //每过10S把电流值存入数组,连续10条数据的电流值大于400mA判断为正常
-                {
-                    current_arry[record_current] = atoi(device_status.power);
-                    record_current++;
-                    if(record_current==10)
-                    {
-                        record_current = 0;
-                        if(hasElementGreaterThan400(current_arry, 10)==0)   //连续10条电流值大于400,灯管状态正常
-                        {
-                            device_status.lamp = 0;
-                            lamp_sta_cnt = 0;
-                            device_status.C01 &= ~(1<<0);   //灯管 正常
-                        }
-                        if(hasElementGreater_lessThan400(current_arry,10)==0)   //连续10条电流值小于400,灯管状态异常
-                        {
-                            lamp_sta_cnt++;
-                        }
-                        if(lamp_sta_cnt>=3){
-                            lamp_sta_cnt = 0;
-                            device_status.lamp = 1;
-                            device_status.C01 |= (1<<0);    //灯管 故障
-                        }
-                        memset(current_arry,0,sizeof(current_arry));
-                    }
-                }
-            }
-            else {
-                char *readinfo =  makeJson_ReadInfo();
-                DTU_Write("%s",readinfo);
-                rt_free(readinfo);
-                rt_thread_delay(1000);
-                UpLoad_Data();
-                if(atoi(device_status.fuse_voltage)<1)
-                {
-                    rt_thread_delay(500);
-                    static char res[30];
-                    sprintf(res, "Fuse is fusing:%s",device_status.fuse_voltage);
-                    char * res_fuse_warn = makeJson_Warn(res,"device");
-                    DTU_Write("%s",res_fuse_warn);
-                    rt_free(res_fuse_warn);
-                }
-                device_status.num_updata = device_status.dattim * 60;
-                if(device_status.dattim==0) device_status.dattim=20;   //数据上传时间间隔设置为0?
-                if(device_status.bat_status==0) device_status.power_status = 1;     //解除欠压,清除标志位
-            }
-        }
-    else {
-            wait_i ++;
-            LOG_I("wait connect internet......%d",wait_i);
-            //检测到电源掉电
-            if(Read_Real_Voltage()/100<5&&device_status.power_status==1&&wait_i>200)
-            {
-                check_i++;
-                LOG_W("断网状态下检测到设备断电!%d",atoi(device_status.voltage));
-                if(check_i==10)
-                {
-                    device_status.bat_status = 1;
-                    device_status.power_status = 0;
-                    rt_thread_delay(5000);
-                    ctr_router(OFF);
-                    ctr_RTU_DTU(OFF);
-                    check_i = 0;
-                }
-            }
-            if(Read_Real_Voltage()/100>10&&device_status.power_status==0)
-            {
-                check_i = 0;
-                LOG_I("电源恢复正常,打开路由器和RTU供电!");
-                device_status.power_status = 1;
-                //打开路由器和RTU供电
-                ctr_router(ON);
-                ctr_RTU_DTU(ON);
-            }
-        }
-    rt_thread_mdelay(1000);
-    }
-}
 
 /* 创建线程 */
 int dtu_data_play(void)
@@ -1190,7 +1033,6 @@ int Parse_Cam_Param(cJSON *param_msg)
 //JSON数据解析
 int parseDtu(char *json_string)
 {
-    char* json_s = NULL;
     cJSON *root = cJSON_Parse(json_string);
     if(!root)
     {
@@ -1200,7 +1042,35 @@ int parseDtu(char *json_string)
     }
     else
     {
-        LOG_I("JSON[%s]",root->valuestring);
+        LOG_I("解析JSON:%s",json_string);
+        cJSON *item1 = cJSON_GetObjectItem(root,"UART4");
+        cJSON *item2 = cJSON_GetObjectItem(root,"write");
+        cJSON *item3 = cJSON_GetObjectItem(root,"message");
+        cJSON *item4 = cJSON_GetObjectItem(root,"status");
+        cJSON *item5 = cJSON_GetObjectItem(root,"UART2");
+        if(item1!=RT_NULL&&
+                item2!=RT_NULL&&
+                item3!=RT_NULL&&
+                item4!=RT_NULL)
+        {
+            check_results.UATR_2_RX_STA = 0;
+            check_results.UATR_4_TX_STA = 0;
+        }else {
+            check_results.UATR_2_RX_STA = 1;
+            check_results.UATR_4_TX_STA = 1;
+        }
+
+        if(item5!=RT_NULL&&
+                item2!=RT_NULL&&
+                item3!=RT_NULL&&
+                item4!=RT_NULL)
+        {
+            check_results.UATR_2_TX_STA = 0;
+            check_results.UATR_4_RX_STA = 0;
+        }else {
+            check_results.UATR_2_TX_STA = 1;
+            check_results.UATR_4_RX_STA = 1;
+        }
         cJSON_Delete(root);
     }
     return 0;

+ 194 - 14
Application_cbd_apm32f1/applications/hmi.c

@@ -44,10 +44,6 @@
 
 static char msg_pool[512];
 
-static char rx_buffer[HMI_UART_RXBUFFER_SIZE + 1];
-
-static USHORT sound122[] = {0x736f,0x756e,0x6431,0x3232};
-
 void list_mem(void);
 int mb_master_samlpe();
 /**/
@@ -131,8 +127,8 @@ void HMI_WRITE(char *fmt, ...)
     if (str_length > MAX_SIZE - 3)
         str_length = MAX_SIZE - 3;
     // 追加三个 0xff
-    memcpy(str + str_length, hmi_hex, sizeof(hmi_hex));
-    rt_device_write(serial, 0, str, str_length + sizeof(hmi_hex));
+    //memcpy(str + str_length, hmi_hex, sizeof(hmi_hex));
+    rt_device_write(serial, 0, str, str_length);
     rt_thread_mdelay(1);    //2025-0308
 }
 /* 接收数据回调函数 */
@@ -161,6 +157,10 @@ static void Hmi_thread_entry(void *parameter)
     struct rx_msg msg;
     rt_err_t result;
     rt_uint32_t rx_length;
+    static char str_check[2]={'{','}'};
+    static char rx_buffer[512];
+    static char rx_buffer_tmp[512];
+    static char rx_buffer_tmp2[512];
     while(1)
     {
         rt_memset(&msg, 0, sizeof(msg));
@@ -169,11 +169,38 @@ static void Hmi_thread_entry(void *parameter)
         if (result == RT_EOK)
         {
 
-                rx_length = rt_device_read(msg.dev, 0, rx_buffer, msg.size);
-                rx_buffer[rx_length] = '\0';
-                LOG_I("HMI RX:%s",rx_buffer);
-                //\r 对应的hex为0x0d,0x0a,占两个字节,屏幕发送的数据都以\r结尾
-                //HMI_Decode();
+            rx_length =(sizeof(rx_buffer) - 1) > msg.size ?
+                    msg.size : sizeof(rx_buffer) - 1;
+            rx_length = rt_device_read(msg.dev, 0, &rx_buffer[0], rx_length);
+            rx_buffer[rx_length] = '\0';
+            LOG_D("UART4 RECV:%s",rx_buffer);
+
+            char str_check_head[2];
+            char str_check_end[2];
+            rt_sprintf(str_check_head, "%c",rx_buffer[0]);
+            rt_sprintf(str_check_end, "%c",rx_buffer[rx_length-1]);
+            if(str_check_end[0]==str_check[1]&&str_check_head[0]==str_check[0])
+            {
+                  parseDtu(rx_buffer);
+                  rt_memset(rx_buffer,0,sizeof(rx_buffer));
+                  rt_memset(rx_buffer_tmp,0,sizeof(rx_buffer_tmp));
+                  rt_memset(rx_buffer_tmp2,0,sizeof(rx_buffer_tmp2));
+            }
+            else {
+                   if(rx_buffer[rx_length-1]!='}')
+                   {
+                       rt_sprintf(rx_buffer_tmp, "%s",rx_buffer);
+                   }
+                   else {
+                       rt_sprintf(rx_buffer_tmp2,"%s",rx_buffer);
+                       rt_sprintf(rx_buffer, "%s%s",rx_buffer_tmp,rx_buffer_tmp2);
+                       parseDtu(rx_buffer);
+                       rt_memset(rx_buffer,0,sizeof(rx_buffer));
+                       rt_memset(rx_buffer_tmp,0,sizeof(rx_buffer_tmp));
+                       rt_memset(rx_buffer_tmp2,0,sizeof(rx_buffer_tmp2));
+                   }
+             }
+
         }
     }
 }
@@ -236,6 +263,7 @@ int Hmi_Fresh(void)
 
 void Check_ParamConfig(void)
 {
+    EfErrCode ec_ef= 0;
     uint16_t current_1 = 0;
     ctr_photo(OFF);
     sht30_collect();
@@ -251,16 +279,29 @@ void Check_ParamConfig(void)
     }
     LOG_I("Flash写测试...");
     /* 设置一个名为 ‘test_key’ 的变量,值为 ‘20250826’ */
-    ef_set_and_save_env("testkey", "20250826");
-    LOG_I("Flash写完成...");
+    ec_ef = ef_set_and_save_env("testkey", "20250826");
+
+    if(ec_ef==EF_NO_ERR){
+        check_results.FLASH_WRITE_STA = 0;
+        LOG_I("Flash写完成...");
+    }else {
+        check_results.FLASH_WRITE_STA = 1;
+        LOG_I("Flash写失败...%d",ec_ef);
+    }
     LOG_I("Flash读测试...");
     /* 读取字符串 */
     size_t len;
     char *value;
     value = ef_get_env("testkey");
     if (value) {
+         if(strstr(value,"20250826")!=RT_NULL) {
+             check_results.FLASH_READ_STA = 0;
+         }else {
+             check_results.FLASH_READ_STA = 1;
+         }
          LOG_I("test_key value: %s (len=%d)\n", value, sizeof(value));
      } else {
+         check_results.FLASH_READ_STA = 1;
          LOG_E("test_key not found!\n");
      }
     LOG_I("串口通信测试...");
@@ -273,24 +314,29 @@ void Check_ParamConfig(void)
     current_1  = atoi(device_status.heat_power);
     if(current>100)
     {
+        check_results.CURRENT_24V_STA = 1;
         LOG_E("负载电流异常!");
         Beep_Tip(2000);
         return;
     }
     if(voltage_<=23)
     {
+        check_results.VOLTAGE_24V_STA = 1;
         LOG_E("电压异常!");
         Beep_Tip(2000);
         return;
     }
+
     if(current_1>0)
     {
+        check_results.CURRENT_24V_STA = 1;
         LOG_E("负载电流1异常!");
         Beep_Tip(2000);
         return;
     }
 
-
+    check_results.VOLTAGE_24V_STA = 0;
+    check_results.CURRENT_24V_STA = 0;
     LOG_I("打开24V输出通道1!");
     ctr_lamp(ON, 1);
     rt_thread_delay(5000);
@@ -416,6 +462,140 @@ void Check_ParamConfig(void)
         check_results.OP_MOTOR_3_STA = 1;
     }
 
+    rt_thread_delay(5000);
+    LOG_I("打开12V输出通道1...");
+    ctr_router(ON);
+    rt_thread_delay(5000);
+    current_ = atoi(device_status.power);
+    rt_sprintf(check_results.OP_12V_1,"%s",device_status.power);
+    LOG_I("12V输出通道1负载电流:[%d]mA",current_);
+    LOG_I("关闭12V输出通道1...");
+    ctr_router(OFF);
+    if(current_-current>800)
+    {
+        LOG_W("12V输出通道1正常!");
+        check_results.OP_12V_1_STA = 0;
+    }else {
+        LOG_W("12V输出通道1负载电流异常!");
+        check_results.OP_12V_1_STA = 1;
+    }
+
+    rt_thread_delay(5000);
+    LOG_I("打开12V输出通道2...");
+    ctr_photo(ON);
+    rt_thread_delay(5000);
+    current_ = atoi(device_status.power);
+    rt_sprintf(check_results.OP_12V_2,"%s",device_status.power);
+    LOG_I("12V输出通道2负载电流:[%d]mA",current_);
+    LOG_I("关闭12V输出通道2...");
+    ctr_photo(OFF);
+    if(current_-current>700)
+    {
+        LOG_W("12V输出通道2正常!");
+        check_results.OP_12V_2_STA = 0;
+    }else {
+        LOG_W("12V输出通道2负载电流异常!");
+        check_results.OP_12V_2_STA = 1;
+    }
+
+    rt_thread_delay(5000);
+    LOG_I("打开5V输出通道1...");
+    ctr_led(ON);
+    rt_thread_delay(5000);
+    current_ = atoi(device_status.power);
+    rt_sprintf(check_results.OP_5V_1,"%s",device_status.power);
+    LOG_I("5V输出通道1负载电流:[%d]mA",current_);
+    LOG_I("关闭5V输出通道1...");
+    ctr_led(OFF);
+    if(current_-current>200)
+    {
+        LOG_W("5V输出通道1正常!");
+        check_results.OP_5V_1_STA = 0;
+    }else {
+        LOG_W("5V输出通道1负载电流异常!");
+        check_results.OP_5V_1_STA = 1;
+    }
+
+    LOG_W("********自检结果:");
+    LOG_W("********电压:%s %s",
+          device_status.voltage,
+          check_results.VOLTAGE_24V_STA ? "异常" : "正常");
+    LOG_W("********电流:%s %s",
+          device_status.power,
+          check_results.CURRENT_24V_STA ? "异常" : "正常");
+
+    LOG_W("********Flash写入:%s",
+          check_results.FLASH_WRITE_STA ? "异常" : "正常");
+
+    LOG_W("********Flash读取:%s",
+          check_results.FLASH_READ_STA ? "异常" : "正常");
+
+    LOG_W("********ADC_1:%d %s",
+            check_results.ADC_1,
+          check_results.ADC1_STA ? "异常" : "正常");
+
+    LOG_W("********ADC_2:%d %s",
+            check_results.ADC_2,
+          check_results.ADC2_STA ? "异常" : "正常");
+
+    LOG_W("********ADC_3:%d %s",
+            check_results.ADC_3,
+          check_results.ADC3_STA ? "异常" : "正常");
+
+
+    LOG_W("********UART2RX:%s %s",
+          device_status.power,
+          check_results.UATR_2_RX_STA ? "异常" : "正常");
+    LOG_W("********UART2TX:%s %s",
+          device_status.power,
+          check_results.UATR_2_TX_STA ? "异常" : "正常");
+    LOG_W("********UART4RX:%s %s",
+          device_status.power,
+          check_results.UATR_4_RX_STA ? "异常" : "正常");
+
+    LOG_W("********UART4TX:%s %s",
+          device_status.power,
+          check_results.UATR_4_TX_STA ? "异常" : "正常");
+    LOG_W("********24V通道1负载电流:%s %s",
+          check_results.OP_24V_1,
+          check_results.OP_24V_1_STA ? "异常" : "正常");
+
+    LOG_W("********24V通道2负载电流:%s %s",
+          check_results.OP_24V_2,
+          check_results.OP_24V_2_STA ? "异常" : "正常");
+
+    LOG_W("********24V通道3负载电流:%s %s",
+          check_results.OP_24V_3,
+          check_results.OP_24V_3_STA ? "异常" : "正常");
+
+    LOG_W("********24V通道4负载电流:%s %s",
+          check_results.OP_24V_4,
+          check_results.OP_24V_4_STA ? "异常" : "正常");
+
+    LOG_W("********12V通道1负载电流:%s %s",
+          check_results.OP_12V_1,
+          check_results.OP_12V_1_STA ? "异常" : "正常");
+
+    LOG_W("********12V通道2负载负载电流:%s %s",
+          check_results.OP_12V_2,
+          check_results.OP_12V_2_STA ? "异常" : "正常");
+
+    LOG_W("********5V通道1负载电流:%s %s",
+          check_results.OP_5V_1,
+          check_results.OP_5V_1_STA ? "异常" : "正常");
+
+    LOG_W("********电机驱动通道1负载电流:%s %s",
+          check_results.OP_MOTOR_1,
+          check_results.OP_MOTOR_1_STA ? "异常" : "正常");
+
+    LOG_W("********电机驱动通道2负载电流:%s %s",
+          check_results.OP_MOTOR_2,
+          check_results.OP_MOTOR_2_STA ? "异常" : "正常");
+
+    LOG_W("********电机驱动通道3负载电流:%s %s",
+          check_results.OP_MOTOR_3,
+          check_results.OP_MOTOR_3_STA ? "异常" : "正常");
+
 }
 
 

+ 23 - 45
Application_cbd_apm32f1/applications/sht30_collect.c

@@ -59,6 +59,8 @@ static rt_thread_t tid1 = RT_NULL;
 static rt_thread_t tid2 = RT_NULL;
 
 ADC_HandleTypeDef hadc1;
+CheckResult check_results;
+
 
 int Read_Heat_Current(void);
 
@@ -147,50 +149,41 @@ int UART_485_INIT(void)
 /* 入口函数 */
 static void sht30_collect_thread_entry(void *parameter)
 {
-    static int checklightnum = 0;
-    static int checknightnum = 0;
     while (1)
     {
-        if(Read_Light_Voltage()>500)
+        check_results.ADC_1 = Read_Light_Voltage();
+        check_results.ADC_2 = Read_Rain_Voltage();
+        check_results.ADC_3 = Read_Ntc_Voltage();
+        if(check_results.ADC_1>2500&check_results.ADC_1<2600)
         {
-            checklightnum++;
-            if(checklightnum==20)
-            {
-                device_status.sun_status = 1;
-                device_status.C01 |= (1<<6);
-                checklightnum =0;
-            }
-
-        }
-        else {
-            checknightnum ++;
-            if(checknightnum==20)
-            {
-                device_status.C01 &= ~(1<<6);
-                device_status.sun_status = 0;
-                checknightnum = 0;
-            }
+            check_results.ADC1_STA = 0;
+        }else {
+            check_results.ADC1_STA = 1;
         }
-        //温控
-        if(atoi(device_status.tempture)>=device_status.tph||atoi(device_status.tempture)<=device_status.tpl)
+
+        if(check_results.ADC_2>2500&check_results.ADC_2<2600)
         {
-            device_status.C01 |= (1<<7);
-            device_status.temp_status = 1;
+            check_results.ADC2_STA = 0;
+        }else {
+            check_results.ADC2_STA = 1;
         }
-        else if(atoi(device_status.tempture)>=(device_status.tpl+5)&&atoi(device_status.tempture)<=(device_status.tph-10))
+
+        if(check_results.ADC_3>2500&check_results.ADC_3<2600)
         {
-            device_status.C01 &= ~(1<<7);
-            device_status.temp_status = 0;
+            check_results.ADC3_STA = 0;
+        }else {
+            check_results.ADC3_STA = 1;
         }
+
         LOG_I("电压:%s,电流:%s,电流2:%s",device_status.voltage,device_status.power,device_status.heat_power);
+        LOG_I("ADC_LIGHT:%d,ADC_RAIN:%d,ADC_TEMPTURE:%d",check_results.ADC_1,check_results.ADC_2,check_results.ADC_3);
+        LOG_I("MCU温度:%d.%d℃",Get_Temprate()/100,Get_Temprate()%100);
         rt_thread_mdelay(5000);
     }
 }
 
 static void Power_ReadCheck(void *parameter)
 {
-    int rain_cnt = 0;
-    int bat_cnt = 0;
     int RV;
     MovingAverageFilter* filter = moving_average_filter_init(6);
     //MovingAverageFilter* filter_hi = moving_average_filter_init(10);
@@ -224,22 +217,6 @@ static void Power_ReadCheck(void *parameter)
         #endif
         //LOG_I("负载电流:%s,加热电流:%s",device_status.power,device_status.heat_power);
         //
-        if(device_status.dtype==3)
-        {
-            RV = 10000 * (4096 - Read_Ntc_Voltage()) / Read_Ntc_Voltage();
-            if(TempCalculate(RV, 3950, 10000)-TempCalculate(RV, 3950, 10000)>10)
-            {
-                LOG_E("temp value err!!!!");
-            }
-            else {
-                device_status.heattem = TempCalculate(RV, 3950, 10000);
-                if(device_status.heattem>160)
-                {
-                    device_status.heattem = 25;
-                }
-            }
-
-        }
         //rt_sprintf(device_status.voltage,"%d.%02d",filter_voltage()/100,filter_voltage()%100);
         rt_uint16_t in_voltage_int = moving_average_filter_update(filter_v,Read_Real_Voltage());
         sprintf(device_status.voltage,"%d.%02d",in_voltage_int/100,in_voltage_int%100);
@@ -374,6 +351,7 @@ int Read_Light_Voltage(void)
        //LOG_I("read light value:%d",adc10_rain);
        return adc10_rain;
 }
+
 //获取内部温度传感器值
 short Get_Temprate(void)
 {