|
|
@@ -163,45 +163,7 @@ void ctr_JD_Clear(uint8_t shake_sw)
|
|
|
ctr_cangmen_up(OFF); //关闭清扫
|
|
|
ctr_Heat(OFF);
|
|
|
}
|
|
|
-//工作任务流程
|
|
|
-void WorkTask_XCT(void)
|
|
|
-{
|
|
|
- while(device_status.work_status==1&&device_status.ds==1)
|
|
|
- {
|
|
|
|
|
|
- ctr_Motor_xifu(ON);
|
|
|
- //打开相机供电
|
|
|
- ctr_Camera_Power(ON);
|
|
|
- //ctr_Heat(ON); //清洁风机
|
|
|
- uint32_t photo_fre = 0;
|
|
|
- photo_fre = device_status.dattim * 60;
|
|
|
- while(photo_fre!=0)
|
|
|
- {
|
|
|
- photo_fre --;
|
|
|
- rt_thread_delay(1000);
|
|
|
- LOG_I("收集中,等待开始拍照:%d",photo_fre);
|
|
|
- }
|
|
|
- //卷带
|
|
|
- ctr_JD_Clear(OFF);
|
|
|
- //拍照
|
|
|
- HK_TakePhoto();
|
|
|
- //关闭吸附风机
|
|
|
- ctr_Motor_xifu(OFF);
|
|
|
- //关闭相机供电
|
|
|
- //ctr_Heat(OFF);
|
|
|
- ctr_Camera_Power(OFF);
|
|
|
- //卷带
|
|
|
- ctr_JD_Clear(ON);
|
|
|
-// rt_thread_delay(1000);
|
|
|
-// ctr_JD_Clear(ON);
|
|
|
- //震动
|
|
|
- Motor_shake(ON, device_status.shake_sec);
|
|
|
- }
|
|
|
- //关闭风机
|
|
|
- ctr_Motor_xichong(OFF);
|
|
|
- ctr_Motor_xifu(OFF);
|
|
|
- LOG_I("不在工作时间,未工作!!!");
|
|
|
-}
|
|
|
/**********************************************************************/
|
|
|
/*光控*/
|
|
|
uint8_t In_Light_status(void)
|
|
|
@@ -1080,94 +1042,6 @@ void Hk_Take_io(void)
|
|
|
rt_pin_write(HK_IO, 1);
|
|
|
}
|
|
|
|
|
|
-void calorstat(uint16_t heat_time)
|
|
|
-{
|
|
|
- //uint8_t heat_up_cnt = 0;
|
|
|
- uint16_t n = 0;
|
|
|
- uint16_t delay_heat = 60;
|
|
|
- FlagStatus heat_flg = RESET;
|
|
|
- device_status.heat_time_min = 0;
|
|
|
- device_status.run_sta = device_status.heattem; //初始化加热实时温度
|
|
|
- ctr_Heat(ON);
|
|
|
-// UpLoad_Data(); //开始加热时的第一条数据
|
|
|
- //恒温模式
|
|
|
- for(n=0;n < heat_time;n++)
|
|
|
- {
|
|
|
- if(device_status.heattem>device_status.heatvalue&&heat_flg==RESET)
|
|
|
- {
|
|
|
- heat_flg = SET;
|
|
|
- ctr_Heat(OFF);
|
|
|
- while(delay_heat!=0)
|
|
|
- {
|
|
|
- device_status.C01 &= ~(1<<1); //加热 正常
|
|
|
- delay_heat --;
|
|
|
- rt_kprintf("正在恒温加热!!!:%d",delay_heat);
|
|
|
- HMI_WRITE("workSta.g0.txt=\"正在恒温加热!!!:%d\"",delay_heat);
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(device_status.heattem>device_status.run_sta + 1){
|
|
|
- device_status.run_sta = device_status.heattem;
|
|
|
- }
|
|
|
- }
|
|
|
- delay_heat = 60;
|
|
|
- //跳出FOR循环
|
|
|
- n = n + 60;
|
|
|
- }
|
|
|
-
|
|
|
- if(device_status.heattem>device_status.run_sta + 1){
|
|
|
- device_status.run_sta = device_status.heattem;
|
|
|
- }
|
|
|
- if(device_status.heattem < (device_status.heatvalue - 5)&&heat_flg == SET)
|
|
|
- {
|
|
|
- //device_status.run_sta = device_status.heattem;
|
|
|
- ctr_Heat(ON);
|
|
|
- }
|
|
|
- else if (device_status.heattem>=device_status.heatvalue&&heat_flg==SET)
|
|
|
- {
|
|
|
-// if(heat_up_cnt==0)
|
|
|
-// {
|
|
|
-// UpLoad_Data(); //加热到设定温度的数据
|
|
|
-// heat_up_cnt = 1;
|
|
|
-// }
|
|
|
- //device_status.run_sta = device_status.heattem;
|
|
|
- ctr_Heat(OFF);
|
|
|
- }
|
|
|
- if((n % 60)==0)
|
|
|
- {
|
|
|
- device_status.heat_time_min = device_status.heat_time_min + 1;
|
|
|
- if(device_status.heat_time_min % 5 == 0) //加热5分钟温度低于50,判定加热故障
|
|
|
- {
|
|
|
- if(device_status.heattem<50) {
|
|
|
- device_status.C01 |= (1 << 1); // 第1位变为1,加热故障
|
|
|
- }else {
|
|
|
- device_status.C01 &= ~(1<<1); //加热 正常
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //如果触发异常退出加热
|
|
|
- if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
|
- {
|
|
|
- rt_thread_delay(1000);
|
|
|
- if(device_status.bat_status == 1)
|
|
|
- {
|
|
|
- rt_kprintf("============================触发异常退出加热==========================");
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- ctr_Heat(OFF);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
|
- {
|
|
|
- ctr_Heat(OFF);
|
|
|
- rt_kprintf("异常退出!!!\n");
|
|
|
- break;
|
|
|
- }
|
|
|
- rt_thread_delay(1000);
|
|
|
- rt_kprintf("=======正在加热======:%d-%d\n",n,heat_time);
|
|
|
- HMI_WRITE("workSta.g0.txt=\"正在加热!!!:%d-%d\"",n,heat_time);
|
|
|
- }
|
|
|
- ctr_Heat(OFF);
|
|
|
- //UpLoad_Data(); //加热结束的数据
|
|
|
-}
|
|
|
//初始化所有控制驱动,关闭
|
|
|
void HardWare_Init(uint8_t boot)
|
|
|
{
|
|
|
@@ -1487,430 +1361,6 @@ void WorkCheck(void)
|
|
|
}
|
|
|
|
|
|
|
|
|
-#if 0
|
|
|
-//工作状态检测
|
|
|
-void WorkCheck(void)
|
|
|
-{
|
|
|
- static rt_uint32_t light_timeout = 3600;
|
|
|
- static int check_stamp_cnt = 0;
|
|
|
- //雨控检测,温控检测,电池电压检测
|
|
|
- while(device_status.ds==1&&device_status.rain_status==0&&device_status.temp_status==0&&device_status.bat_status==0)
|
|
|
- {
|
|
|
- //工作模式检测(RTC时间正常,1-时控/0-光控)(RTC时间异常强行使用光控)
|
|
|
- if(device_status.timeSwitch==1)
|
|
|
- {
|
|
|
- LOG_I("***********时控*****************");
|
|
|
- if(device_status.startBar==device_status.stopBar&&device_status.startBar==0){
|
|
|
- device_status.work_status = 1;
|
|
|
- LOG_I("24 hours work...");
|
|
|
- #if LAMP_EN == 1
|
|
|
- device_status.lamp_status = 1;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- if(device_status.sun_status==1){
|
|
|
- ctr_lamp(OFF, 1);
|
|
|
- ctr_lamp(OFF, 2);
|
|
|
- ctr_lamp(OFF, 3);
|
|
|
- }
|
|
|
- #endif
|
|
|
- }
|
|
|
-
|
|
|
- //如果开始和结束是同一天
|
|
|
- if(device_status.startBar<device_status.stopBar)
|
|
|
- {
|
|
|
- LOG_I("开始和结束是同一天");
|
|
|
- time_t now;
|
|
|
- time(&now);
|
|
|
- static struct tm nowtime; //现在
|
|
|
- static struct tm starttime; //开始
|
|
|
- static struct tm endtime; //结束
|
|
|
- //获取当前时间戳
|
|
|
- nowtime =*localtime(&now);
|
|
|
- nowtime.tm_hour = nowtime.tm_hour-8;
|
|
|
- //获取定时开始的时间戳
|
|
|
- starttime = *localtime(&now);
|
|
|
- starttime.tm_hour = device_status.startBar-8;
|
|
|
- starttime.tm_min = 0;
|
|
|
- starttime.tm_sec = 0;
|
|
|
- //获取定时结束的时间戳
|
|
|
- endtime = *localtime(&now);
|
|
|
- endtime.tm_hour = device_status.stopBar-8;
|
|
|
- endtime.tm_min = 0;
|
|
|
- endtime.tm_sec = 0;
|
|
|
- LOG_I("***工作结束在当天:现在时间:%d-开始时间:%d-结束时间:%d***",mktime(&nowtime),mktime(&starttime),mktime(&endtime));
|
|
|
- //如果当前时间大于开始时间且小于结束时间,且没有开始工作
|
|
|
- if((difftime(mktime(&nowtime), mktime(&starttime)) >=0) && (difftime(mktime(&nowtime),mktime(&endtime))<0))
|
|
|
- {
|
|
|
- LOG_I("当前时间大于开始时间,小于结束时间,工作中!!!");
|
|
|
- check_stamp_cnt++;
|
|
|
- if(check_stamp_cnt>20)
|
|
|
- {
|
|
|
- device_status.work_status = 1;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- //如果当前时间小于开始时间
|
|
|
- else if(difftime(mktime(&nowtime),mktime(&starttime))<0)
|
|
|
- {
|
|
|
- LOG_I("当前时间小于开始时间,不工作!!!-%d-%d",mktime(&nowtime),mktime(&starttime));
|
|
|
- device_status.work_status = 0;
|
|
|
- check_stamp_cnt = 0;
|
|
|
- }
|
|
|
- //当前时间大于结束时间
|
|
|
- else {
|
|
|
- LOG_I("当前时间大于结束时间,不工作!!!-%d-%d",mktime(&nowtime),mktime(&starttime));
|
|
|
- device_status.work_status = 0;
|
|
|
- check_stamp_cnt = 0;
|
|
|
- }
|
|
|
- #if LAMP_EN == 1
|
|
|
- //如果当前时间超过20点,未到21点
|
|
|
- if((difftime(mktime(&nowtime), mktime(&starttime)) >=0) && (difftime(mktime(&nowtime),mktime(&starttime)+3600)<0))
|
|
|
- {
|
|
|
- LOG_I("3led:20~21");
|
|
|
- device_status.lamp_status = 1;
|
|
|
- device_status.lamp1_status = 0;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- }
|
|
|
- else if ((difftime(mktime(&nowtime), mktime(&starttime)+3600) >=0) && (difftime(mktime(&nowtime),mktime(&starttime)+7200)<0)) {
|
|
|
- LOG_I("3led:21~22");
|
|
|
- device_status.lamp1_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp2_status = 0;
|
|
|
- }
|
|
|
- else if ((difftime(mktime(&nowtime), mktime(&starttime)+7200) >=0) && (difftime(mktime(&nowtime),mktime(&starttime)+10800)<0)) {
|
|
|
- LOG_I("3led:22~23");
|
|
|
- device_status.lamp2_status = 1;
|
|
|
- device_status.lamp_status = 0;
|
|
|
- device_status.lamp1_status =0;
|
|
|
- }
|
|
|
- #endif
|
|
|
- }
|
|
|
- //如果结束时间是第二天
|
|
|
- else if (device_status.startBar>device_status.stopBar) {
|
|
|
- time_t now;
|
|
|
- time(&now);
|
|
|
- static struct tm nowtime; //现在
|
|
|
- static struct tm starttime; //开始
|
|
|
- static struct tm endtime; //结束
|
|
|
- //获取当前时间戳
|
|
|
- nowtime =*localtime(&now);
|
|
|
- nowtime.tm_hour = nowtime.tm_hour-8;
|
|
|
- //获取定时开始的时间戳
|
|
|
- starttime = *localtime(&now);
|
|
|
- starttime.tm_hour = device_status.startBar-8;
|
|
|
- starttime.tm_min = 0;
|
|
|
- starttime.tm_sec = 0;
|
|
|
- //获取定时结束的时间戳
|
|
|
- endtime = *localtime(&now);
|
|
|
- endtime.tm_hour = device_status.stopBar-8;
|
|
|
- endtime.tm_min = 0;
|
|
|
- endtime.tm_sec = 0;
|
|
|
- LOG_I("工作结束在第二天:现在时间:%d-开始时间:%d-结束时间:%d!!!",mktime(&nowtime),mktime(&starttime),mktime(&endtime));
|
|
|
- //如果当前时间大于开始时间,且没有开始工作 ,注意时间戳日期加1
|
|
|
- if((difftime(mktime(&nowtime), mktime(&starttime)) > 0 ))
|
|
|
- {
|
|
|
- //获取定时结束的时间戳
|
|
|
- endtime = *localtime(&now); //将获取到的时间转换为时间戳
|
|
|
- endtime.tm_hour = device_status.stopBar-8; //这里需减8用于时区转换
|
|
|
- endtime.tm_min = 0;
|
|
|
- endtime.tm_sec = 0;
|
|
|
- device_status.work_status = 1;
|
|
|
- LOG_I("当前前时间大于开始时间,且没有开始工作");
|
|
|
- }
|
|
|
- //当前时间小于开始时间
|
|
|
- else if ((difftime(mktime(&nowtime), mktime(&starttime)) < 0))
|
|
|
- {
|
|
|
- //获取定时结束的时间戳
|
|
|
- endtime = *localtime(&now); //将获取到的时间转换为时间戳
|
|
|
- endtime.tm_hour = device_status.stopBar-8; //这里需减8用于时区转换
|
|
|
- endtime.tm_min = 0;
|
|
|
- endtime.tm_sec = 0;
|
|
|
- //如果当前时间戳小于结束时间戳
|
|
|
- if(difftime(mktime(&nowtime),mktime(&endtime)) < 0)
|
|
|
- {
|
|
|
- LOG_I("当前时间大于开始时间,且没有开始工作,当前时间小于结束时间的情况:计算工作时间:从当前时间工作第二天的结束时间");
|
|
|
- device_status.work_status = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LOG_I("当前时间小于开始时间,且没有开始工作,不是重启引起的,即还没到开始时间");
|
|
|
- device_status.work_status = 0; //不在工作时间,待机
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG_I("光控定时模式!");
|
|
|
-
|
|
|
- if(device_status.sun_status==0&&device_status.light_over_tim!=0)
|
|
|
- {
|
|
|
-
|
|
|
- device_status.light_over_tim--;
|
|
|
- light_timeout = 3600;
|
|
|
- #if LAMP_EN == 1
|
|
|
- Led_Check(device_status.sunBar);
|
|
|
- #else
|
|
|
- device_status.work_status = 1;;
|
|
|
- LOG_I("光控定时,计时中>>>>>>>>>:%d",device_status.light_over_tim);
|
|
|
- #endif
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- light_timeout --;
|
|
|
- //没有在测试并且没有在自检
|
|
|
- if(device_status.test_flag==0&&device_status.selfcheck_ws==0)
|
|
|
- {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- #if LAMP_EN == 1
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- #endif
|
|
|
- }
|
|
|
- device_status.work_status = 0;
|
|
|
- if(light_timeout==0) device_status.light_over_tim = 0; //持续1小时白天,清除光控计时,20250519
|
|
|
- if(device_status.light_over_tim==0&&device_status.sun_status==1) device_status.light_over_tim = device_status.sunBar * 3600;
|
|
|
- LOG_I("光控中,白天:%d!!!",device_status.sun_status);
|
|
|
- }
|
|
|
- }
|
|
|
- rt_thread_delay(1000);
|
|
|
- }
|
|
|
- LOG_I("雨控状态,温控状态,电压状态:%d-%d-%d",device_status.rain_status,device_status.temp_status,device_status.bat_status);
|
|
|
- device_status.work_status = 0;
|
|
|
- rt_thread_delay(1000);
|
|
|
-}
|
|
|
-#endif
|
|
|
-//工作任务流程s
|
|
|
-void WorkTask(void)
|
|
|
-{
|
|
|
- static int clt_time = 0; //收集时间差秒数
|
|
|
- static int heat_time = 0;
|
|
|
- LOG_I("工作状态:%d",device_status.work_status);
|
|
|
- LOG_I("开关机状态:%d",device_status.ds);
|
|
|
- while(device_status.work_status==1&&device_status.temp_status==0&&device_status.bat_status==0&&device_status.rain_status==0&&device_status.ds==1&&device_status.clear_status==0)
|
|
|
- {
|
|
|
- device_status.work_done = 0;
|
|
|
- if(clt_time==0)
|
|
|
- {
|
|
|
- #if 0
|
|
|
- if(device_status.version_type==41&&atoi(device_status.power)<350)
|
|
|
- {
|
|
|
- LOG_W("相机电流不足!");
|
|
|
- char *ctr_hk_p_warn = makeJson_Warn("电流不足", "相机");
|
|
|
- DTU_Write("%s",ctr_hk_p_warn);
|
|
|
- rt_free(ctr_hk_p_warn);
|
|
|
- }
|
|
|
- #endif
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_PUT(ON);
|
|
|
- #endif
|
|
|
- DTU_Write("workstart.mp3");
|
|
|
- if(device_status.debug_ws==1)
|
|
|
- {
|
|
|
- time_t stamp=time(RT_NULL);
|
|
|
- static struct tm tm;
|
|
|
- gmtime_r(&stamp, &tm);
|
|
|
- rt_sprintf(device_status.stamp,"%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);
|
|
|
- char* debug_str = makeJson_Warn("Work start!", device_status.stamp);
|
|
|
- DTU_Write(debug_str);
|
|
|
- rt_free(debug_str);
|
|
|
- }
|
|
|
- }
|
|
|
- //1.打开灯管
|
|
|
- #if LAMP_EN == 1
|
|
|
- if(device_status.lamp_status==1&&device_status.sun_status==0) //光控状态不亮灯
|
|
|
- {
|
|
|
- ctr_lamp(ON,1);
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- }
|
|
|
- else if (device_status.lamp1_status==1&&device_status.sun_status==0) {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- ctr_lamp(ON,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- }
|
|
|
- else if (device_status.lamp2_status==1&&device_status.sun_status==0) {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(ON,3);
|
|
|
- }
|
|
|
- #else
|
|
|
- ctr_lamp(ON,1);
|
|
|
- #endif
|
|
|
- LOG_I("打开灯管!!!");
|
|
|
- #if 0
|
|
|
- rt_thread_delay(2000);
|
|
|
- if(atoi(device_status.power)<450)
|
|
|
- {
|
|
|
- LOG_I("Current is:%d",atoi(device_status.power));
|
|
|
- if(atoi(device_status.power)>50&&atoi(device_status.power)<5000) //过滤电流检测芯片损坏导致电流异常
|
|
|
- {
|
|
|
- char* lamp_err_warn = makeJson_Warn("电流不足", "灯管");
|
|
|
- DTU_Write("%s",lamp_err_warn);
|
|
|
- rt_free(lamp_err_warn);
|
|
|
- }
|
|
|
- }
|
|
|
- #endif
|
|
|
- if(device_status.version_type!=5)
|
|
|
- {
|
|
|
- rt_thread_delay(1000); //待灯管启动再往下执行,否则会触发电机过流
|
|
|
- //2.打开上仓门
|
|
|
- LOG_I("打开上仓门!!!");
|
|
|
- device_status.ctr_up_motor = 1;
|
|
|
- //3.收集
|
|
|
- clt_time = device_status.clt_time * 60;
|
|
|
-
|
|
|
- while(clt_time!=1)
|
|
|
- {
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_IN(ON);
|
|
|
- #endif
|
|
|
- clt_time --;
|
|
|
- rt_thread_delay(1000);
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- if(clt_time%30==0)
|
|
|
- ctr_Fan_PUT(OFF);
|
|
|
- #endif
|
|
|
- rt_kprintf("正在收集.....剩余时间:%d分-%d秒\n",device_status.clt_time,clt_time);
|
|
|
- //如果触发异常
|
|
|
- if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
|
- {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- #if LAMP_EN == 1
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- #endif
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_IN(OFF);
|
|
|
- #endif
|
|
|
- rt_kprintf("异常退出!!!\n");
|
|
|
- break;
|
|
|
- }
|
|
|
- if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
|
- {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- #if LAMP_EN == 1
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- #endif
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_IN(OFF);
|
|
|
- #endif
|
|
|
- rt_kprintf("异常退出!!!\n");
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- clt_time = 1;
|
|
|
- if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
|
- {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- #if LAMP_EN == 1
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- #endif
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_IN(OFF);
|
|
|
- #endif
|
|
|
- rt_kprintf("异常退出!!!\n");
|
|
|
- break;
|
|
|
- }
|
|
|
- if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
|
- {
|
|
|
- ctr_lamp(OFF,1);
|
|
|
- #if LAMP_EN == 1
|
|
|
- ctr_lamp(OFF,2);
|
|
|
- ctr_lamp(OFF,3);
|
|
|
- #endif
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_IN(OFF);
|
|
|
- #endif
|
|
|
- rt_kprintf("异常退出!!!\n");
|
|
|
- break;
|
|
|
- }
|
|
|
- #if 0//LAMP_EN == 0
|
|
|
- ctr_Fan_IN(OFF);
|
|
|
- #endif
|
|
|
- //4.关闭上仓门
|
|
|
- device_status.ctr_up_motor = 2;
|
|
|
- rt_kprintf("关闭上仓门!!!\n");
|
|
|
- while(device_status.ctr_up_motor!=0)
|
|
|
- {
|
|
|
- rt_thread_delay(100);
|
|
|
- LOG_I("等待上仓门关闭!!!");
|
|
|
- }
|
|
|
- //5.加热
|
|
|
- if(device_status.heat_sw==0)
|
|
|
- {
|
|
|
- calorstat(device_status.heattime*60);
|
|
|
- }
|
|
|
- else {
|
|
|
- heat_time = device_status.heattime * 60;
|
|
|
- while(heat_time!=0)
|
|
|
- {
|
|
|
- heat_time--;
|
|
|
- LOG_I("正在加热状态!!!");
|
|
|
- rt_thread_delay(1000);
|
|
|
- }
|
|
|
- }
|
|
|
- //6.打开下仓门
|
|
|
- if(device_status.rain_status==0)
|
|
|
- {
|
|
|
- device_status.ctr_down_motor =1;
|
|
|
- }
|
|
|
- else {
|
|
|
- device_status.ctr_down_motor = 2;
|
|
|
- device_status.ctr_up_motor = 2;
|
|
|
- }
|
|
|
- //待下仓门完全打开
|
|
|
- while(device_status.ctr_down_motor!=0)
|
|
|
- {
|
|
|
- rt_thread_delay(100);
|
|
|
- rt_kprintf("等待下仓门打开!!!\n");
|
|
|
- }
|
|
|
- rt_thread_delay(3000);
|
|
|
- //关闭下仓门
|
|
|
- device_status.ctr_down_motor = 2;
|
|
|
- while(device_status.ctr_down_motor!=0)
|
|
|
- {
|
|
|
- rt_thread_delay(100);
|
|
|
- rt_kprintf("等待下仓门关闭!!!\n");
|
|
|
- }
|
|
|
- //2022-04-12add:
|
|
|
- LOG_I("打开上仓门!!!");
|
|
|
- device_status.ctr_up_motor = 1;
|
|
|
- if(device_status.version_type==4||device_status.version_type==41)
|
|
|
- {
|
|
|
- //震动
|
|
|
- ctr_shake(ON, device_status.shake_sec);
|
|
|
- //补光&&拍照
|
|
|
- LOG_I("拍照!!!");
|
|
|
- ctr_led(ON);
|
|
|
- HK_TakePhoto();
|
|
|
- //清扫
|
|
|
- device_status.clear_status=1;
|
|
|
- //清扫失效则使用震动
|
|
|
- //ctr_shake(ON, 100);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(device_status.bat_status == 1 || device_status.temp_status == 1 || device_status.rain_status==1 || device_status.ds==0)
|
|
|
- {
|
|
|
- LOG_I("-------------------not work--------------------");
|
|
|
- device_status.work_status = 0;
|
|
|
- }
|
|
|
- //工作结束
|
|
|
- if(device_status.work_done==0&&device_status.work_status==0)
|
|
|
- {
|
|
|
- DTU_Write("workdone");
|
|
|
- if (device_status.version_type==1) {
|
|
|
- turnzp(); //2024-03-21 :开机不再转仓
|
|
|
- }
|
|
|
- ResetInit();
|
|
|
- clt_time = 0;
|
|
|
- }
|
|
|
- rt_kprintf("***not work-device status:%d\n",device_status.ds);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
void guanshan_on(void *args)
|
|
|
{
|
|
|
LOG_W("guanshan_on!");
|
|
|
@@ -2153,11 +1603,6 @@ static void Work_Loop_thread_entry(void *parameter)
|
|
|
ResetInit();
|
|
|
while(1)
|
|
|
{
|
|
|
- if(device_status.version_type!=5&&device_status.dtype==3)
|
|
|
- {
|
|
|
- WorkTask();
|
|
|
- }
|
|
|
-
|
|
|
if(device_status.version_type==5)
|
|
|
{
|
|
|
WorkTask_CB5();
|
|
|
@@ -2199,13 +1644,6 @@ static void Control_Check_thread_entry(void *parameter)
|
|
|
{
|
|
|
if(device_status.update_flag==1) break;
|
|
|
if(device_status.version_type==5) break;
|
|
|
- if(device_status.work_status==1&&device_status.heat_sw==1)
|
|
|
- {
|
|
|
- ctr_lamp(ON, 1);
|
|
|
- rt_thread_delay(10000);
|
|
|
- calorstat(device_status.heattime*60);
|
|
|
- }
|
|
|
- else
|
|
|
{
|
|
|
if(device_status.selfcheck_ws==2)
|
|
|
{
|