|
@@ -172,7 +172,23 @@ void stop_move(void)
|
|
|
uint32_t ctr_move(uint8_t DIR_,uint8_t dir_,uint32_t dis_,uint32_t pulse)
|
|
uint32_t ctr_move(uint8_t DIR_,uint8_t dir_,uint32_t dis_,uint32_t pulse)
|
|
|
{
|
|
{
|
|
|
uint32_t j;
|
|
uint32_t j;
|
|
|
- slidelock();
|
|
|
|
|
|
|
+ switch(DIR_){
|
|
|
|
|
+ case X_:
|
|
|
|
|
+ ctr_lamp(ON,1); //X轴开关:关
|
|
|
|
|
+ ctr_swz(OFF); //Z轴开关:关
|
|
|
|
|
+ ctr_Collect_Fan(OFF); //Y轴开关:关
|
|
|
|
|
+ break;
|
|
|
|
|
+ case Y_:
|
|
|
|
|
+ ctr_swz(OFF); //Z轴开关:关
|
|
|
|
|
+ ctr_lamp(OFF,1); //X轴开关:关
|
|
|
|
|
+ ctr_Collect_Fan(ON); //Y轴开关:开
|
|
|
|
|
+ break;
|
|
|
|
|
+ case Z_:
|
|
|
|
|
+ ctr_swz(ON); //Y轴开关:关
|
|
|
|
|
+ ctr_lamp(OFF,1); //X轴开关:关
|
|
|
|
|
+ ctr_Collect_Fan(OFF); //Y轴开关:关
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
//限位检测初始化
|
|
//限位检测初始化
|
|
|
rt_pin_mode(Limit_Motor_X, PIN_MODE_INPUT);
|
|
rt_pin_mode(Limit_Motor_X, PIN_MODE_INPUT);
|
|
|
rt_pin_mode(Limit_Motor_Y, PIN_MODE_INPUT);
|
|
rt_pin_mode(Limit_Motor_Y, PIN_MODE_INPUT);
|
|
@@ -231,8 +247,6 @@ uint32_t ctr_move(uint8_t DIR_,uint8_t dir_,uint32_t dis_,uint32_t pulse)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
break;
|
|
break;
|
|
|
case Y_:
|
|
case Y_:
|
|
|
ctr_Collect_Fan(ON); //Y轴电源开关:开
|
|
ctr_Collect_Fan(ON); //Y轴电源开关:开
|
|
@@ -249,9 +263,9 @@ uint32_t ctr_move(uint8_t DIR_,uint8_t dir_,uint32_t dis_,uint32_t pulse)
|
|
|
beep_set(pulse, pulse/2); //PWM使能
|
|
beep_set(pulse, pulse/2); //PWM使能
|
|
|
for(j=0;j<dis_;j++){
|
|
for(j=0;j<dis_;j++){
|
|
|
if(slide_para.stop_flag == 0){
|
|
if(slide_para.stop_flag == 0){
|
|
|
- rt_thread_delay(1);
|
|
|
|
|
|
|
+ if(dis_>=8000){rt_thread_delay(10);}else{rt_thread_delay(1);}
|
|
|
if(dir_==0&&rt_pin_read(Limit_Motor_Y)==1){
|
|
if(dir_==0&&rt_pin_read(Limit_Motor_Y)==1){
|
|
|
- rt_thread_delay(1);
|
|
|
|
|
|
|
+ if(dis_>=8000){rt_thread_delay(10);}else{rt_thread_delay(1);}
|
|
|
if(rt_pin_read(Limit_Motor_Y)==1){
|
|
if(rt_pin_read(Limit_Motor_Y)==1){
|
|
|
j = dis_;
|
|
j = dis_;
|
|
|
}
|
|
}
|
|
@@ -278,7 +292,6 @@ uint32_t ctr_move(uint8_t DIR_,uint8_t dir_,uint32_t dis_,uint32_t pulse)
|
|
|
}
|
|
}
|
|
|
//驱动使能
|
|
//驱动使能
|
|
|
rt_pin_write(HK_IO, ON);
|
|
rt_pin_write(HK_IO, ON);
|
|
|
- rt_thread_delay(100);
|
|
|
|
|
beep_set(pulse, pulse/3); //PWM使能
|
|
beep_set(pulse, pulse/3); //PWM使能
|
|
|
for(j=0;j<dis_;j++){
|
|
for(j=0;j<dis_;j++){
|
|
|
if(slide_para.stop_flag == 0){
|
|
if(slide_para.stop_flag == 0){
|
|
@@ -302,24 +315,6 @@ uint32_t ctr_move(uint8_t DIR_,uint8_t dir_,uint32_t dis_,uint32_t pulse)
|
|
|
pwm_stop();
|
|
pwm_stop();
|
|
|
rt_pin_write(HK_IO, ON);
|
|
rt_pin_write(HK_IO, ON);
|
|
|
|
|
|
|
|
- switch(DIR_){
|
|
|
|
|
- case X_:
|
|
|
|
|
- ctr_lamp(ON,1); //X轴开关:关
|
|
|
|
|
- ctr_swz(OFF); //Z轴开关:关
|
|
|
|
|
- ctr_Collect_Fan(OFF); //Y轴开关:关
|
|
|
|
|
- break;
|
|
|
|
|
- case Y_:
|
|
|
|
|
- ctr_swz(OFF); //Z轴开关:关
|
|
|
|
|
- ctr_lamp(OFF,1); //X轴开关:关
|
|
|
|
|
- ctr_Collect_Fan(ON); //Y轴开关:开
|
|
|
|
|
- break;
|
|
|
|
|
- case Z_:
|
|
|
|
|
- ctr_swz(ON); //Y轴开关:关
|
|
|
|
|
- ctr_lamp(OFF,1); //X轴开关:关
|
|
|
|
|
- ctr_Collect_Fan(OFF); //Y轴开关:关
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return dis_;
|
|
return dis_;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1070,7 +1065,7 @@ void slide_thread_entry(void *parameter)
|
|
|
case 1:{
|
|
case 1:{
|
|
|
ctr_move(X_,slide_para.xdir,slide_para.xdis,slide_para.pulse_period);
|
|
ctr_move(X_,slide_para.xdir,slide_para.xdis,slide_para.pulse_period);
|
|
|
LOG_I("The slide's x movement was done ok");
|
|
LOG_I("The slide's x movement was done ok");
|
|
|
- if(slide_para.xdis==55)
|
|
|
|
|
|
|
+ if(slide_para.xdis==55||slide_para.xdis==80)
|
|
|
{
|
|
{
|
|
|
DTU_Write("{\"cmd\": \"takephoto\" }");
|
|
DTU_Write("{\"cmd\": \"takephoto\" }");
|
|
|
device_status.autotakepic = 4;
|
|
device_status.autotakepic = 4;
|
|
@@ -1088,7 +1083,7 @@ void slide_thread_entry(void *parameter)
|
|
|
case 2:{
|
|
case 2:{
|
|
|
ctr_move(Z_,slide_para.zdir,slide_para.zdis,slide_para.pulse_period);
|
|
ctr_move(Z_,slide_para.zdir,slide_para.zdis,slide_para.pulse_period);
|
|
|
rt_kprintf("The slide's z movement was done ok\n");
|
|
rt_kprintf("The slide's z movement was done ok\n");
|
|
|
- if(slide_para.zdis==55)
|
|
|
|
|
|
|
+ if(slide_para.zdis==55||slide_para.zdis==80)
|
|
|
{
|
|
{
|
|
|
DTU_Write("{\"cmd\": \"takephoto\" }");
|
|
DTU_Write("{\"cmd\": \"takephoto\" }");
|
|
|
device_status.autotakepic = 4;
|
|
device_status.autotakepic = 4;
|