|
|
@@ -1438,6 +1438,7 @@ void ResetInit(void)
|
|
|
ctr_Motor86_move(50000, 100, 0); //86电机复位
|
|
|
device_status.ctr_up_motor = 1; //推杆电机缩进去(落虫)
|
|
|
ctr_Collect_Fan(OFF);
|
|
|
+ ctr_Motor_Driver_Power(OFF);
|
|
|
}
|
|
|
if(device_status.version_type==3)
|
|
|
{
|
|
|
@@ -1509,7 +1510,7 @@ void ResetInit(void)
|
|
|
}
|
|
|
//5.关闭加热
|
|
|
//6.关闭补光灯
|
|
|
- ctr_led(OFF);
|
|
|
+ //ctr_led(OFF);
|
|
|
}
|
|
|
}
|
|
|
/*三色光源*/
|
|
|
@@ -2137,7 +2138,7 @@ void guanshan_on(void *args)
|
|
|
rt_event_send(event_485_play, 0x01);
|
|
|
}
|
|
|
|
|
|
-static void pin_guangshan_bind(void)
|
|
|
+void pin_guangshan_bind(void)
|
|
|
{
|
|
|
/* PC14引脚为输入模式 */
|
|
|
rt_pin_mode(GUANG_SHAN, PIN_MODE_INPUT);
|
|
|
@@ -2147,7 +2148,7 @@ static void pin_guangshan_bind(void)
|
|
|
rt_pin_irq_enable(GUANG_SHAN, PIN_IRQ_ENABLE);
|
|
|
}
|
|
|
|
|
|
-static void pin_guangshan_unbind(void)
|
|
|
+void pin_guangshan_unbind(void)
|
|
|
{
|
|
|
rt_pin_detach_irq(GUANG_SHAN);
|
|
|
}
|
|
|
@@ -2157,7 +2158,7 @@ static void pin_guangshan_unbind(void)
|
|
|
void slidelock()
|
|
|
{
|
|
|
ctr_Motor_Driver_Power(ON); //电机驱动供电
|
|
|
- rt_thread_delay(10);
|
|
|
+ rt_thread_delay(100);
|
|
|
rt_pin_mode(Motor_EN, PIN_MODE_OUTPUT); //使能电机驱动引脚 PB14
|
|
|
rt_pin_write(Motor_EN, ON); //引脚输出高使能有效
|
|
|
}
|
|
|
@@ -2214,8 +2215,7 @@ uint16_t ctr_Motor86_move(uint32_t xdis,uint16_t pulse,uint8_t dir)
|
|
|
rt_pin_mode(MOTOR_86, PIN_MODE_INPUT);
|
|
|
//rt_kprintf("run here2");
|
|
|
rt_pin_write(CTR_RO_LIMIT, dir); //CCW 置高
|
|
|
- rt_thread_delay(100);
|
|
|
-
|
|
|
+ rt_thread_delay(50);
|
|
|
while(rt_pin_read(MOTOR_86)==0)
|
|
|
{
|
|
|
rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
@@ -2223,22 +2223,77 @@ uint16_t ctr_Motor86_move(uint32_t xdis,uint16_t pulse,uint8_t dir)
|
|
|
rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
rt_hw_us_delay(pulse);
|
|
|
}
|
|
|
-
|
|
|
- for(j=0;j<xtemp;j++)
|
|
|
+ while(rt_pin_read(MOTOR_86)==1){
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+ rt_hw_us_delay(pulse*5); //后10%以线性减速运动
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+ rt_hw_us_delay(pulse*5);
|
|
|
+ }
|
|
|
+ while(rt_pin_read(MOTOR_86)==0)
|
|
|
{
|
|
|
- rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
- rt_hw_us_delay(pulse); //后10%以线性减速运动
|
|
|
- rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
- rt_hw_us_delay(pulse);
|
|
|
- if(rt_pin_read(MOTOR_86)==0)
|
|
|
- {
|
|
|
- limit_tm++;
|
|
|
- }
|
|
|
- if(limit_tm==10) break;
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+ rt_hw_us_delay(pulse); //后10%以线性减速运动
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+ rt_hw_us_delay(pulse);
|
|
|
+ }
|
|
|
+ if(dir==0)
|
|
|
+ {
|
|
|
+ while(rt_pin_read(MOTOR_86)==1){
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+ rt_hw_us_delay(pulse*5); //后10%以线性减速运动
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+ rt_hw_us_delay(pulse*5);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ rt_thread_delay(500);
|
|
|
+ rt_pin_write(CTR_RO_LIMIT, !dir); //CCW 置高
|
|
|
+ rt_thread_delay(100);
|
|
|
+ while(rt_pin_read(MOTOR_86)==0){
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+ rt_hw_us_delay(pulse*20); //
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+ rt_hw_us_delay(pulse*20);
|
|
|
+ }
|
|
|
+ while(rt_pin_read(MOTOR_86)==1){
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+ rt_hw_us_delay(pulse*10); //
|
|
|
+ rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+ rt_hw_us_delay(pulse*10);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+// while(rt_pin_read(MOTOR_86)==0)
|
|
|
+// {
|
|
|
+// rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+// rt_hw_us_delay(pulse); //后10%以线性减速运动
|
|
|
+// rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+// rt_hw_us_delay(pulse);
|
|
|
+// }
|
|
|
+// if(dir==1)
|
|
|
+// {
|
|
|
+// while(rt_pin_read(MOTOR_86)==1)
|
|
|
+// {
|
|
|
+// rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+// rt_hw_us_delay(pulse*10); //后10%以线性减速运动
|
|
|
+// rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+// rt_hw_us_delay(pulse*10);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for(j=0;j<xtemp;j++)
|
|
|
+// {
|
|
|
+// rt_pin_write(CTR_RC_LIMIT, OFF);
|
|
|
+// rt_hw_us_delay(pulse); //后10%以线性减速运动
|
|
|
+// rt_pin_write(CTR_RC_LIMIT, ON);
|
|
|
+// rt_hw_us_delay(pulse);
|
|
|
+// if(rt_pin_read(MOTOR_86)==0)
|
|
|
+// {
|
|
|
+// limit_tm++;
|
|
|
+// }
|
|
|
+// if(limit_tm==10) break;
|
|
|
+// }
|
|
|
+
|
|
|
slidelock();
|
|
|
- return xdis;
|
|
|
+ return xdis;
|
|
|
}
|
|
|
|
|
|
/*
|