|
|
@@ -37,10 +37,10 @@ static int calculate_average(int arr[], int n) {
|
|
|
|
|
|
static void t_takephoto_callback(void *parameter)
|
|
|
{
|
|
|
- rt_timer_delete(timer_takephoto);
|
|
|
- LOG_E("t_takephoto_callback");
|
|
|
- device_status.C01 |= (1<<2);
|
|
|
- device_status.C01 |= (1<<3);
|
|
|
+// rt_timer_delete(timer_takephoto);
|
|
|
+ LOG_E("拍照超时!");
|
|
|
+ device_status.C01 |= (1<<2); //拍照故障
|
|
|
+ device_status.C01 |= (1<<3); //补光灯故障
|
|
|
HMI_WRITE("selfcheck.t4.bco=63488");
|
|
|
HMI_WRITE("selfcheck.t3.bco=63488");
|
|
|
HMI_WRITE("sysSet.va0.txt=\"拍照超时\"");
|
|
|
@@ -62,6 +62,7 @@ int selfcheck(uint8_t type)
|
|
|
{
|
|
|
rt_thread_delay(2000);
|
|
|
HMI_WRITE("sysSet.va0.txt=\"等待上下仓门复位完成......\"");
|
|
|
+ LOG_W("等待上下仓门复位完成.....%d",c);
|
|
|
}
|
|
|
ctr_cangmen_up(OFF);
|
|
|
ctr_cangmen_down(OFF);
|
|
|
@@ -84,80 +85,85 @@ int selfcheck(uint8_t type)
|
|
|
device_status.C01 &= ~(1<<12);
|
|
|
}
|
|
|
HMI_WRITE("sysSet.va0.txt=\"待机电流:%d\"",current_);
|
|
|
- char *readinfo = makeJson_ReadInfo();
|
|
|
- DTU_Write("%s",readinfo);
|
|
|
- rt_free(readinfo);
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(atoi(device_status.gps)==0)
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t12.bco=63488");
|
|
|
- device_status.C01 |= (1<<11);
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"GPS无定位\"");
|
|
|
- }
|
|
|
- else {
|
|
|
- HMI_WRITE("selfcheck.t12.bco=2024");
|
|
|
- device_status.C01 &= ~(1<<11);
|
|
|
- }
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(Read_Ntc_Voltage()==0)
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t15.bco=63488");
|
|
|
- }
|
|
|
- else{
|
|
|
- HMI_WRITE("selfcheck.t15.bco=2024");
|
|
|
- }
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(device_status.bat_status==0)
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t5.bco=2024");
|
|
|
- device_status.C01 &= ~(1<<4);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t5.bco=63488");
|
|
|
- device_status.C01 |= (1<<4);
|
|
|
- }
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(Read_Rain_Voltage()==0)
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t6.bco=63488");
|
|
|
- device_status.C01 |= (1<<5);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- device_status.C01 &= ~(1<<5);
|
|
|
- HMI_WRITE("selfcheck.t6.bco=2024");
|
|
|
- }
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(device_status.temp_status)
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t8.bco=63488");
|
|
|
- device_status.C01 |= (1<<7);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- device_status.C01 &= ~(1<<7);
|
|
|
- HMI_WRITE("selfcheck.t8.bco=2024");
|
|
|
- }
|
|
|
- int sensor_light_value = 0;
|
|
|
- for(int i = 0;i<3;i++)
|
|
|
- {
|
|
|
- sensor_light_value += Read_Light_Voltage();
|
|
|
- rt_thread_delay(500);
|
|
|
- }
|
|
|
- if(sensor_light_value<50)
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t7.bco=63488");
|
|
|
- device_status.C01 |= (1<<6);
|
|
|
- }
|
|
|
- else
|
|
|
+ LOG_W("待机电流.....%d",current_);
|
|
|
+ if(type==1)
|
|
|
{
|
|
|
- device_status.C01 &= ~(1<<6);
|
|
|
- HMI_WRITE("selfcheck.t7.bco=2024");
|
|
|
+ char *readinfo = makeJson_ReadInfo();
|
|
|
+ DTU_Write("%s",readinfo);
|
|
|
+ rt_free(readinfo);
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ if(atoi(device_status.gps)==0)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t12.bco=63488");
|
|
|
+ device_status.C01 |= (1<<11);
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"GPS无定位\"");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ HMI_WRITE("selfcheck.t12.bco=2024");
|
|
|
+ device_status.C01 &= ~(1<<11);
|
|
|
+ }
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ if(Read_Ntc_Voltage()==0)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t15.bco=63488");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ HMI_WRITE("selfcheck.t15.bco=2024");
|
|
|
+ }
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ if(device_status.bat_status==0)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t5.bco=2024");
|
|
|
+ device_status.C01 &= ~(1<<4);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t5.bco=63488");
|
|
|
+ device_status.C01 |= (1<<4);
|
|
|
+ }
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ if(Read_Rain_Voltage()==0)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t6.bco=63488");
|
|
|
+ device_status.C01 |= (1<<5);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ device_status.C01 &= ~(1<<5);
|
|
|
+ HMI_WRITE("selfcheck.t6.bco=2024");
|
|
|
+ }
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ if(device_status.temp_status)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t8.bco=63488");
|
|
|
+ device_status.C01 |= (1<<7);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ device_status.C01 &= ~(1<<7);
|
|
|
+ HMI_WRITE("selfcheck.t8.bco=2024");
|
|
|
+ }
|
|
|
+ int sensor_light_value = 0;
|
|
|
+ for(int i = 0;i<3;i++)
|
|
|
+ {
|
|
|
+ sensor_light_value += Read_Light_Voltage();
|
|
|
+ rt_thread_delay(500);
|
|
|
+ }
|
|
|
+ if(sensor_light_value<50)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t7.bco=63488");
|
|
|
+ device_status.C01 |= (1<<6);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ device_status.C01 &= ~(1<<6);
|
|
|
+ HMI_WRITE("selfcheck.t7.bco=2024");
|
|
|
+ }
|
|
|
+
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"光控传感器采样数值:%d\"",Read_Light_Voltage());
|
|
|
+ rt_thread_delay(1000);
|
|
|
}
|
|
|
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"光控传感器采样数值:%d\"",Read_Light_Voltage());
|
|
|
- rt_thread_delay(1000);
|
|
|
/********************************************************/
|
|
|
ctr_lamp(ON, 1); //打开镇流器
|
|
|
rt_thread_delay(1000);
|
|
|
@@ -168,8 +174,8 @@ int selfcheck(uint8_t type)
|
|
|
}
|
|
|
ctr_lamp(OFF, 1); //关闭镇流器
|
|
|
current_open = calculate_average(current_i,5);
|
|
|
- LOG_I("待机电流:%d",current_);
|
|
|
- LOG_I("镇流器开启电流:%d",current_open);
|
|
|
+ LOG_W("待机电流:%d",current_);
|
|
|
+ LOG_W("镇流器开启电流:%d",current_open);
|
|
|
if(current_open-current_>100)
|
|
|
{
|
|
|
HMI_WRITE("selfcheck.t1.bco=2024");
|
|
|
@@ -228,56 +234,58 @@ int selfcheck(uint8_t type)
|
|
|
}
|
|
|
//开启加热
|
|
|
rt_thread_delay(1000);
|
|
|
- //
|
|
|
- if(atoi(device_status.heat_power)>5000)
|
|
|
+ if(type==1)
|
|
|
{
|
|
|
- HMI_WRITE("selfcheck.t2.bco=2024");
|
|
|
- device_status.C01 &= ~(1<<1);
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"加热正常:%d\"",atoi(device_status.heat_power));
|
|
|
- }
|
|
|
- else {
|
|
|
- ctr_Heat(ON);
|
|
|
- //持续5S钟
|
|
|
- for(int i = 5;i>0;i--)
|
|
|
- {
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"加热测试中...%d\"",i);
|
|
|
- rt_thread_delay(1000);
|
|
|
- }
|
|
|
- LOG_I("当前温度:%d电流:%s",device_status.heatvalue,device_status.heat_power);
|
|
|
- //比较当前电压、温度探头温度和开启前
|
|
|
+ //
|
|
|
if(atoi(device_status.heat_power)>5000)
|
|
|
{
|
|
|
HMI_WRITE("selfcheck.t2.bco=2024");
|
|
|
device_status.C01 &= ~(1<<1);
|
|
|
HMI_WRITE("sysSet.va0.txt=\"加热正常:%d\"",atoi(device_status.heat_power));
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- HMI_WRITE("selfcheck.t2.bco=63488");
|
|
|
- device_status.C01 |= (1<<1);
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"加热故障:%d\"",atoi(device_status.heat_power));
|
|
|
+ else {
|
|
|
+ ctr_Heat(ON);
|
|
|
+ //持续5S钟
|
|
|
+ for(int i = 5;i>0;i--)
|
|
|
+ {
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"加热测试中...%d\"",i);
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ }
|
|
|
+ LOG_I("当前温度:%d电流:%s",device_status.heatvalue,device_status.heat_power);
|
|
|
+ //比较当前电压、温度探头温度和开启前
|
|
|
+ if(atoi(device_status.heat_power)>5000)
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t2.bco=2024");
|
|
|
+ device_status.C01 &= ~(1<<1);
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"加热正常:%d\"",atoi(device_status.heat_power));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ HMI_WRITE("selfcheck.t2.bco=63488");
|
|
|
+ device_status.C01 |= (1<<1);
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"加热故障:%d\"",atoi(device_status.heat_power));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ctr_Heat(OFF);
|
|
|
- rt_thread_delay(1000);
|
|
|
- /*********************************************************/
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"开始拍照\"");
|
|
|
- if(device_status.camsta==0)
|
|
|
- {
|
|
|
- rt_timer_start(timer_takephoto);
|
|
|
- HK_TakePhoto();
|
|
|
- for(int i = 15;i>0;i--)
|
|
|
+ ctr_Heat(OFF);
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ /*********************************************************/
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"开始拍照\"");
|
|
|
+ if(device_status.camsta==0)
|
|
|
{
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"拍照中...%d\"",i);
|
|
|
- rt_thread_delay(1000);
|
|
|
+ rt_timer_start(timer_takephoto);
|
|
|
+ HK_TakePhoto();
|
|
|
+ for(int i = 15;i>0;i--)
|
|
|
+ {
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"拍照中...%d\"",i);
|
|
|
+ rt_thread_delay(1000);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ HMI_WRITE("sysSet.va0.txt=\"相机未连接\"");
|
|
|
+ HMI_WRITE("selfcheck.t4.bco=63488");
|
|
|
+ HMI_WRITE("selfcheck.t3.bco=63488");
|
|
|
}
|
|
|
- }else {
|
|
|
- HMI_WRITE("sysSet.va0.txt=\"相机未连接\"");
|
|
|
- HMI_WRITE("selfcheck.t4.bco=63488");
|
|
|
- HMI_WRITE("selfcheck.t3.bco=63488");
|
|
|
+ rt_thread_delay(1000);
|
|
|
}
|
|
|
-
|
|
|
- rt_thread_delay(1000);
|
|
|
/*******************************************************/
|
|
|
//清扫
|
|
|
device_status.clear_status = 1;
|
|
|
@@ -289,7 +297,7 @@ int selfcheck(uint8_t type)
|
|
|
}
|
|
|
current_open = calculate_average(current_i,5);
|
|
|
rt_thread_delay(1000);
|
|
|
- if(current_open-current_>150)
|
|
|
+ if(current_open-current_>120)
|
|
|
{
|
|
|
HMI_WRITE("selfcheck.t11.bco=2024");
|
|
|
device_status.C01 &= ~(1<<10);
|