Parcourir la source

2.4.3 采集分钟

zhunk il y a 1 an
Parent
commit
7474912585

+ 10 - 6
Application_cbd_apm32f1/applications/control.c

@@ -931,7 +931,7 @@ void HardWare_Check(uint8_t boot)
  * 循环判断定时的触发
  *
  */
-u_int8_t alarmCheck(u_int8_t starthour,u_int8_t endhour)
+u_int8_t alarmCheck(u_int8_t starthour,u_int8_t endhour,u_int8_t startmin,u_int8_t endmin)
 {
     u_int8_t workflag = 0;
     if(starthour == endhour) return workflag;
@@ -939,9 +939,13 @@ u_int8_t alarmCheck(u_int8_t starthour,u_int8_t endhour)
     time(&now);
     struct tm now_tm = *localtime(&now);
     rt_uint32_t curr_sec = now_tm.tm_hour*3600 + now_tm.tm_min*60 + now_tm.tm_sec;
-    rt_uint32_t start_sec = starthour * 3600;
-    rt_uint32_t end_sec = endhour * 3600;
+    rt_uint32_t start_sec = starthour * 3600 + startmin * 60;
+    rt_uint32_t end_sec = endhour * 3600 + endmin * 60;
 
+    // 处理开始和结束时间相同的情况
+     if (start_sec == end_sec) {
+         workflag =  0;
+     }
     // 修复跨天判断逻辑
     if (start_sec < end_sec)
     {
@@ -1006,7 +1010,7 @@ static void Work_status_thread_entry(void *parameter)
 {
      while(device_status.ds==1)
      {
-         while(alarmCheck(device_status.collecting_sh1,device_status.collecting_eh1) == ON)
+         while(alarmCheck(device_status.collecting_sh1,device_status.collecting_eh1,device_status.collt_min_sh1,device_status.collt_min_eh1) == ON)
          {
              device_status.work_status = 1;
              LOG_I("the alarm1 workflag was ON");
@@ -1015,7 +1019,7 @@ static void Work_status_thread_entry(void *parameter)
          }
          //如果当前时间大于collecting_eh1,开始拍照
 
-         while(alarmCheck(device_status.collecting_sh2,device_status.collecting_eh2) == ON)
+         while(alarmCheck(device_status.collecting_sh2,device_status.collecting_eh2,device_status.collt_min_sh2,device_status.collt_min_eh2) == ON)
          {
            device_status.work_status = 1;
            device_status.work_done=1;
@@ -1024,7 +1028,7 @@ static void Work_status_thread_entry(void *parameter)
          }
          //如果当前时间大于collecting_eh2,开始拍照
 
-         while(alarmCheck(device_status.collecting_sh3,device_status.collecting_eh3) == ON)
+         while(alarmCheck(device_status.collecting_sh3,device_status.collecting_eh3,device_status.collt_min_sh3,device_status.collt_min_eh3) == ON)
          {
              device_status.work_status = 1;
              device_status.work_done=1;

+ 7 - 1
Application_cbd_apm32f1/applications/control.h

@@ -17,7 +17,7 @@
 #define SENSOR_EN        0              //温湿度:0关闭,1打开
 ////////////////////////////////////////////////////////////////
 
-#define VERSION_BZY         "2.3.1"                   //孢子仪
+#define VERSION_BZY         "2.4.1"                   //孢子仪
 
 
 /*********************************************************************/
@@ -41,11 +41,17 @@ typedef struct  _packed
     uint8_t cool_fan_status;      //散热风机状态 0-停止 1-打开
     uint8_t fsl_sw;               //凡士林开关:0-关,1-开
     uint8_t collecting_sh1;       //采集开启1
+    uint8_t collt_min_sh1;
     uint8_t collecting_eh1;       //采集关闭1
+    uint8_t collt_min_eh1;
     uint8_t collecting_sh2;       //采集开启2
+    uint8_t collt_min_sh2;
     uint8_t collecting_eh2;       //采集关闭2
+    uint8_t collt_min_eh2;
     uint8_t collecting_sh3;       //采集开启3
+    uint8_t collt_min_sh3;
     uint8_t collecting_eh3;       //采集关闭3
+    uint8_t collt_min_eh3;
     /*测报灯*/
     uint8_t heat_sw;         //加热开关
     uint8_t photo_ws;        //拍照

+ 67 - 352
Application_cbd_apm32f1/applications/dtu_uart2.c

@@ -727,24 +727,20 @@ int Parse_Cam_Param(cJSON *param_msg)
 //JSON数据解析
 int parseDtu(char *json_string)
 {
-    extern int rt_hw_rtc_init(void);
     char* json_s = NULL;
     cJSON* item_cmd = NULL;    //嵌套ext
     cJSON* item_focus = NULL;
     cJSON* item_ext = NULL;    //嵌套ext
     cJSON* photo_sta = NULL;
-    cJSON* hst  = NULL; //加热温度
+
     cJSON* collt  = NULL; //收集时间
-    cJSON* et  = NULL; //结束时间
+
     cJSON* datt  = NULL; //数据上传间隔
-    cJSON* shake_sec  = NULL; //震动时间
+
     cJSON* tpl  = NULL; //低温保护阈值
-    cJSON* shake  = NULL; //震动开关
+
     cJSON* tph  = NULL; //高温保护阈值
-    cJSON* ts  = NULL; //工作模式
-    cJSON* st  = NULL; //开始时间
-    cJSON* tt  = NULL; //光控定时时长
-    cJSON* htim = NULL; //加热时间
+
     cJSON* gps = NULL; //定位状态
     cJSON* datetime = NULL;
     cJSON* lat = NULL;
@@ -758,7 +754,6 @@ int parseDtu(char *json_string)
     cJSON* driver_4g = NULL;   //版本号
     cJSON* project = NULL;  //Project
     cJSON* ds = NULL;   //设备状态
-    cJSON* vt = NULL;   //版本类型
     cJSON* mqttcfg1 = NULL;
     cJSON* mqttcfg2 = NULL;
     cJSON* type =NULL;
@@ -892,35 +887,7 @@ int parseDtu(char *json_string)
                      }
                  }
               }
-              else if (strstr(item_cmd->valuestring,"json_w_clock")!=RT_NULL) {
-                  rt_kprintf("查询时间配置!\n");
-                  json_s = makeJson_Warn(device_status.json_w_clock, "主动查询");
-                  DTU_Write("%s",json_s);
-                  rt_free(json_s);
-                  rt_thread_delay(1000);
-              }
-              else if (strstr(item_cmd->valuestring,"json_w_reset")!=RT_NULL) {
-                  rt_kprintf("查询重置配置!\n");
-                  json_s = makeJson_Warn(device_status.json_w_reset, "主动查询");
-                  DTU_Write("%s",json_s);
-                  rt_free(json_s);
-                  rt_thread_delay(1000);
-              }
-              else if (strstr(item_cmd->valuestring,"json_w_platform")!=RT_NULL) {
-                  rt_kprintf("查询平台配置!\n");
-                  json_s = makeJson_Warn(device_status.json_w_platform, "主动查询");
-                  DTU_Write("%s",json_s);
-                  rt_free(json_s);
-                  rt_thread_delay(1000);
-              }
-              else if (strstr(item_cmd->valuestring,"shake")!=RT_NULL)
-              {
-                  ctr_shake(ON, 30);
-                  char *shake = makeJson_Warn("shake","control");
-                  DTU_Write("%s",shake);
-                  rt_free(shake);
-                  rt_thread_delay(2000);
-              }
+
               //远程给rtu重新上电
               else if (strstr(item_cmd->valuestring,"ctrl")!=RT_NULL)
               {
@@ -977,15 +944,6 @@ int parseDtu(char *json_string)
                   }
               }
 
-              //水稻2000万像素的串口拍照指令
-              else if (strstr(item_cmd->valuestring,"mvs_photo")!=RT_NULL)
-              {
-                  HK_TakePhoto();
-                  char *photo = makeJson_Warn("mvs_takephoto","control");
-                  DTU_Write("%s",photo);
-                  rt_free(photo);
-                  rt_thread_delay(2000);
-              }
               else if (strstr(item_cmd->valuestring,"reboot")!=RT_NULL)
               {
                   char *restart = makeJson_Warn("sysrem will restart","control");
@@ -1072,16 +1030,6 @@ int parseDtu(char *json_string)
                       }
                   }
               }
-              else if (strstr(item_cmd->valuestring,"color")!=RT_NULL)
-              {
-                  if(item_ext!=RT_NULL&&strstr(item_ext->valuestring,"turn")!=RT_NULL)
-                  {
-                      device_status.run_sta=5;
-                  }
-                  else {
-                    LOG_W("Unknow cmd value!");
-                  }
-              }
               else if (strstr(item_cmd->valuestring,"synchronization")!=RT_NULL)
               {
                   device_status.refresh_timeout=0;
@@ -1207,17 +1155,6 @@ int parseDtu(char *json_string)
                       rt_sprintf(device_status.gps,"%s",gps->valuestring);
                       if(atoi(gps->valuestring)!=0)
                       {
-                          #if BOOT_ERR == 1
-                           if(atoi(gps->valuestring)==1)
-                           rt_sprintf(device_status.gps_state, "%s","GPS+BD");
-
-                          if(gps_inuse!=NULL){
-                              device_status.gps_inuse = atoi(gps_inuse->valuestring);
-                          }
-                          if(gps_view!=NULL){
-                              device_status.gps_view = atoi(gps_view->valuestring);
-                          }
-                          #endif
                           if(strstr(device_status.lat,lat->valuestring)==NULL)
                           {
                               memset(device_status.lat,0,sizeof(device_status.lat));
@@ -1296,36 +1233,20 @@ int parseDtu(char *json_string)
               }
               if(item_ext!=RT_NULL&&strstr(item_cmd->valuestring,"paramconf")!=RT_NULL)
               {
-                          if(device_status.dtype==3)
-                          hst = cJSON_GetObjectItem(item_ext,"hst");
-                          if(device_status.dtype==7)
-                          hst = cJSON_GetObjectItem(item_ext,"set_temp");
-
-                          et  = cJSON_GetObjectItem(item_ext,"et");
                           datt = cJSON_GetObjectItem(item_ext,"datt");
-
-                          shake_sec = cJSON_GetObjectItem(item_ext,"shake_sec");
                           tpl = cJSON_GetObjectItem(item_ext,"tpl");
-                          shake = cJSON_GetObjectItem(item_ext,"shake");
-                          tph = cJSON_GetObjectItem(item_ext,"tph");
-                          ts = cJSON_GetObjectItem(item_ext,"ts");
-                          st = cJSON_GetObjectItem(item_ext,"st");
-                          tt = cJSON_GetObjectItem(item_ext,"tt");
-                          htim = cJSON_GetObjectItem(item_ext,"htim");
+
                           if(device_status.dtype==3)
                           ds = cJSON_GetObjectItem(item_ext,"ds");
-                          vt = cJSON_GetObjectItem(item_ext,"vt");
 
-                          if(device_status.dtype==3)
-                          collt = cJSON_GetObjectItem(item_ext,"collt");
 
                           if(device_status.dtype==7)
                           ds = cJSON_GetObjectItem(item_ext,"on_off");
                           if(device_status.dtype==7)
                           collt = cJSON_GetObjectItem(item_ext,"coll_time");    //收集(数组格式)
 
-                          cJSON* cul_time = cJSON_GetObjectItem(item_ext,"cul_time");   //培养时间1~24
-                          cJSON* drop_sec = cJSON_GetObjectItem(item_ext,"drop_time");
+                          cJSON* coll_min = cJSON_GetObjectItem(item_ext,"coll_min");   //采集分钟,数组格式
+
                           cJSON* x_init_dis= cJSON_GetObjectItem(item_ext,"x_init_dis");
                           cJSON* y_init_dis= cJSON_GetObjectItem(item_ext,"y_init_dis");
                           if(x_init_dis!=NULL)
@@ -1346,133 +1267,69 @@ int parseDtu(char *json_string)
 
                                }
                           }
-                          if(drop_sec!=NULL)
-                          {
-                              if(drop_sec->valueint>=1&&drop_sec->valueint<=300)
-                              {
-                                  device_status.shake_sec = drop_sec->valueint;
-                                  ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec)); //培养时间
-                                  LOG_I("下发设置滴液时间:%d",drop_sec->valueint);
-                              }
-                          }
-                          if(cul_time!=NULL)
-                          {
-                              if(cul_time->valueint>=1&&cul_time->valueint<=24)
-                              {
-                                  device_status.cul_time = cul_time->valueint;
-                                  ef_set_env_blob("cul_time", &device_status.cul_time, sizeof(device_status.cul_time)); //培养时间
-                                  LOG_I("下发设置培养时间:%d",cul_time->valueint);
-                              }
-                          }
-                          /*加热温度*/
-                          if(hst!=NULL)
-                          {
-                              if(hst->type==cJSON_Number)
-                              {
-                                  if(hst->valueint>=10&&hst->valueint<=150)
-                                  {
-                                      device_status.heatvalue = hst->valueint;
-                                      ef_set_env_blob("jheat", &device_status.heatvalue, sizeof(device_status.heatvalue));   //开始时间
-                                      LOG_I("加热温度hst:%d",hst->valueint);
-                                  }
-                                  else {
-                                      LOG_E("加热温度hst设置失败参数错误!!!");
-                                }
-                              }
-                              else {
-                                  if(atoi(hst->valuestring)>10&&atoi(hst->valuestring)<150)
-                                  {
-                                      device_status.heatvalue=atoi(hst->valuestring);
-                                      ef_set_env_blob("jheat", &device_status.heatvalue, sizeof(device_status.heatvalue));      //加热温度
-                                      LOG_I("加热温度hst:%d",atoi(hst->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("加热温度hst设置失败参数错误!!!");
-                                }
-                            }
-
-                          }
-#if 1  //三色光源无法修改开始和结束时间
-                          if (st!=NULL)
-                          {
-                              if(st->type==cJSON_Number)
-                              {
-                                  if(st->valueint>=0&&st->valueint<=23)
-                                  {
-                                      device_status.startBar = st->valueint;
-                                      ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar));   //开始时间
-                                      LOG_I("开始时间st:%d",st->valueint);
-                                  }
-                                  else {
-                                      LOG_E("开始时间st设置失败参数错误!!!");
-                                  }
-                              }
-                              else {
-                                  if(atoi(st->valuestring)>=0&&atoi(st->valuestring)<=23)
-                                  {
-                                      device_status.startBar = atoi(st->valuestring);
-                                      ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar));   //开始时间
-                                      LOG_I("开始时间st:%d",atoi(st->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("开始时间st设置失败参数错误!!!");
-                                  }
-                              }
-
-                          }
-                          if(et!=NULL)
-                          {
-                              if(et->type==cJSON_Number)
-                              {
-                                  if(et->valueint>=0&&et->valueint<=23)
-                                  {
-                                      device_status.stopBar = et->valueint;
-                                      ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar));      //结束时间
-                                      LOG_I("结束时间et:%d",et->valueint);
-                                  }
-                                  else {
-                                      LOG_E("结束时间et设置失败参数错误!!!");
-                                  }
-                              }
-                              else if(et->type==cJSON_String){
-                                  if(atoi(et->valuestring)>=0&&atoi(et->valuestring)<=23)
-                                  {
-                                      device_status.stopBar = atoi(et->valuestring);
-                                      ef_set_env_blob("stopBar", &device_status.stopBar, sizeof(device_status.stopBar));      //结束时间
-                                      LOG_I("结束时间et:%d",atoi(et->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("结束时间et设置失败参数错误!!!");
+                          if(coll_min!=NULL){
+                              if(coll_min->type==cJSON_Array) {
+                                  // 获取数组大小
+                                  int array_size = cJSON_GetArraySize(coll_min);
+                                  // 遍历数组中的所有元素
+                                  for (int i = 0; i < array_size; i++){
+                                      cJSON *item = cJSON_GetArrayItem(coll_min, i);
+                                      if (cJSON_IsString(item) && item->valuestring != NULL) {
+                                          char *range_str = item->valuestring;
+                                          char *delimiter = strchr(range_str, '-');
+                                          if (delimiter != NULL) {
+                                              // 提取起始值和结束值
+                                              char min_st[5] = {0};
+                                              char min_et[5] = {0};
+                                              strncpy(min_st, range_str, delimiter - range_str);
+                                              strcpy(min_et, delimiter + 1);
+                                              int min_st_INT = atoi(min_st);
+                                              int min_et_INT = atoi(min_et);
+                                              if(i==0){
+                                                  if(min_st_INT<60&&min_st_INT>=0){
+                                                      device_status.collt_min_sh1 = min_st_INT;
+                                                      ef_set_and_save_env("collt_min_sh1", min_st);
+                                                  }
+
+                                                  if(min_et_INT<60&&min_et_INT>=0){
+                                                      device_status.collt_min_eh1 = min_et_INT;
+                                                      ef_set_and_save_env("collt_min_eh1", min_et);
+                                                  }
+                                                  LOG_W("第1段开始:%d 第1段结束:%d",device_status.collt_min_sh1,
+                                                          device_status.collt_min_eh1);
+                                              }else if (i==1) {
+                                                  if(min_st_INT<60&&min_st_INT>=0){
+                                                      device_status.collt_min_sh2 = min_st_INT;
+                                                      ef_set_and_save_env("collt_min_sh2", min_st);
+                                                  }
+                                                  if(min_et_INT<60&&min_et_INT>=0){
+                                                      device_status.collt_min_eh2 = min_et_INT;
+                                                      ef_set_and_save_env("collt_min_eh2", min_et);
+                                                  }
+                                                  LOG_W("第2段开始:%d 第2段结束:%d",device_status.collt_min_sh2,
+                                                          device_status.collt_min_eh2);
+
+                                              }else if (i==2) {
+                                                  if(min_st_INT<60&&min_st_INT>=0){
+                                                      device_status.collt_min_sh3 = min_st_INT;
+                                                      ef_set_and_save_env("collt_min_sh3", min_st);
+                                                  }
+                                                  if(min_et_INT<60&&min_et_INT>=0){
+                                                      device_status.collt_min_eh3 = min_et_INT;
+                                                      ef_set_and_save_env("collt_min_eh3", min_et);
+                                                  }
+                                                  LOG_W("第3段开始:%d 第3段结束:%d",device_status.collt_min_sh3,
+                                                          device_status.collt_min_eh3);
+                                              }
+                                          }
+                                      }
                                   }
                               }
                           }
-#endif
+                          /*加热温度*/
                           if(collt!=NULL)
                           {
-                              if(collt->type==cJSON_Number)
-                              {
-                                  if(collt->valueint>=1&&collt->valueint<=60)
-                                  {
-                                      device_status.clt_time = collt->valueint;
-                                      ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));      //收集时间
-                                      LOG_I("收集时间collt:%d",collt->valueint);
-                                  }
-                                  else {
-                                      LOG_E("收集时间collt设置失败参数错误!!!");
-                                  }
-                              }
-                              else if (collt->type==cJSON_String) {
-                                  if(atoi(collt->valuestring)>=1&&atoi(collt->valuestring)<=60)
-                                  {
-                                      device_status.clt_time = atoi(collt->valuestring);
-                                      ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));      //收集时间
-                                      LOG_I("收集时间collt:%d",atoi(collt->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("收集时间collt设置失败参数错误!!!");
-                                  }
-                              }
-                              else if (collt->type==cJSON_Array) {
+                              if (collt->type==cJSON_Array) {
                                  int icnt = 0;
                                  for(icnt=0;icnt < cJSON_GetArraySize(collt);icnt++)
                                  {
@@ -1585,130 +1442,7 @@ int parseDtu(char *json_string)
                               }
 
                           }
-                          if(shake_sec!=NULL)
-                          {
-                              if(shake_sec->type==cJSON_Number)
-                              {
-                                  if(shake_sec->valueint>=1&&shake_sec->valueint<=1000)
-                                  {
-                                      device_status.shake_sec = shake_sec->valueint;
-                                      ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec));      //震动时间
-                                      LOG_I("震动时间shake_sec:%d",shake_sec->valueint);
-                                  }
-                                  else {
-                                      LOG_E("震动时间shake_sec设置失败参数错误!!!");
-                                  }
-                              }
-                              else if (shake_sec->type==cJSON_String) {
-                                  if(atoi(shake_sec->valuestring)>=1&&atoi(shake_sec->valuestring)<=1000)
-                                  {
-                                      device_status.shake_sec = atoi(shake_sec->valuestring);
-                                      ef_set_env_blob("shake_sec", &device_status.shake_sec, sizeof(device_status.shake_sec));      //震动时间
-                                      LOG_I("震动时间shake_sec:%d",atoi(shake_sec->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("震动时间shake_sec设置失败参数错误!!!");
-                                  }
-                              }
-
-                          }
-                          if(shake!=NULL)
-                          {
-                              if(shake->type==cJSON_Number)
-                              {
-                                  if(shake->valueint==0||shake->valueint==1)
-                                  {
-                                      device_status.shake_ws = shake->valueint;
-                                      ef_set_env_blob("shake_ws", &device_status.shake_ws, sizeof(device_status.shake_ws));      //震动开关
-                                      LOG_I("震动开关shake:%d",shake->valueint);
-                                  }
-                                  else {
-                                      LOG_E("震动开关shake设置失败参数错误!!!");
-                                  }
-                              }
-                              else if (shake->type==cJSON_String) {
-                                  if(atoi(shake->valuestring)==0||atoi(shake->valuestring)==1)
-                                  {
-                                      device_status.shake_ws = atoi(shake->valuestring);
-                                      ef_set_env_blob("shake_ws", &device_status.shake_ws, sizeof(device_status.shake_ws));      //震动开关
-                                      LOG_I("震动开关shake:%d",atoi(shake->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("震动开关shake设置失败参数错误!!!");
-                                  }
-                              }
 
-                          }
-                          if(htim!=NULL)
-                          {
-                              if(htim->type==cJSON_Number)
-                              {
-                                  if(htim->valueint>=1&&htim->valueint<=30)
-                                  {
-                                      device_status.heattime = htim->valueint;
-                                      ef_set_env_blob("jtime", &device_status.heattime, sizeof(device_status.heattime));      //加热时间
-                                      LOG_I("加热时长htim:%d",htim->valueint);
-                                  }
-                                  else {
-                                      LOG_E("加热时长htim设置失败参数错误!!!");
-                                  }
-                              }
-                              else if (htim->type==cJSON_String) {
-                                  if(atoi(htim->valuestring)>=1&&atoi(htim->valuestring)<=30)
-                                  {
-                                      device_status.heattime = atoi(htim->valuestring);
-                                      ef_set_env_blob("jtime", &device_status.heattime, sizeof(device_status.heattime));      //加热时间
-                                      LOG_I("加热时长htim:%d",atoi(htim->valuestring));
-                                  }
-                                  else {
-                                      LOG_E("加热时长htim设置失败参数错误!!!");
-                                  }
-                              }
-                          }
-                          if(ts!=NULL)
-                          {
-                              if(ts->type==cJSON_Number)
-                              {
-                                  if(ts->valueint==0||ts->valueint==1)
-                                  {
-                                      device_status.timeSwitch = ts->valueint;
-                                      ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch)); //工作模式
-                                      //                                  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);
-                                      //                                  device_status.light_over_tim = device_status.sunBar * 3600 + nowstamp_num;
-                                      LOG_I("定时模式ts:%d",ts->valueint);
-                                  }
-                                  else {
-                                      LOG_E("定时模式ts设置失败参数错误!!!");
-                                  }
-                              }
-                              else if (ts->type==cJSON_String) {
-                                  if(atoi(ts->valuestring)==0||atoi(ts->valuestring)==1)
-                                  {
-
-                                      device_status.timeSwitch = atoi(ts->valuestring);
-                                      ef_set_env_blob("timeSwitch", &device_status.timeSwitch, sizeof(device_status.timeSwitch)); //工作模式
-                                      //                                  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);
-                                      //                                  device_status.light_over_tim = device_status.sunBar * 3600 + nowstamp_num;
-                                      LOG_I("定时模式ts:%d",atoi(ts->valuestring));
-                                  }
-                                  else {
-                                      LOG_I("定时模式ts设置失败参数错误!!!");
-                                  }
-                              }
-
-                          }
                           if(tpl!=NULL)
                           {
                               if(tpl->type==cJSON_Number)
@@ -1790,25 +1524,6 @@ int parseDtu(char *json_string)
                               }
 
                           }
-                          if(vt!=NULL)
-                          {
-                              if(atoi(vt->valuestring)>=0&&atoi(vt->valuestring)<=100)
-                              {
-                                  device_status.version_type = atoi(vt->valuestring);
-                                  ef_set_env_blob("version_type", &device_status.version_type, sizeof(device_status.version_type));
-                                  if(device_status.version_type==7)
-                                  {
-                                      device_status.dtype = 7;
-                                      ef_set_env_blob("dtype", &device_status.dtype, sizeof(device_status.dtype));
-                                  }
-                                  rt_kprintf("版本类型vt:%d\n",atoi(vt->valuestring));
-                              }
-                              else {
-                                  rt_kprintf("版本类型设置失败参数错误!!!\n");
-                            }
-                          }
-                          UpLoad_Data();
-                          rt_thread_delay(1000);
                }
           }
         cJSON_Delete(root);

+ 28 - 10
Application_cbd_apm32f1/applications/hmi.c

@@ -1618,7 +1618,12 @@ void Check_ParamConfig(void)
         ef_set_env_blob("handle_bugger", &device_status.handle_bugger, sizeof(device_status.handle_bugger));
         ef_set_env_blob("x_init_dis", &device_status.x_init_dis, sizeof(device_status.x_init_dis));
         ef_set_env_blob("y_init_dis", &device_status.y_init_dis, sizeof(device_status.y_init_dis));
-
+        ef_set_and_save_env("collt_min_sh1", "0");
+        ef_set_and_save_env("collt_min_eh1", "0");
+        ef_set_and_save_env("collt_min_sh2", "0");
+        ef_set_and_save_env("collt_min_eh2", "0");
+        ef_set_and_save_env("collt_min_sh3", "0");
+        ef_set_and_save_env("collt_min_eh3", "0");
         LOG_I("SOFTWARE VERSION:%s",device_status.driver);
         LOG_I("Default paramconf is:");
         LOG_I("stime:%d",device_status.iSave);
@@ -1678,7 +1683,14 @@ void Check_ParamConfig(void)
         ef_get_env_blob("deviceId",&device_status.deviceId,sizeof(device_status.deviceId),NULL);                    //设备编码
         ef_get_env_blob("handle_bugger",&device_status.handle_bugger,sizeof(device_status.handle_bugger),NULL);     //排虫
         ef_get_env_blob("x_init_dis",&device_status.x_init_dis,sizeof(device_status.x_init_dis),NULL);
-        ef_get_env_blob("y_init_dis",&device_status.y_init_dis,sizeof(device_status.y_init_dis),NULL);                                               //光控计数
+        ef_get_env_blob("y_init_dis",&device_status.y_init_dis,sizeof(device_status.y_init_dis),NULL);
+        ef_get_env_blob("collt_min_sh1", &device_status.collt_min_sh1, sizeof(device_status.collt_min_sh1), NULL);
+        ef_get_env_blob("collt_min_eh1", &device_status.collt_min_eh1, sizeof(device_status.collt_min_eh1), NULL);
+        ef_get_env_blob("collt_min_sh2", &device_status.collt_min_sh2, sizeof(device_status.collt_min_sh2), NULL);
+        ef_get_env_blob("collt_min_eh2", &device_status.collt_min_eh2, sizeof(device_status.collt_min_eh2), NULL);
+        ef_get_env_blob("collt_min_sh3", &device_status.collt_min_sh3, sizeof(device_status.collt_min_sh3), NULL);
+        ef_get_env_blob("collt_min_eh3", &device_status.collt_min_eh3, sizeof(device_status.collt_min_eh3), NULL);
+        //光控计数
         device_status.work_done = 0;
         //工作完成标志位
         if(device_status.dattim==0)
@@ -1717,7 +1729,13 @@ void Check_ParamConfig(void)
         LOG_I("温湿度数据:%d-%d",atoi(device_status.tempture),atoi(device_status.humidity));
         LOG_I("上传平台:%s",device_status.mqttcfg1);
         LOG_I("孢子仪运行状态:%d",device_status.run_sta);
-        LOG_I("孢子仪采集时间:[%d-%d,%d-%d,%d-%d]",device_status.collecting_sh1,device_status.collecting_eh1,device_status.collecting_sh2,device_status.collecting_eh2,device_status.collecting_sh3,device_status.collecting_eh3);
+        LOG_I("孢子仪采集时间:[%d:%d-%d:%d,%d:%d-%d:%d,%d:%d-%d:%d]",device_status.collecting_sh1,device_status.collt_min_sh1,
+                device_status.collecting_eh1,device_status.collt_min_eh1,
+                device_status.collecting_sh2,device_status.collt_min_sh2,
+                device_status.collecting_eh2,device_status.collt_min_eh2,
+                device_status.collecting_sh3,device_status.collt_min_sh3,
+                device_status.collecting_eh3,device_status.collt_min_eh3);
+
         LOG_I("PowerType:%d",device_status.Power_Type);
         LOG_I("x_init_dis:%d",device_status.x_init_dis);
         LOG_I("y_init_dis:%d",device_status.y_init_dis);
@@ -1784,7 +1802,6 @@ void Check_ParamConfig(void)
 }
 void ResetParamDefault(void)
 {
-    rt_sprintf(device_status.tempture,"%d",-15);
     device_status.ds = 1;           //设备状态开机
     device_status.thsp = 300;
     device_status.passWord = 8888;
@@ -1793,6 +1810,12 @@ void ResetParamDefault(void)
     device_status.collecting_eh1 = 10;
     device_status.collecting_sh2 = 14;
     device_status.collecting_eh2 = 16;
+    device_status.collt_min_sh1 = 0;
+    device_status.collt_min_eh1 = 0;
+    device_status.collt_min_sh2 = 0;
+    device_status.collt_min_eh2 = 0;
+    device_status.collt_min_sh3 = 0;
+    device_status.collt_min_eh3 = 0;
     device_status.Power_Type = 0;
     ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
 
@@ -1811,7 +1834,6 @@ void ResetParamDefault(void)
     ef_set_env_blob("ds", &device_status.ds, sizeof(device_status.ds));
     ef_set_env_blob("thsp", &device_status.thsp, sizeof(device_status.thsp));
     ef_set_env_blob("passWord", &device_status.passWord,sizeof(device_status.passWord));
-    HMI_WRITE("play %d,%d,%d",1,5,0);
     DTU_Write("reset.mp3");
     rt_thread_delay(1000);
 }
@@ -1828,11 +1850,7 @@ void ResetParamDefault_DC(void)
     device_status.heattime = 10;    //加热时间
     device_status.shake_ws = 1;     //针对开关
     device_status.shake_sec = 1;    //震动时间1-100ms
-    #if LAMP_EN == 1
-    device_status.sunBar = 3;       //光控定时时长
-    #else
-    device_status.sunBar = 4;
-    #endif
+
     device_status.tph = 70;         //高温保护阈值
     device_status.tpl = -5;          //低温保护阈值
     device_status.timeSwitch = 0;   //定时模式

+ 4 - 0
Application_cbd_apm32f1/readme.md

@@ -1,3 +1,7 @@
+# 2025-09-01 更新说明
+#define VERSION_BZY         "2.4.1"                   //孢子仪
+1. 增加采集时间的分钟设置;
+
 # 2025-07-25 更新说明
 #define VERSION_BZY         "2.3.0"                   //孢子仪
 	1. 修复Ymodem升级失败的bug,原因是在ymodem_on_begin函数中打印了日志导致;