|
@@ -321,8 +321,13 @@ static void HMI_Decode(void)
|
|
|
HMI_WRITE("workSta.bt0.val=%d",atoi(device_status.sim));
|
|
HMI_WRITE("workSta.bt0.val=%d",atoi(device_status.sim));
|
|
|
//ID
|
|
//ID
|
|
|
HMI_WRITE("menu.equipid.txt=\"%s\"",device_status.imei);
|
|
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("menu.s1.txt=\"%s\"",device_status.tempture);
|
|
|
|
|
+ HMI_WRITE("menu.s2.txt=\"%s\"",device_status.humidity);
|
|
|
|
|
+ HMI_WRITE("menu.s3.txt=\"%s\"",device_status.windspeed);
|
|
|
|
|
+ HMI_WRITE("menu.s4.txt=\"%s\"",device_status.winddir);
|
|
|
|
|
+ HMI_WRITE("menu.s5.txt=\"%s\"",device_status.ap);
|
|
|
|
|
+ HMI_WRITE("menu.s6.txt=\"%s\"",device_status.rainfall);
|
|
|
|
|
+
|
|
|
//数据上传间隔
|
|
//数据上传间隔
|
|
|
HMI_WRITE("uploadSet.datt.val=%d",device_status.dattim);
|
|
HMI_WRITE("uploadSet.datt.val=%d",device_status.dattim);
|
|
|
//语音音量
|
|
//语音音量
|
|
@@ -402,30 +407,7 @@ static void HMI_Decode(void)
|
|
|
device_status.photo_ws = 1;
|
|
device_status.photo_ws = 1;
|
|
|
#endif
|
|
#endif
|
|
|
}
|
|
}
|
|
|
- //转盘复位
|
|
|
|
|
- else if (strstr(rx_buffer,"turn_init")!=NULL) {
|
|
|
|
|
- LOG_I("转仓复位!");
|
|
|
|
|
- ctr_turn(0,0);
|
|
|
|
|
- }
|
|
|
|
|
- //转盘
|
|
|
|
|
- else if (strstr(rx_buffer,"turn")!=NULL) {
|
|
|
|
|
- LOG_I("转仓!");
|
|
|
|
|
- ctr_turn(90,0);
|
|
|
|
|
- }
|
|
|
|
|
- //打开电磁阀
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchDrop=1")!=NULL) {
|
|
|
|
|
- LOG_I("开始滴液!");
|
|
|
|
|
- #if Color_EN == 1
|
|
|
|
|
- device_status.run_sta = 5;
|
|
|
|
|
- #else
|
|
|
|
|
- ctr_shake(ON, device_status.shake_sec);
|
|
|
|
|
- #endif
|
|
|
|
|
- }
|
|
|
|
|
- //关闭电磁阀
|
|
|
|
|
- else if (strstr(rx_buffer,"putTest.switchDrop=0")!=NULL) {
|
|
|
|
|
- LOG_I("停止滴液!");
|
|
|
|
|
- ctr_shake(OFF, 0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
//打开补光
|
|
//打开补光
|
|
|
else if (strstr(rx_buffer,"putTest.switchLed=1")!=NULL) {
|
|
else if (strstr(rx_buffer,"putTest.switchLed=1")!=NULL) {
|
|
|
LOG_I("打开补光!!");
|
|
LOG_I("打开补光!!");
|
|
@@ -448,16 +430,6 @@ static void HMI_Decode(void)
|
|
|
ctr_Heat(ON);
|
|
ctr_Heat(ON);
|
|
|
LOG_I("Open Heat!");
|
|
LOG_I("Open Heat!");
|
|
|
}
|
|
}
|
|
|
- //打开制冷
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCold=1")!=NULL) {
|
|
|
|
|
- ctr_Cold(ON);
|
|
|
|
|
- LOG_I("Open Cold!");
|
|
|
|
|
- }
|
|
|
|
|
- //关闭制冷
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCold=0")!=NULL) {
|
|
|
|
|
- ctr_Cold(OFF);
|
|
|
|
|
- LOG_I("Close Cold!");
|
|
|
|
|
- }
|
|
|
|
|
//打开采集
|
|
//打开采集
|
|
|
else if(strstr(rx_buffer,"putTest.switchCollect=1")!=NULL){
|
|
else if(strstr(rx_buffer,"putTest.switchCollect=1")!=NULL){
|
|
|
ctr_Collect_Fan(ON);
|
|
ctr_Collect_Fan(ON);
|
|
@@ -468,16 +440,7 @@ static void HMI_Decode(void)
|
|
|
ctr_Collect_Fan(OFF);
|
|
ctr_Collect_Fan(OFF);
|
|
|
LOG_I("采集风机已关闭!");
|
|
LOG_I("采集风机已关闭!");
|
|
|
}
|
|
}
|
|
|
- //打开散热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCool=1")!=NULL){
|
|
|
|
|
- ctr_Cool_Fan(ON);
|
|
|
|
|
- LOG_I("散热风机已打开!");
|
|
|
|
|
- }
|
|
|
|
|
- //关闭散热
|
|
|
|
|
- else if(strstr(rx_buffer,"putTest.switchCool=0")!=NULL){
|
|
|
|
|
- ctr_Cool_Fan(OFF);
|
|
|
|
|
- LOG_I("散热风机已关闭!");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//清扫
|
|
//清扫
|
|
|
else if (strstr(rx_buffer,"clear")!=NULL) {
|
|
else if (strstr(rx_buffer,"clear")!=NULL) {
|
|
@@ -516,9 +479,8 @@ static void HMI_Decode(void)
|
|
|
ctr_lamp(ON,2);
|
|
ctr_lamp(ON,2);
|
|
|
ctr_lamp(ON,3);
|
|
ctr_lamp(ON,3);
|
|
|
#endif
|
|
#endif
|
|
|
- DTU_Write("{\"cmd\":\"workstart\"}");
|
|
|
|
|
- USHORT dkdg[] = {0xb4f2,0xbfaa,0xb5c6,0xb9dc};
|
|
|
|
|
- _485_play(dkdg,4);
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//关闭灯管
|
|
//关闭灯管
|
|
@@ -531,9 +493,7 @@ static void HMI_Decode(void)
|
|
|
ctr_lamp(OFF,2);
|
|
ctr_lamp(OFF,2);
|
|
|
ctr_lamp(OFF,3);
|
|
ctr_lamp(OFF,3);
|
|
|
#endif
|
|
#endif
|
|
|
- DTU_Write("{\"cmd\":\"workdone\"}");
|
|
|
|
|
- USHORT gbdg[] = {0xb9d8,0xb1d5,0xb5c6,0xb9dc};
|
|
|
|
|
- _485_play(gbdg,4);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
//关闭加热
|
|
//关闭加热
|
|
|
else if(strstr(rx_buffer,"putTest.switchHeat=0")!=NULL) {
|
|
else if(strstr(rx_buffer,"putTest.switchHeat=0")!=NULL) {
|
|
@@ -549,66 +509,27 @@ static void HMI_Decode(void)
|
|
|
}
|
|
}
|
|
|
//打开上仓门
|
|
//打开上仓门
|
|
|
else if(strstr(rx_buffer,"putTest.switchUp=1")!=NULL){
|
|
else if(strstr(rx_buffer,"putTest.switchUp=1")!=NULL){
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_lamp(ON, 1);
|
|
|
|
|
- ctr_Motor_Driver(1, 0,1000000,500);
|
|
|
|
|
- LOG_I("开始步进上行!");
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("Open UP!\n");
|
|
|
|
|
- ctr_cangmen_up(OFF);
|
|
|
|
|
- device_status.ctr_up_motor = 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ rt_kprintf("Open UP!\n");
|
|
|
|
|
+ ctr_cangmen_up(OFF);
|
|
|
|
|
+ device_status.ctr_up_motor = 1;
|
|
|
}
|
|
}
|
|
|
//关闭上仓门
|
|
//关闭上仓门
|
|
|
else if(strstr(rx_buffer,"putTest.switchUp=0")!=NULL){
|
|
else if(strstr(rx_buffer,"putTest.switchUp=0")!=NULL){
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("停止步进上行!");
|
|
|
|
|
- ctr_lamp(OFF, 1);
|
|
|
|
|
- ctr_Motor_Driver(0, 0,0,0);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("CLOSE UP!\n");
|
|
|
|
|
- ctr_cangmen_up(OFF);
|
|
|
|
|
- device_status.ctr_up_motor = 2;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ rt_kprintf("CLOSE UP!\n");
|
|
|
|
|
+ ctr_cangmen_up(OFF);
|
|
|
|
|
+ device_status.ctr_up_motor = 2;
|
|
|
}
|
|
}
|
|
|
//打开下仓门
|
|
//打开下仓门
|
|
|
else if(strstr(rx_buffer,"putTest.switchDown=1")!=NULL){
|
|
else if(strstr(rx_buffer,"putTest.switchDown=1")!=NULL){
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("开始步进下行!");
|
|
|
|
|
- ctr_lamp(ON, 1);
|
|
|
|
|
- ctr_Motor_Driver(1, 1,1000000,500);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- ctr_cangmen_down(OFF);
|
|
|
|
|
- device_status.ctr_down_motor = 1;
|
|
|
|
|
- rt_kprintf("Open down!\n");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ctr_cangmen_down(OFF);
|
|
|
|
|
+ device_status.ctr_down_motor = 1;
|
|
|
|
|
+ rt_kprintf("Open down!\n");
|
|
|
}
|
|
}
|
|
|
//关闭下仓门
|
|
//关闭下仓门
|
|
|
else if(strstr(rx_buffer,"putTest.switchDown=0")!=NULL){
|
|
else if(strstr(rx_buffer,"putTest.switchDown=0")!=NULL){
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_lamp(OFF, 1);
|
|
|
|
|
- ctr_Motor_Driver(0, 0,0,0);
|
|
|
|
|
- rt_kprintf("停止步进下行!\n");
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- ctr_cangmen_down(OFF);
|
|
|
|
|
- device_status.ctr_down_motor = 2;
|
|
|
|
|
- rt_kprintf("CLOSE down!\n");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ ctr_cangmen_down(OFF);
|
|
|
|
|
+ device_status.ctr_down_motor = 2;
|
|
|
|
|
+ rt_kprintf("CLOSE down!\n");
|
|
|
}
|
|
}
|
|
|
else if(strstr(rx_buffer,"putTest.Testpaichong")!=NULL){
|
|
else if(strstr(rx_buffer,"putTest.Testpaichong")!=NULL){
|
|
|
if(device_status.collt_box_sta==0){
|
|
if(device_status.collt_box_sta==0){
|
|
@@ -673,35 +594,6 @@ static void HMI_Decode(void)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //设备编码设置
|
|
|
|
|
- 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)!=19){
|
|
|
|
|
- LOG_E("编码长度错误!");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- var = strstr(rx_buffer,"=");
|
|
|
|
|
- var ++;
|
|
|
|
|
- strncpy(value_str,var,8); //设备编码为16位
|
|
|
|
|
- if(strstr(value_str,"00000000")!=RT_NULL){
|
|
|
|
|
- char *config_reset = makeJson_Config_Reset();
|
|
|
|
|
- //发送json到RTU
|
|
|
|
|
- DTU_Write("%s",config_reset);
|
|
|
|
|
- rt_free(config_reset);
|
|
|
|
|
- //恢复RTU的默认配置参数
|
|
|
|
|
- }else{
|
|
|
|
|
- rt_sprintf(device_status.deviceId,"10300101%s",value_str); //设备大类编码103-虫情 设备小类编码 001 生产商代码01
|
|
|
|
|
- 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) {
|
|
else if (strstr(rx_buffer,"saveClockSet=")!=NULL) {
|
|
|
char value_str[10];
|
|
char value_str[10];
|
|
@@ -1065,12 +957,6 @@ static void HMI_Decode(void)
|
|
|
rt_free(json_temp);
|
|
rt_free(json_temp);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- //获取SIM卡信息
|
|
|
|
|
- else if(strstr(rx_buffer,"getSim")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- //http://sim.openluat.com/api/wechat/openapidoc
|
|
|
|
|
- DTU_Write("getsiminfo");
|
|
|
|
|
- }
|
|
|
|
|
else if (strstr(rx_buffer,"DebugEnable")!=NULL) {
|
|
else if (strstr(rx_buffer,"DebugEnable")!=NULL) {
|
|
|
Debug_log_ON();
|
|
Debug_log_ON();
|
|
|
}
|
|
}
|
|
@@ -1089,20 +975,7 @@ static void HMI_Decode(void)
|
|
|
{
|
|
{
|
|
|
UpLoad_Data();
|
|
UpLoad_Data();
|
|
|
}
|
|
}
|
|
|
- else if (strstr(rx_buffer,"checkupdate")!=NULL)
|
|
|
|
|
- {
|
|
|
|
|
- time_t now = time(RT_NULL);
|
|
|
|
|
- static struct tm tm;
|
|
|
|
|
- gmtime_r(&now, &tm);
|
|
|
|
|
- HMI_WRITE("hardcheck.tip_rtc.txt=\"%04d-%02d-%02d %02d:%02d:%02d\"",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- HMI_WRITE("hardcheck.p0.pic=%d",70);
|
|
|
|
|
- //RTC时间判断,如果当前年份小于2020,提示需要设置时间
|
|
|
|
|
- if(tm.tm_year+1900<2020)
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("时间未设置:%04d-%02d-%02d %02d:%02d:%02d\n",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- HMI_WRITE("hardcheck.tip_rtc.txt=%04d-%02d-%02d %02d:%02d:%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
//进入bootloader模式
|
|
//进入bootloader模式
|
|
|
else if (strstr(rx_buffer,"bootloader")!=NULL) {
|
|
else if (strstr(rx_buffer,"bootloader")!=NULL) {
|
|
|
device_status.stop_in_bootloader = 1;
|
|
device_status.stop_in_bootloader = 1;
|
|
@@ -1120,13 +993,8 @@ static void HMI_Decode(void)
|
|
|
DTU_Write("{\"cmd\": \"saveLog_usb\"}");
|
|
DTU_Write("{\"cmd\": \"saveLog_usb\"}");
|
|
|
}
|
|
}
|
|
|
//屏幕上触发远程升级
|
|
//屏幕上触发远程升级
|
|
|
- else if (strstr(rx_buffer,"hmi_update")!=NULL) {
|
|
|
|
|
- DTU_Write("hmi_update");
|
|
|
|
|
- device_status.update_flag = 1;
|
|
|
|
|
- ef_set_env_blob("update_flag", &device_status.update_flag, sizeof(device_status.update_flag));
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- rt_hw_cpu_reset();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ else if (strstr(rx_buffer,"board_update")!=NULL) {
|
|
|
|
|
+ DTU_Write("board_update");
|
|
|
}else if (strstr(rx_buffer,"SaveRecordParam")!=NULL){
|
|
}else if (strstr(rx_buffer,"SaveRecordParam")!=NULL){
|
|
|
//"SaveRecordParam:10000-200"
|
|
//"SaveRecordParam:10000-200"
|
|
|
int param1, param2;
|
|
int param1, param2;
|
|
@@ -1257,70 +1125,51 @@ 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;
|
|
|
}
|
|
}
|
|
|
-// 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;
|
|
|
}
|
|
}
|
|
|
- //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)
|
|
|
{
|
|
{
|
|
|
ctr_cangmen_down(OPEN);
|
|
ctr_cangmen_down(OPEN);
|
|
|
num_down_open--;
|
|
num_down_open--;
|
|
|
-// current_t[num_down_open] = atoi(device_status.power);
|
|
|
|
|
|
|
+
|
|
|
//如果关闭仓门1S后检测不到电流增大,则判定为异常
|
|
//如果关闭仓门1S后检测不到电流增大,则判定为异常
|
|
|
if (num_down_open == 0) //2025-07-07,增加限位检测
|
|
if (num_down_open == 0) //2025-07-07,增加限位检测
|
|
|
{
|
|
{
|
|
|
ctr_cangmen_down(OFF);
|
|
ctr_cangmen_down(OFF);
|
|
|
num_down_open = 200;
|
|
num_down_open = 200;
|
|
|
}
|
|
}
|
|
|
-// LOG_D("下仓门打开电流:%d",current_t[num_down_open]);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
else if (device_status.ctr_down_motor == 2)
|
|
else if (device_status.ctr_down_motor == 2)
|
|
|
{
|
|
{
|
|
|
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;
|
|
|
}
|
|
}
|
|
|
-// LOG_D("下仓门关闭电流:%d",current_t[num_down_close]);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
if(device_status.sun_test==1)
|
|
if(device_status.sun_test==1)
|
|
|
{
|
|
{
|
|
@@ -1369,71 +1218,17 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
}else{
|
|
}else{
|
|
|
photo_led_sec = 900;
|
|
photo_led_sec = 900;
|
|
|
}
|
|
}
|
|
|
- /*对焦拍照*/
|
|
|
|
|
- if(device_status.autotakepic==1)
|
|
|
|
|
|
|
+ if(device_status.photo_ws==5)
|
|
|
{
|
|
{
|
|
|
- DTU_Write("autotakephoto");
|
|
|
|
|
- HMI_WRITE("sysTest.auto_flag.txt=\"Autotest\"");
|
|
|
|
|
- //打开步进电机驱动器电源
|
|
|
|
|
- ctr_lamp(ON, 1);
|
|
|
|
|
- //打开补光灯
|
|
|
|
|
- ctr_led(ON);
|
|
|
|
|
- //电机向下运动
|
|
|
|
|
- ctr_Motor_Driver(1, 1, 1000000,1000);
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- LOG_I("电机到达下方!!!");
|
|
|
|
|
- Hk_Take_io();
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- LOG_I("电机开始向上!!!");
|
|
|
|
|
- rt_pin_write(Motor_EN, 1);
|
|
|
|
|
- rt_pin_write(Motor_DIR, 0);
|
|
|
|
|
- beep_set(1000000, 200000); //2kzh - 50%
|
|
|
|
|
- while(rt_pin_read(LIMIT_UP)==1)
|
|
|
|
|
|
|
+ photo_led_sec--;
|
|
|
|
|
+ if(photo_led_sec==890)
|
|
|
{
|
|
{
|
|
|
- HMI_WRITE("sysTest.result.txt=\"对焦拍照触发次数:%d\"",photo_setup);
|
|
|
|
|
- HMI_WRITE("sysTest.auto_flag.txt=\"AutoTeststart\"");
|
|
|
|
|
- rt_pin_write(Motor_EN, 0);
|
|
|
|
|
- beep_set(0, 0);//驱动器失能
|
|
|
|
|
- Hk_Take_io(); //触发拍照
|
|
|
|
|
- rt_thread_mdelay(200); //10ms
|
|
|
|
|
- rt_pin_write(Motor_EN, 1);
|
|
|
|
|
- beep_set(1000000, 200000); //驱动器使能
|
|
|
|
|
- rt_thread_mdelay(100); //10ms
|
|
|
|
|
- beep_set(0, 0); //驱动器失能
|
|
|
|
|
- rt_pin_write(Motor_EN, 0);
|
|
|
|
|
- if(photo_setup>300) //限制最大拍照数量
|
|
|
|
|
- {
|
|
|
|
|
- ctr_led(OFF);
|
|
|
|
|
- device_status.autotakepic=0;
|
|
|
|
|
- rt_pin_write(Motor_EN, 0); //驱动器失能
|
|
|
|
|
- beep_set(1000000, 0); //2kzh - 50%
|
|
|
|
|
- HMI_WRITE("sysTest.switchAutopic.val=%d",0);
|
|
|
|
|
- HMI_WRITE("sysTest.auto_flag.txt=\"\"");
|
|
|
|
|
- ctr_lamp(OFF, 1);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- photo_setup++;
|
|
|
|
|
- LOG_I("对焦拍照:%d",photo_setup);
|
|
|
|
|
|
|
+ Hk_Take_io();
|
|
|
|
|
+ device_status.photo_ws = 0;
|
|
|
|
|
+ }else if (photo_led_sec==889) {
|
|
|
|
|
+ photo_led_sec = 900;
|
|
|
|
|
+ ctr_Motor86_move(0, 50000, 0);
|
|
|
}
|
|
}
|
|
|
- DTU_Write("takephotodone");
|
|
|
|
|
- ctr_led(OFF);
|
|
|
|
|
- rt_pin_write(Motor_EN, 0); //驱动器失能
|
|
|
|
|
- beep_set(1000000, 0); //2kzh - 50%
|
|
|
|
|
- HMI_WRITE("sysTest.switchAutopic.val=%d",0);
|
|
|
|
|
- device_status.autotakepic=0;
|
|
|
|
|
- photo_setup = 0;
|
|
|
|
|
- HMI_WRITE("sysTest.auto_flag.txt=\"\"");
|
|
|
|
|
- HMI_WRITE("sysTest.switchAutopic.val=%d",0);
|
|
|
|
|
- //关闭步进电机驱动器电源
|
|
|
|
|
- ctr_lamp(OFF, 1);
|
|
|
|
|
- //重置运行标志位
|
|
|
|
|
- device_status.run_sta = 0;
|
|
|
|
|
- ef_set_env_blob("run_sta", &device_status.run_sta, sizeof(device_status.run_sta));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(device_status.fsl_sw==1)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Petroleum_jelly(10);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(device_status.collt_box_sta==111){
|
|
if(device_status.collt_box_sta==111){
|
|
@@ -1497,95 +1292,6 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //一键测试
|
|
|
|
|
- if(device_status.auto_test_sw==1)
|
|
|
|
|
- {
|
|
|
|
|
- HMI_WRITE("sysTest.auto_flag.txt=\"Autotest\"");
|
|
|
|
|
- //转盘复位
|
|
|
|
|
- LOG_I("转盘复位!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:转盘复位!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_turn(0,0);
|
|
|
|
|
- //转90
|
|
|
|
|
- LOG_I("第一次转盘!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:第一次转盘!\"");
|
|
|
|
|
- ctr_turn(90,0);
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- //推杆电机:测试粘附:
|
|
|
|
|
- LOG_I("涂凡士林!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:涂凡士林!\"");
|
|
|
|
|
- ctr_Petroleum_jelly(10);
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- //转90
|
|
|
|
|
- LOG_I("第二次转盘!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:第二次转盘!\"");
|
|
|
|
|
- ctr_turn(90,0);
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- //采集,打开风机
|
|
|
|
|
- LOG_I("采集,打开风机!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:采集,打开风机!\"");
|
|
|
|
|
- ctr_Collect_Fan(ON);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- LOG_I("采集结束,关闭风机!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:采集结束,关闭风机!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- //散热
|
|
|
|
|
- LOG_I("打开散热!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:打开散热!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Cool_Fan(ON);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- LOG_I("关闭散热!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:关闭散热!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Cool_Fan(OFF);
|
|
|
|
|
- //转90
|
|
|
|
|
- LOG_I("第三次转盘!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:第三次转盘!\"");
|
|
|
|
|
- ctr_turn(90,0);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- //滴液
|
|
|
|
|
- LOG_I("开始滴液!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:开始滴液!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_shake(ON,device_status.shake_sec);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- LOG_I("停止滴液!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:停止滴液!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- //加热
|
|
|
|
|
- LOG_I("开始加热!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:开始加热!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Heat(ON);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- LOG_I("停止加热!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:停止加热!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Heat(OFF);
|
|
|
|
|
- //制冷
|
|
|
|
|
- LOG_I("开始制冷!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:开始制冷!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Cold(ON);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- LOG_I("停止制冷!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:停止制冷!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_Cold(OFF);
|
|
|
|
|
- //转90
|
|
|
|
|
- LOG_I("第四次转盘!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:第四次转盘!\"");
|
|
|
|
|
- ctr_turn(90,0);
|
|
|
|
|
- LOG_I("打开补光灯!!!");
|
|
|
|
|
- HMI_WRITE("sysTest.result.txt=\"一键测试:打开补光灯!\"");
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- ctr_led(ON);
|
|
|
|
|
- device_status.autotakepic=1;
|
|
|
|
|
- device_status.auto_test_sw=0;
|
|
|
|
|
- HMI_WRITE("sysTest.auto_flag.txt=\"\"");
|
|
|
|
|
- }
|
|
|
|
|
if(device_status.selfcheck_ws==2)
|
|
if(device_status.selfcheck_ws==2)
|
|
|
{
|
|
{
|
|
|
selfcheck(1);
|
|
selfcheck(1);
|
|
@@ -1870,11 +1576,9 @@ void Check_ParamConfig(void)
|
|
|
ctr_router(OFF);
|
|
ctr_router(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
Hmi_Fresh();
|
|
Hmi_Fresh();
|
|
|
- if(device_status.dtype!=7)
|
|
|
|
|
- {
|
|
|
|
|
- Control_clear();
|
|
|
|
|
- Control_Check(); //自检
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ Control_clear();
|
|
|
|
|
+
|
|
|
dtu_data_play();
|
|
dtu_data_play();
|
|
|
sht30_collect();
|
|
sht30_collect();
|
|
|
#if SENSOR_EN==1
|
|
#if SENSOR_EN==1
|