|
@@ -39,9 +39,6 @@ rt_thread_t tid_ctr = RT_NULL;
|
|
|
rt_thread_t tid_heat = RT_NULL;
|
|
rt_thread_t tid_heat = RT_NULL;
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
/***************************************************************************/
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
int thread_delete_workloop(void)
|
|
int thread_delete_workloop(void)
|
|
|
{
|
|
{
|
|
|
rt_err_t result;
|
|
rt_err_t result;
|
|
@@ -614,71 +611,7 @@ Output: NULL
|
|
|
Return: NULL
|
|
Return: NULL
|
|
|
Others: NULL
|
|
Others: NULL
|
|
|
*************************************************/
|
|
*************************************************/
|
|
|
-void ctr_develop(void)
|
|
|
|
|
-{
|
|
|
|
|
- rt_kprintf("===============开始培养=================:%d\n",device_status.cul_time);
|
|
|
|
|
- //已经培养的时间-分钟
|
|
|
|
|
- device_status.stay_time = 0;
|
|
|
|
|
- rt_uint32_t ii = 0;
|
|
|
|
|
|
|
|
|
|
- while(device_status.develop_flag==1)
|
|
|
|
|
- {
|
|
|
|
|
- float stayedtime = 0.01;
|
|
|
|
|
- char stayed[5];
|
|
|
|
|
- stayedtime = (float)device_status.stay_time / 60.0;
|
|
|
|
|
- sprintf(stayed,"%0.02f",stayedtime);
|
|
|
|
|
- HMI_WRITE("workSta.staytime.txt=\"%s\"",stayed);
|
|
|
|
|
- ii++;
|
|
|
|
|
- LOG_I("developing...................................%d\n",ii);
|
|
|
|
|
- LOG_I("============================设定的培养温度:%d\n",device_status.heatvalue);
|
|
|
|
|
- LOG_I("============================培养仓实时温度:%d\n",device_status.pre_temp);
|
|
|
|
|
- if(device_status.pre_temp<(device_status.heatvalue-5))
|
|
|
|
|
- {
|
|
|
|
|
- //未制冷
|
|
|
|
|
- if(device_status.cold_status==0)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Heat(ON);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Heat(OFF);
|
|
|
|
|
- }
|
|
|
|
|
- LOG_I("============================制冷开关:%d\n",device_status.cold_sw);
|
|
|
|
|
- if(device_status.cold_sw==1)
|
|
|
|
|
- {
|
|
|
|
|
- if(device_status.pre_temp>(device_status.heatvalue-10))
|
|
|
|
|
- {
|
|
|
|
|
- if(device_status.heat_status==0)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Cold(ON);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Cold(OFF);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if(ii%60==0)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.stay_time++;
|
|
|
|
|
- if(device_status.stay_time / 60 == device_status.cul_time) device_status.develop_flag = 0;
|
|
|
|
|
- LOG_I("developed...................................%d分钟\n",device_status.stay_time);
|
|
|
|
|
- }
|
|
|
|
|
- if(device_status.box_temp>35)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Cool_Fan(ON);
|
|
|
|
|
- }
|
|
|
|
|
- else if (device_status.box_temp<30)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Cool_Fan(OFF);
|
|
|
|
|
- }
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- }
|
|
|
|
|
- ctr_Cold(OFF);
|
|
|
|
|
- ctr_Heat(OFF);
|
|
|
|
|
- LOG_I("=========!!!培养完成!!!==========");
|
|
|
|
|
-}
|
|
|
|
|
/*上仓门*/
|
|
/*上仓门*/
|
|
|
uint8_t ctr_cangmen_up(uint8_t status_up)
|
|
uint8_t ctr_cangmen_up(uint8_t status_up)
|
|
|
{
|
|
{
|
|
@@ -2042,229 +1975,6 @@ void WorkCheck(void)
|
|
|
rt_thread_delay(1000);
|
|
rt_thread_delay(1000);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void WorkTask_BZY(void)
|
|
|
|
|
-{
|
|
|
|
|
- if(device_status.ds==1)
|
|
|
|
|
- {
|
|
|
|
|
- //时间段判断
|
|
|
|
|
- //先判断第一个时间段
|
|
|
|
|
- time_t now;
|
|
|
|
|
- time(&now);
|
|
|
|
|
- static struct tm now_stamp; //现在
|
|
|
|
|
- static struct tm cul_sh1_stamp; //开始1
|
|
|
|
|
- static struct tm cul_eh1_stamp; //结束1
|
|
|
|
|
- static struct tm cul_sh2_stamp; //开始2
|
|
|
|
|
- static struct tm cul_eh2_stamp; //结束2
|
|
|
|
|
- static struct tm cul_sh3_stamp; //开始3
|
|
|
|
|
- static struct tm cul_eh3_stamp; //结束3
|
|
|
|
|
- now_stamp = *localtime(&now);
|
|
|
|
|
- //获取定时开始的时间戳
|
|
|
|
|
- cul_sh1_stamp = *localtime(&now);
|
|
|
|
|
- cul_sh1_stamp.tm_hour = device_status.collecting_sh1;
|
|
|
|
|
- cul_sh1_stamp.tm_min = 0;
|
|
|
|
|
- cul_sh1_stamp.tm_sec = 0;
|
|
|
|
|
- cul_sh2_stamp = *localtime(&now);
|
|
|
|
|
- cul_sh2_stamp.tm_hour = device_status.collecting_sh2;
|
|
|
|
|
- cul_sh2_stamp.tm_min = 0;
|
|
|
|
|
- cul_sh2_stamp.tm_sec = 0;
|
|
|
|
|
- cul_sh3_stamp = *localtime(&now);
|
|
|
|
|
- cul_sh3_stamp.tm_hour = device_status.collecting_sh3;
|
|
|
|
|
- cul_sh3_stamp.tm_min = 0;
|
|
|
|
|
- cul_sh3_stamp.tm_sec = 0;
|
|
|
|
|
- //获取定时结束的时间戳
|
|
|
|
|
- cul_eh1_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh1_stamp.tm_hour = device_status.collecting_eh1;
|
|
|
|
|
- cul_eh1_stamp.tm_min = 0;
|
|
|
|
|
- cul_eh1_stamp.tm_sec = 0;
|
|
|
|
|
- cul_eh2_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh2_stamp.tm_hour = device_status.collecting_eh2;
|
|
|
|
|
- cul_eh2_stamp.tm_min = 0;
|
|
|
|
|
- cul_eh2_stamp.tm_sec = 0;
|
|
|
|
|
- cul_eh3_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh3_stamp.tm_hour = device_status.collecting_eh3;
|
|
|
|
|
- cul_eh3_stamp.tm_min = 0;
|
|
|
|
|
- cul_eh3_stamp.tm_sec = 0;
|
|
|
|
|
- LOG_I("采集时间1-%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_sh1_stamp.tm_year+1900,cul_sh1_stamp.tm_mon+1,cul_sh1_stamp.tm_mday,cul_sh1_stamp.tm_hour,cul_sh1_stamp.tm_min,cul_sh1_stamp.tm_sec);
|
|
|
|
|
- LOG_I("采集时间2-%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_sh2_stamp.tm_year+1900,cul_sh2_stamp.tm_mon+1,cul_sh2_stamp.tm_mday,cul_sh2_stamp.tm_hour,cul_sh2_stamp.tm_min,cul_sh2_stamp.tm_sec);
|
|
|
|
|
- LOG_I("采集时间3-%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_sh3_stamp.tm_year+1900,cul_sh3_stamp.tm_mon+1,cul_sh3_stamp.tm_mday,cul_sh3_stamp.tm_hour,cul_sh3_stamp.tm_min,cul_sh3_stamp.tm_sec);
|
|
|
|
|
- LOG_I("结束时间1-%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_eh1_stamp.tm_year+1900,cul_eh1_stamp.tm_mon+1,cul_eh1_stamp.tm_mday,cul_eh1_stamp.tm_hour,cul_eh1_stamp.tm_min,cul_eh1_stamp.tm_sec);
|
|
|
|
|
- LOG_I("结束时间2-%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_eh2_stamp.tm_year+1900,cul_eh2_stamp.tm_mon+1,cul_eh2_stamp.tm_mday,cul_eh2_stamp.tm_hour,cul_eh2_stamp.tm_min,cul_eh2_stamp.tm_sec);
|
|
|
|
|
- LOG_I("结束时间3-%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_eh3_stamp.tm_year+1900,cul_eh3_stamp.tm_mon+1,cul_eh3_stamp.tm_mday,cul_eh3_stamp.tm_hour,cul_eh3_stamp.tm_min,cul_eh3_stamp.tm_sec);
|
|
|
|
|
- //此处判断,一个一个时间段判断,判断当前时间是否大于开始时间:
|
|
|
|
|
- //当前时间戳小于第一段开始时间戳
|
|
|
|
|
- if(difftime(mktime(&now_stamp), mktime(&cul_sh1_stamp)) < 0)
|
|
|
|
|
- {
|
|
|
|
|
- time_t now;
|
|
|
|
|
- time(&now);
|
|
|
|
|
- cul_sh1_stamp = *localtime(&now);
|
|
|
|
|
- cul_sh1_stamp.tm_hour = device_status.collecting_sh1;
|
|
|
|
|
- cul_sh1_stamp.tm_min = 0;
|
|
|
|
|
- cul_sh1_stamp.tm_sec = 0;
|
|
|
|
|
- now_stamp = *localtime(&now);
|
|
|
|
|
- LOG_I("======收集时间1:%04d年%02d月%02d日%02d时%02d分%02d秒.",cul_sh1_stamp.tm_year+1900,cul_sh1_stamp.tm_mon+1,cul_sh1_stamp.tm_mday,cul_sh1_stamp.tm_hour,cul_sh1_stamp.tm_min,cul_sh1_stamp.tm_sec);
|
|
|
|
|
- LOG_I("======未到收集时间1:%04d年%02d月%02d日%02d时%02d分%02d秒.",now_stamp.tm_year+1900,now_stamp.tm_mon+1,now_stamp.tm_mday,now_stamp.tm_hour,now_stamp.tm_min,now_stamp.tm_sec);
|
|
|
|
|
- LOG_D("run_sta:%d",device_status.run_sta);
|
|
|
|
|
- }
|
|
|
|
|
- //当前时间戳小于第二段结束 时间戳并且大于第1段结束时间戳
|
|
|
|
|
- if(difftime(mktime(&now_stamp), mktime(&cul_sh2_stamp)) < 0&&difftime(mktime(&now_stamp), mktime(&cul_eh1_stamp)) > 0)
|
|
|
|
|
- {
|
|
|
|
|
- time_t now;
|
|
|
|
|
- time(&now);
|
|
|
|
|
- cul_sh2_stamp = *localtime(&now);
|
|
|
|
|
- cul_sh2_stamp.tm_hour = device_status.collecting_sh2;
|
|
|
|
|
- cul_sh2_stamp.tm_min = 0;
|
|
|
|
|
- cul_sh2_stamp.tm_sec = 0;
|
|
|
|
|
- now_stamp = *localtime(&now);
|
|
|
|
|
- LOG_I("==============收集时间2:%04d年%02d月%02d日%02d时%02d分%02d秒.\n",cul_sh2_stamp.tm_year+1900,cul_sh2_stamp.tm_mon+1,cul_sh2_stamp.tm_mday,cul_sh2_stamp.tm_hour,cul_sh2_stamp.tm_min,cul_sh2_stamp.tm_sec);
|
|
|
|
|
- LOG_I("==============未到收集时间2:%04d年%02d月%02d日%02d时%02d分%02d秒.\n",now_stamp.tm_year+1900,now_stamp.tm_mon+1,now_stamp.tm_mday,now_stamp.tm_hour,now_stamp.tm_min,now_stamp.tm_sec);
|
|
|
|
|
- LOG_D("run_sta:%d",device_status.run_sta);
|
|
|
|
|
- }
|
|
|
|
|
- //如果当前 时间戳大于开始时间戳并且小于 结束时间戳
|
|
|
|
|
- if(difftime(mktime(&now_stamp), mktime(&cul_sh1_stamp)) >= 0&&difftime(mktime(&now_stamp), mktime(&cul_eh2_stamp)) < 0)
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- //转盘到涂凡士林位置
|
|
|
|
|
- if(device_status.run_sta==0)
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("start to collect!!!");
|
|
|
|
|
- DTU_Write("collect.mp3");
|
|
|
|
|
- ctr_turn(90,4);
|
|
|
|
|
- rt_thread_delay(2000);
|
|
|
|
|
- //涂凡士林
|
|
|
|
|
- ctr_Petroleum_jelly(10);
|
|
|
|
|
- rt_thread_delay(5000);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*转盘到采集位置*/
|
|
|
|
|
- if(device_status.run_sta==4)
|
|
|
|
|
- ctr_turn(90,1);
|
|
|
|
|
-
|
|
|
|
|
- //只有开始和结束时刻不同的时间段,才有效
|
|
|
|
|
- if((difftime(mktime(&cul_eh1_stamp), mktime(&now_stamp)) > 0)||(difftime(mktime(&cul_eh2_stamp), mktime(&now_stamp)) > 0))
|
|
|
|
|
- {
|
|
|
|
|
- if((difftime(mktime(&cul_eh1_stamp), mktime(&now_stamp)) > 0)&& difftime(mktime(&now_stamp),mktime(&cul_sh1_stamp)) > 0)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.work_status = 1;
|
|
|
|
|
- ctr_Collect_Fan(ON);
|
|
|
|
|
- //当前时间戳小于第一段结束时间戳
|
|
|
|
|
- while(difftime(mktime(&cul_eh1_stamp), mktime(&now_stamp))>0)
|
|
|
|
|
- {
|
|
|
|
|
- time(&now);
|
|
|
|
|
- now_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh1_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh1_stamp.tm_hour = device_status.collecting_eh1;
|
|
|
|
|
- cul_eh1_stamp.tm_min = 0;
|
|
|
|
|
- cul_eh1_stamp.tm_sec = 0;
|
|
|
|
|
- if(device_status.run_sta!=1) break;
|
|
|
|
|
- LOG_I("1===========采集风机启动,正在收集.....%d-%d",mktime(&now_stamp),mktime(&cul_eh1_stamp));
|
|
|
|
|
- rt_thread_mdelay(10000);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- device_status.work_status=0;
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- LOG_I("未到收集1时间!");
|
|
|
|
|
- }
|
|
|
|
|
- if(difftime(mktime(&cul_eh2_stamp), mktime(&now_stamp)) > 0 && difftime(mktime(&now_stamp),mktime(&cul_sh2_stamp)) > 0)
|
|
|
|
|
- {
|
|
|
|
|
- device_status.work_status = 1;
|
|
|
|
|
- ctr_Collect_Fan(ON);
|
|
|
|
|
- while(difftime(mktime(&cul_eh2_stamp), mktime(&now_stamp))>0)
|
|
|
|
|
- {
|
|
|
|
|
- time(&now);
|
|
|
|
|
- now_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh2_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh2_stamp.tm_hour = device_status.collecting_eh2;
|
|
|
|
|
- cul_eh2_stamp.tm_min = 0;
|
|
|
|
|
- cul_eh2_stamp.tm_sec = 0;
|
|
|
|
|
- if(device_status.run_sta!=1) break;
|
|
|
|
|
- LOG_I("2===========采集风机启动,正在收集.....%d-%d",mktime(&now_stamp),mktime(&cul_eh2_stamp));
|
|
|
|
|
- rt_thread_mdelay(10000);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- device_status.work_status=0;
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- LOG_I("未到收集2时间!");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- LOG_I("this collect time is 0s,The wait time cannot be negative!");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if(device_status.run_sta==2)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- device_status.develop_flag = 1;
|
|
|
|
|
- device_status.work_status = 2;
|
|
|
|
|
- ctr_develop(); //培养
|
|
|
|
|
- ctr_turn(90,3);
|
|
|
|
|
- }
|
|
|
|
|
- if(device_status.run_sta==3)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- device_status.work_status = 3;
|
|
|
|
|
- device_status.autotakepic=1; //对焦拍照
|
|
|
|
|
- }
|
|
|
|
|
- //在培养之前再次确认时间戳
|
|
|
|
|
- time(&now);
|
|
|
|
|
- now_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh2_stamp = *localtime(&now);
|
|
|
|
|
- cul_eh2_stamp.tm_hour = device_status.collecting_eh2;
|
|
|
|
|
- cul_eh2_stamp.tm_min = 0;
|
|
|
|
|
- cul_eh2_stamp.tm_sec = 0;
|
|
|
|
|
- //当前时间戳大于收集结束时间戳并且run_sta==1
|
|
|
|
|
- if(device_status.run_sta==1 && difftime(mktime(&now_stamp), mktime(&cul_eh2_stamp)) > 0)
|
|
|
|
|
- {
|
|
|
|
|
- ctr_Collect_Fan(OFF);
|
|
|
|
|
- LOG_I("===============collect ok,turn to drop!!!");
|
|
|
|
|
- device_status.develop_flag=1;
|
|
|
|
|
- device_status.work_status=2; //现在是培养
|
|
|
|
|
- DTU_Write("develop.mp3");
|
|
|
|
|
- if(device_status.run_sta==1)
|
|
|
|
|
- ctr_turn(90,2); /*转盘到培养位置*/
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- ctr_shake(ON,device_status.shake_sec);
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- ctr_develop(); //培养
|
|
|
|
|
- if(device_status.run_sta==2)
|
|
|
|
|
- ctr_turn(90,3); /*转盘到拍照位置*/
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- device_status.work_status=3; //现在是拍照
|
|
|
|
|
- device_status.autotakepic=1; //对焦拍照
|
|
|
|
|
- while(device_status.autotakepic==0)
|
|
|
|
|
- {
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- LOG_I("正在对焦拍照............");
|
|
|
|
|
- }
|
|
|
|
|
- device_status.work_status = 0; //待机
|
|
|
|
|
- DTU_Write("wait.mp3");
|
|
|
|
|
- LOG_I("=====================work finished==================");
|
|
|
|
|
- }
|
|
|
|
|
- rt_thread_delay(1000);
|
|
|
|
|
- }
|
|
|
|
|
- device_status.work_status = 0; //待机
|
|
|
|
|
- LOG_W("==================!!!设备已待机!!!===================");
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-void WorkTask_BZYV2(void)
|
|
|
|
|
-{
|
|
|
|
|
- //打开采集风机
|
|
|
|
|
- ctr_Collect_Fan(ON);
|
|
|
|
|
- //打开胶带步进电机
|
|
|
|
|
-
|
|
|
|
|
- //等待采集结束
|
|
|
|
|
-
|
|
|
|
|
- //拍照
|
|
|
|
|
-
|
|
|
|
|
- //打开相机供电
|
|
|
|
|
- //打开补光灯
|
|
|
|
|
- //滑台归位
|
|
|
|
|
- //滑台启动
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
//工作任务流程s
|
|
//工作任务流程s
|
|
|
void WorkTask(void)
|
|
void WorkTask(void)
|
|
|
{
|
|
{
|
|
@@ -2347,7 +2057,6 @@ void WorkTask(void)
|
|
|
ctr_Fan_PUT(OFF);
|
|
ctr_Fan_PUT(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
rt_kprintf("正在收集.....剩余时间:%d分-%d秒\n",device_status.clt_time,clt_time);
|
|
rt_kprintf("正在收集.....剩余时间:%d分-%d秒\n",device_status.clt_time,clt_time);
|
|
|
- HMI_WRITE("workSta.g0.txt=\"正在收集.....剩余时间:%d分-%d秒\"",device_status.clt_time,clt_time);
|
|
|
|
|
//如果触发异常
|
|
//如果触发异常
|
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
if(device_status.bat_status == 1 || device_status.temp_status == 1|| device_status.rain_status==1)
|
|
|
{
|
|
{
|
|
@@ -2360,7 +2069,6 @@ void WorkTask(void)
|
|
|
ctr_Fan_IN(OFF);
|
|
ctr_Fan_IN(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
rt_kprintf("异常退出!!!\n");
|
|
rt_kprintf("异常退出!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"异常退出\"");
|
|
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
@@ -2374,7 +2082,6 @@ void WorkTask(void)
|
|
|
ctr_Fan_IN(OFF);
|
|
ctr_Fan_IN(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
rt_kprintf("异常退出!!!\n");
|
|
rt_kprintf("异常退出!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"异常退出\"");
|
|
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2390,7 +2097,6 @@ void WorkTask(void)
|
|
|
ctr_Fan_IN(OFF);
|
|
ctr_Fan_IN(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
rt_kprintf("异常退出!!!\n");
|
|
rt_kprintf("异常退出!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"异常退出\"");
|
|
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
if(device_status.timeSwitch==0&&device_status.sun_status==1)
|
|
@@ -2404,7 +2110,6 @@ void WorkTask(void)
|
|
|
ctr_Fan_IN(OFF);
|
|
ctr_Fan_IN(OFF);
|
|
|
#endif
|
|
#endif
|
|
|
rt_kprintf("异常退出!!!\n");
|
|
rt_kprintf("异常退出!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"异常退出\"");
|
|
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
#if 0//LAMP_EN == 0
|
|
#if 0//LAMP_EN == 0
|
|
@@ -2413,7 +2118,6 @@ void WorkTask(void)
|
|
|
//4.关闭上仓门
|
|
//4.关闭上仓门
|
|
|
device_status.ctr_up_motor = 2;
|
|
device_status.ctr_up_motor = 2;
|
|
|
rt_kprintf("关闭上仓门!!!\n");
|
|
rt_kprintf("关闭上仓门!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"关闭上仓门!\"");
|
|
|
|
|
while(device_status.ctr_up_motor!=0)
|
|
while(device_status.ctr_up_motor!=0)
|
|
|
{
|
|
{
|
|
|
rt_thread_delay(100);
|
|
rt_thread_delay(100);
|
|
@@ -2447,7 +2151,6 @@ void WorkTask(void)
|
|
|
{
|
|
{
|
|
|
rt_thread_delay(100);
|
|
rt_thread_delay(100);
|
|
|
rt_kprintf("等待下仓门打开!!!\n");
|
|
rt_kprintf("等待下仓门打开!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"等待下仓门打开!\"");
|
|
|
|
|
}
|
|
}
|
|
|
rt_thread_delay(3000);
|
|
rt_thread_delay(3000);
|
|
|
//关闭下仓门
|
|
//关闭下仓门
|
|
@@ -2456,11 +2159,9 @@ void WorkTask(void)
|
|
|
{
|
|
{
|
|
|
rt_thread_delay(100);
|
|
rt_thread_delay(100);
|
|
|
rt_kprintf("等待下仓门关闭!!!\n");
|
|
rt_kprintf("等待下仓门关闭!!!\n");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"等待下仓门关闭!\"");
|
|
|
|
|
}
|
|
}
|
|
|
//2022-04-12add:
|
|
//2022-04-12add:
|
|
|
LOG_I("打开上仓门!!!");
|
|
LOG_I("打开上仓门!!!");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"打开上仓门!\"");
|
|
|
|
|
device_status.ctr_up_motor = 1;
|
|
device_status.ctr_up_motor = 1;
|
|
|
if(device_status.version_type==4||device_status.version_type==41)
|
|
if(device_status.version_type==4||device_status.version_type==41)
|
|
|
{
|
|
{
|
|
@@ -2468,7 +2169,6 @@ void WorkTask(void)
|
|
|
ctr_shake(ON, device_status.shake_sec);
|
|
ctr_shake(ON, device_status.shake_sec);
|
|
|
//补光&&拍照
|
|
//补光&&拍照
|
|
|
LOG_I("拍照!!!");
|
|
LOG_I("拍照!!!");
|
|
|
- HMI_WRITE("workSta.g0.txt=\"拍照!\"");
|
|
|
|
|
ctr_led(ON);
|
|
ctr_led(ON);
|
|
|
HK_TakePhoto();
|
|
HK_TakePhoto();
|
|
|
//清扫
|
|
//清扫
|
|
@@ -2494,24 +2194,45 @@ void WorkTask(void)
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if(device_status.bat_status == 1 || device_status.temp_status == 1 || device_status.rain_status==1 || device_status.ds==0)
|
|
|
|
|
- {
|
|
|
|
|
- rt_kprintf("-------------------not work--------------------\n");
|
|
|
|
|
- device_status.work_status = 0;
|
|
|
|
|
- }
|
|
|
|
|
- //工作结束
|
|
|
|
|
- if(device_status.work_done==0&&device_status.work_status==0)
|
|
|
|
|
- {
|
|
|
|
|
- DTU_Write("workdone");
|
|
|
|
|
- HMI_WRITE("workSta.g0.txt=\"工作任务已完成!\"");
|
|
|
|
|
- if (device_status.version_type==1) {
|
|
|
|
|
- turnzp(); //2024-03-21 :开机不再转仓
|
|
|
|
|
- }
|
|
|
|
|
- ResetInit();
|
|
|
|
|
- clt_time = 0;
|
|
|
|
|
|
|
+ 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 :开机不再转仓
|
|
|
}
|
|
}
|
|
|
- rt_kprintf("***not work-device status:%d\n",device_status.ds);
|
|
|
|
|
|
|
+ ResetInit();
|
|
|
|
|
+ clt_time = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ rt_kprintf("***not work-device status:%d\n",device_status.ds);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void WorkTask_CB5(void)
|
|
|
|
|
+{
|
|
|
|
|
+ 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)
|
|
|
|
|
+ {
|
|
|
|
|
+ //打开灯管
|
|
|
|
|
+ ctr_lamp(ON,1);
|
|
|
|
|
+ //推杆电机打开,导流板到落虫通道
|
|
|
|
|
+ //发送串口消息,通知yolo是被及相机采集模块启动,定期将模块的运行状态展示到屏幕上
|
|
|
|
|
+ //收到益虫信号->
|
|
|
|
|
+ //收到害虫信号->
|
|
|
|
|
+ }
|
|
|
|
|
+ device_status.work_status = 0;
|
|
|
|
|
+ //工作结束
|
|
|
|
|
+ if(device_status.work_done==0&&device_status.work_status==0)
|
|
|
|
|
+ {
|
|
|
|
|
+ DTU_Write("workdone");
|
|
|
|
|
+ ResetInit();
|
|
|
|
|
+ }
|
|
|
|
|
+ LOG_I("WorkTask_CB5 sleeping......");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/* 入口函数-工作状态检测 */
|
|
/* 入口函数-工作状态检测 */
|
|
|
static void Work_status_thread_entry(void *parameter)
|
|
static void Work_status_thread_entry(void *parameter)
|
|
|
{
|
|
{
|
|
@@ -2541,10 +2262,6 @@ static void Work_Loop_thread_entry(void *parameter)
|
|
|
ResetInit();
|
|
ResetInit();
|
|
|
while(1)
|
|
while(1)
|
|
|
{
|
|
{
|
|
|
- if(device_status.dtype==7)
|
|
|
|
|
- {
|
|
|
|
|
- WorkTask_BZY();
|
|
|
|
|
- }
|
|
|
|
|
if(device_status.version_type!=6&&device_status.dtype==3)
|
|
if(device_status.version_type!=6&&device_status.dtype==3)
|
|
|
{
|
|
{
|
|
|
WorkTask();
|
|
WorkTask();
|
|
@@ -2553,6 +2270,10 @@ static void Work_Loop_thread_entry(void *parameter)
|
|
|
{
|
|
{
|
|
|
WorkTask_XCT();
|
|
WorkTask_XCT();
|
|
|
}
|
|
}
|
|
|
|
|
+ if(device_status.version_type==5)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
rt_thread_delay(1000);
|
|
rt_thread_delay(1000);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -2640,7 +2361,6 @@ static void Control_Clear_thread_entry(void *parameter)
|
|
|
/*入口函数加热*/
|
|
/*入口函数加热*/
|
|
|
static void Control_Heat_thread_entry(void *parameter)
|
|
static void Control_Heat_thread_entry(void *parameter)
|
|
|
{
|
|
{
|
|
|
- uint16_t var_clear = 0;
|
|
|
|
|
while(1)
|
|
while(1)
|
|
|
{
|
|
{
|
|
|
if(device_status.work_status==1&&device_status.heat_sw==1)
|
|
if(device_status.work_status==1&&device_status.heat_sw==1)
|
|
@@ -2725,19 +2445,18 @@ int Workstatus_check(void)
|
|
|
/*工作流程线程*/
|
|
/*工作流程线程*/
|
|
|
int Work_Loop_Task(void)
|
|
int Work_Loop_Task(void)
|
|
|
{
|
|
{
|
|
|
- rt_err_t result_loop;
|
|
|
|
|
|
|
+ rt_err_t result_loop = 0;
|
|
|
/* 创建线程*/
|
|
/* 创建线程*/
|
|
|
tid_workloop = rt_thread_create("work_loop_thread",
|
|
tid_workloop = rt_thread_create("work_loop_thread",
|
|
|
Work_Loop_thread_entry, RT_NULL,
|
|
Work_Loop_thread_entry, RT_NULL,
|
|
|
WORK_LOOP_THREAD_STACK_SIZE, //2048
|
|
WORK_LOOP_THREAD_STACK_SIZE, //2048
|
|
|
WORK_LOOP_THREAD_PRIORITY, //12
|
|
WORK_LOOP_THREAD_PRIORITY, //12
|
|
|
WORK_LOOP_THREAD_TIMESLICE); //5
|
|
WORK_LOOP_THREAD_TIMESLICE); //5
|
|
|
- #if Color_EN == 0
|
|
|
|
|
|
|
+
|
|
|
if(tid_workloop!=RT_NULL)
|
|
if(tid_workloop!=RT_NULL)
|
|
|
{
|
|
{
|
|
|
result_loop = rt_thread_startup(tid_workloop);
|
|
result_loop = rt_thread_startup(tid_workloop);
|
|
|
}
|
|
}
|
|
|
- #endif
|
|
|
|
|
return result_loop;
|
|
return result_loop;
|
|
|
}
|
|
}
|
|
|
MSH_CMD_EXPORT(HardWare_Check,HardWare_Check<ON|OFF>);
|
|
MSH_CMD_EXPORT(HardWare_Check,HardWare_Check<ON|OFF>);
|