|
|
@@ -1359,18 +1359,16 @@ static void HMI_Decode(void)
|
|
|
//入口函数-电机控制及
|
|
|
static void Ctr_Mortor_entry(void* parameter)
|
|
|
{
|
|
|
- rt_uint16_t num_up_open = 200; //20s
|
|
|
- rt_uint16_t num_up_close = 200; //
|
|
|
- rt_uint16_t num_down_open = 200; //
|
|
|
- rt_uint16_t num_down_close = 200; //
|
|
|
+ rt_uint16_t num_up_open = 200; //20s 上仓门打开时间
|
|
|
+ rt_uint16_t num_up_close = 200; // 上仓门关闭时间
|
|
|
+ rt_uint16_t num_down_open = 200; // 下仓门打开时间
|
|
|
+ rt_uint16_t num_down_close = 200; // 下仓门关闭时间
|
|
|
rt_int16_t photo_led_sec = 900; //55S
|
|
|
rt_uint8_t num_tg_open = 200; //20S
|
|
|
rt_uint8_t num_tg_init = 200;
|
|
|
static rt_uint16_t route_off_t = 0;
|
|
|
device_status.route_off_t = 0;
|
|
|
- //int current_t[200];
|
|
|
- /*孢子仪拍照数量*/
|
|
|
- rt_uint16_t photo_setup = 0;
|
|
|
+
|
|
|
rt_pin_mode(CTR_UPC_LIMIT, PIN_MODE_INPUT);
|
|
|
while(1)
|
|
|
{
|
|
|
@@ -1388,70 +1386,49 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
#endif
|
|
|
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);
|
|
|
num_up_open--;
|
|
|
-// current_t[num_up_open] = atoi(device_status.power);
|
|
|
if (num_up_open == 0)
|
|
|
{
|
|
|
ctr_cangmen_up(OFF);
|
|
|
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)
|
|
|
{
|
|
|
-// 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);
|
|
|
num_up_close --;
|
|
|
-// current_t[num_up_close] = atoi(device_status.power);
|
|
|
if (num_up_close == 0)
|
|
|
{
|
|
|
ctr_cangmen_up(OFF);
|
|
|
num_up_close= 200;
|
|
|
}
|
|
|
- //LOG_D("上仓门关闭电流:%d",current_t[num_up_close]);
|
|
|
+ num_up_open = 200;
|
|
|
}
|
|
|
if (device_status.ctr_down_motor == 1)
|
|
|
{
|
|
|
ctr_cangmen_down(OPEN);
|
|
|
num_down_open--;
|
|
|
-// current_t[num_down_open] = atoi(device_status.power);
|
|
|
- //如果关闭仓门1S后检测不到电流增大,则判定为异常
|
|
|
+
|
|
|
if (num_down_open == 0) //2025-07-07,增加限位检测
|
|
|
{
|
|
|
ctr_cangmen_down(OFF);
|
|
|
num_down_open = 200;
|
|
|
}
|
|
|
-// LOG_D("下仓门打开电流:%d",current_t[num_down_open]);
|
|
|
+ num_down_close = 200;
|
|
|
}
|
|
|
else if (device_status.ctr_down_motor == 2)
|
|
|
{
|
|
|
ctr_cangmen_down(CLOSE);
|
|
|
num_down_close--;
|
|
|
-// current_t[num_down_close] = atoi(device_status.power);
|
|
|
|
|
|
if (num_down_close == 0)
|
|
|
{
|
|
|
ctr_cangmen_down(OFF);
|
|
|
num_down_close = 200;
|
|
|
}
|
|
|
-// LOG_D("下仓门关闭电流:%d",current_t[num_down_close]);
|
|
|
+ num_down_open = 200;
|
|
|
}
|
|
|
if(device_status.sun_test==1)
|
|
|
{
|
|
|
@@ -1500,72 +1477,6 @@ static void Ctr_Mortor_entry(void* parameter)
|
|
|
}else{
|
|
|
photo_led_sec = 900;
|
|
|
}
|
|
|
- /*对焦拍照*/
|
|
|
- if(device_status.autotakepic==1)
|
|
|
- {
|
|
|
- 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)
|
|
|
- {
|
|
|
- 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);
|
|
|
- }
|
|
|
- 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){
|
|
|
ctr_Fan_IN(ON); //推杆电机收缩(供电打开,复位)
|
|
|
@@ -1628,95 +1539,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)
|
|
|
{
|
|
|
selfcheck(1);
|