yf_zjb 2 лет назад
Родитель
Сommit
1118570949

BIN
Application_CBD/Debug/Application_CBD.bin


BIN
Application_CBD/Debug/Application_CBD.elf


Разница между файлами не показана из-за своего большого размера
+ 1087 - 1080
Application_CBD/Debug/Application_CBD.map


BIN
Application_CBD/Debug/applications/beep.o


BIN
Application_CBD/Debug/applications/control.o


BIN
Application_CBD/Debug/applications/dtu_uart2.o


BIN
Application_CBD/Debug/applications/hmi.o


BIN
Application_CBD/Debug/applications/main.o


BIN
Application_CBD/Debug/applications/sample_mb_master.o


BIN
Application_CBD/Debug/applications/sht30_collect.o


BIN
Application_CBD/Debug/packages/EasyFlash-latest/src/ef_fal_port.o


BIN
Application_CBD/Debug/rt-thread/src/kservice.o


BIN
Application_CBD/Debug/rtthread.rbl


+ 0 - 18
Application_CBD/applications/control.c

@@ -2624,24 +2624,6 @@ static void Control_Heat_thread_entry(void *parameter)
                 ctr_cangmen_down(OFF);
             }
         }
-//        //吸虫塔补光灯测试
-//        while(device_status.vol!=200)
-//        {
-//            if(var_led==0) ctr_led(ON);
-//            var_led++;
-//            if(var_led>10)
-//            {
-//                ctr_led(OFF);
-//                var_ledoff++;
-//                if(var_ledoff>10)
-//                {
-//                    var_led = 0;
-//                    var_ledoff = 0;
-//                    ctr_led(ON);
-//                }
-//            }
-//            rt_thread_delay(1000);
-//        }
         rt_thread_delay(1000);
         #endif
         #endif

+ 3 - 2
Application_CBD/applications/control.h

@@ -26,8 +26,7 @@
 #else
     #define VERSION_HK          "1.51.41(HK)"       //4.0海康-1200W
 #endif
-#define VERSION_HK_4800W    ""                      //4.0海康-4800W
-#define VERSION_HK_2000W    "1.48.40(2000W)"         //4.0水稻
+#define VERSION_HK_2000W    "1.49.40(2000W)"         //4.0水稻
 #define VERSION_ZP          "1.44.1(ZP)"            //1.0转盘
 #define VERSION_GK          "1.40.1(GK)"            //1.0高空
 #define VERSION_XCT         "1.13.6(HK)"            //吸虫塔-海康
@@ -110,6 +109,7 @@ typedef struct  _packed
     uint8_t account_status;         //卡状态
     uint8_t test_flag;              //测试标志
     uint8_t sensor_485_sta;         //485传感器
+    uint8_t Power_Type;     //供电类型
     #if BOOT_ERR == 1
     uint8_t gps_inuse;
     uint8_t gps_view;
@@ -149,6 +149,7 @@ typedef struct  _packed
     char json_w_platform[128]; //
     char power[8];               //功率
     char voltage[8];             //电池电压
+    char deviceId[32];          //bdh-设备编码
 }Device_Status_typedef;
 
 /************************************************/

+ 25 - 1
Application_CBD/applications/dtu_uart2.c

@@ -135,7 +135,10 @@ static void dtu_thread_entry_recv(void *parameter)
             LOG_D("recv data:%s",rx_buffer);
             if(strstr(rx_buffer,"{")==RT_NULL||strstr(rx_buffer,"}")==RT_NULL)
             {
-                HMI_WRITE("sysTest.result.txt=\"%s\"",rx_buffer);
+                if(device_status.dtype==7)
+                    HMI_WRITE("sysTest.result.txt=\"%s\"",rx_buffer);
+                if(device_status.dtype==3)
+                    HMI_WRITE("sysSet.va0.txt=\"%s\"",rx_buffer);
             }
             //过滤异常数据
             char str_check_head[2];
@@ -408,6 +411,27 @@ char * makeJson_takephoto()
     return takephoto_str;
 }
 
+char *makeJson_Config_BDH(char * deviceId){
+    cJSON * tJsonRoot = NULL;
+    tJsonRoot = cJSON_CreateObject();
+    if(NULL==tJsonRoot)
+    {
+        cJSON_Delete(tJsonRoot);
+        return NULL;
+    }
+    cJSON_AddStringToObject(tJsonRoot, "cmd", "cbd");
+    cJSON_AddStringToObject(tJsonRoot, "deviceId", deviceId);
+    char * t = cJSON_PrintUnformatted(tJsonRoot);
+    if(NULL == t)
+    {
+        cJSON_Delete(tJsonRoot);
+        return NULL;
+    }
+    cJSON_Delete(tJsonRoot);
+    return t;
+}
+
+
 char * makeJson_Rtutakephoto()
 {
     cJSON * tJsonRoot = NULL;

+ 33 - 21
Application_CBD/applications/hmi.c

@@ -265,6 +265,7 @@ static void HMI_Decode(void)
         HMI_WRITE("workSta.bt0.val=%d",atoi(device_status.sim));
         //ID
         HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
+        HMI_WRITE("menu.deviceId.txt=\"%s\"",device_status.deviceId);
         //HMI_WRITE("workSta.equipid.txt=\"%s\"",device_status.imei);
         //数据上传间隔
         HMI_WRITE("uploadSet.datt.val=%d",device_status.dattim);
@@ -652,6 +653,26 @@ static void HMI_Decode(void)
         device_status.vol = 111;
         LOG_I("开始排虫!");
     }
+    //设备编码设置
+    else if (strstr(rx_buffer,"deviceId=")!=NULL) {
+        char value_str[20];
+        memset(value_str,0,sizeof(value_str));
+        LOG_I("设备编码 长度:%d",strlen(rx_buffer));
+        if(strlen(rx_buffer)!=27){
+            LOG_E("编码长度错误!");
+            return;
+        }
+        var = strstr(rx_buffer,"=");
+        var ++;
+        strncpy(value_str,var,16);  //设备编码为16位
+        rt_sprintf(device_status.deviceId,"%s",value_str);
+        ef_set_env_blob("deviceId", &device_status.deviceId, sizeof(device_status.deviceId));
+        LOG_I("解析到设备编码:%s",device_status.deviceId);
+        char *device_id = makeJson_Config_BDH(device_status.deviceId);
+        //发送json到RTU
+        DTU_Write("%s",device_id);
+        rt_free(device_id);
+    }
     //定时设置
     else if (strstr(rx_buffer,"saveClockSet=")!=NULL) {
         char value_str[10];
@@ -1123,23 +1144,6 @@ static void HMI_Decode(void)
 
         }
     }
-    //4.0-4800w
-    else if (strstr(rx_buffer,"SwversionV48")!=NULL) {
-        device_status.dtype = 3;
-        if(device_status.version_type != 48)
-        {
-            device_status.dtype = 3;
-            device_status.version_type = 48;
-            sprintf(device_status.driver, "%s",VERSION_HK_4800W);
-            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));        //版本类型+
-            DTU_Write("SwversionV41");
-            MA_save();
-        }
-        else {
-
-        }
-    }
     //水稻
     else if (strstr(rx_buffer,"SwversionV4")!=NULL) {
         device_status.dtype = 3;
@@ -1715,6 +1719,7 @@ void Check_ParamConfig(void)
         /*设备类型,7孢子仪,3测报灯,默认设置测报灯*/
         device_status.dtype = 3;
         device_status.version_type = 4; //4.0
+        device_status.Power_Type = 0;   //0-电池供电;1-交流供电
         device_status.clt_time = 10;    //收集时间
         device_status.heattime = 10;    //加热时间
         device_status.heatvalue=100;//加热温度
@@ -1743,6 +1748,7 @@ void Check_ParamConfig(void)
         device_status.run_sta = 0;
 
         sprintf(device_status.driver, "%s",VERSION_HK);
+        sprintf(device_status.deviceId,"0");
         rt_sprintf(device_status.tempture, "-15");
         rt_sprintf(device_status.humidity, "31");
         rt_sprintf(device_status.mqttcfg1, "8.136.98.49");
@@ -1775,6 +1781,8 @@ void Check_ParamConfig(void)
         ef_set_env_blob("collecting_sh2",&device_status.collecting_sh2,sizeof(device_status.collecting_sh2));        //采集时间
         ef_set_env_blob("collecting_eh2",&device_status.collecting_eh2,sizeof(device_status.collecting_eh2));        //采集时间
         ef_set_env_blob("run_sta", &device_status.run_sta, sizeof(device_status.run_sta));      //
+        ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
+
         LOG_I("SOFTWARE VERSION:%s",device_status.driver);
         LOG_I("Default paramconf is:");
         LOG_I("stime:%d",device_status.iSave);
@@ -1828,6 +1836,8 @@ void Check_ParamConfig(void)
         ef_get_env_blob("collecting_sh2",&device_status.collecting_sh2,sizeof(device_status.collecting_sh2),NULL);  //采集开始2
         ef_get_env_blob("collecting_eh2",&device_status.collecting_eh2,sizeof(device_status.collecting_eh2),NULL);  //采集结束2
         ef_get_env_blob("run_sta",&device_status.run_sta,sizeof(device_status.run_sta),NULL);                       //运行状态
+        ef_get_env_blob("Power_Type",&device_status.Power_Type,sizeof(device_status.Power_Type),NULL);              //供电类型
+        ef_get_env_blob("deviceId",&device_status.deviceId,sizeof(device_status.deviceId),NULL);                    //设备编码
         device_status.light_over_tim = device_status.sunBar * 3600;                                                 //光控计数
         device_status.work_done = 0;
         //工作完成标志位
@@ -1885,9 +1895,6 @@ void Check_ParamConfig(void)
         else if (device_status.version_type==30) {
             rt_sprintf(device_status.driver, "%s",VERSION_Robot);
         }
-        else if (device_status.version_type==48) {
-            rt_sprintf(device_status.driver, "%s",VERSION_HK_4800W);
-        }
         /*定制三色光源*/
         #if LAMP_EN == 1
             if(device_status.sunBar%3!=0)
@@ -1919,6 +1926,8 @@ void Check_ParamConfig(void)
         LOG_I("上传平台:%s",device_status.mqttcfg1);
         LOG_I("孢子仪运行状态:%d",device_status.run_sta);
         LOG_I("孢子仪采集时间:[%d-%d,%d-%d]",device_status.collecting_sh1,device_status.collecting_eh1,device_status.collecting_sh2,device_status.collecting_eh2);
+        LOG_I("PowerType:%d",device_status.Power_Type);
+        LOG_I("deviceId:%s",device_status.deviceId);
     }
     //RTC时间判断,如果当前年份小于2020,提示需要设置时间,切换为光控
     if(device_status.update_flag==1)
@@ -2005,7 +2014,8 @@ void ResetParamDefault(void)
     device_status.collecting_eh1 = 10;
     device_status.collecting_sh2 = 14;
     device_status.collecting_eh2 = 16;
-
+    device_status.Power_Type = 1;
+    ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
     if(device_status.dtype==3)
     {
         device_status.clt_time = 10;    //收集时间
@@ -2083,6 +2093,8 @@ void ResetParamDefault_DC(void)
     device_status.thsp = 300;
     device_status.passWord = 8888;
     device_status.timeSwitch = 0;
+    device_status.Power_Type = 0;
+    ef_set_env_blob("Power_Type", &device_status.Power_Type, sizeof(device_status.Power_Type));
     ef_set_env_blob("ds", &device_status.ds, sizeof(device_status.ds));
     ef_set_env_blob("stime", &device_status.clt_time, sizeof(device_status.clt_time));
     ef_set_env_blob("startBar", &device_status.startBar, sizeof(device_status.startBar));

+ 3 - 1
Application_CBD/packages/EasyFlash-latest/src/ef_fal_port.c

@@ -84,7 +84,9 @@ static const ef_env default_env_set[] = {
         {"collecting_sh1","0"},    //
         {"collecting_eh1","0"},    //
         {"collecting_sh2","0"},    //
-        {"collecting_eh2","0"}    //
+        {"collecting_eh2","0"},    //
+        {"Power_Type","0"},
+        {"deviceId","0"}
 };
 static char log_buf[RT_CONSOLEBUF_SIZE];
 static struct rt_semaphore env_cache_lock;

+ 2 - 3
Application_CBD/readme.md

@@ -1,14 +1,13 @@
+# 2021-06-13  更新说明
+1. 增加北大荒设备编码录入功能,版本变更为:1.49.40(2000W)
 # 2024-05-20 更新说明
 1. 欠压检测消抖,10s
 2. 欠压保护电压设置为22V
 # 2024-03-21 更新说明
 1. 取消1.0开机初始化转仓;版本变更为1.44.1
-
-
 # 2024-1-25 更新说明
 1. 测报灯加热上传温度问题,上传最高温度
 2. 同步时间;
-
 # 2024-1-09 更新说明
 #define VERSION_BZY         "2.6.A"                   //孢子仪
 1. 主版本号由2.6变更为2.6.A,设备类型版本:vtype 为1: