Browse Source

电机增加 move offset 参数配置

master
sige 1 year ago
parent
commit
1db14d18fc
  1. 10
      src/src/main/java/com/my/graphiteDigesterBg/diframe/actuator/DiActMotor.java

10
src/src/main/java/com/my/graphiteDigesterBg/diframe/actuator/DiActMotor.java

@ -26,6 +26,8 @@ public class DiActMotor extends DiActuatorBase {
protected Integer stepMotorIHold;
// look zero edge pulse
protected Integer stepMotorIRun;
// offset
protected Integer moveOffset = 0;
@Override
protected void onEnable() {
@ -88,8 +90,15 @@ public class DiActMotor extends DiActuatorBase {
this.waitForFinish();
}
// set move offset
public void setMoveOffset( String name ) {
this.moveOffset = this.getLocationValue(name);
this.log("setMoveOffset #{}={}", name, this.moveOffset);
}
// move to position
public void moveTo( Integer pos ) {
pos += this.moveOffset;
this.log("moveTo {}", pos);
this.call(DiCommand.MOTOR_EASY_MOVE_TO, pos);
this.waitForFinish();
@ -99,6 +108,7 @@ public class DiActMotor extends DiActuatorBase {
public void moveTo( String key, Object ... args ) {
Integer pos = this.getLocationValue(key, args);
this.log("moveTo #{}={}", key, pos);
pos += this.moveOffset;
this.call(DiCommand.MOTOR_EASY_MOVE_TO, pos);
this.waitForFinish();
}

Loading…
Cancel
Save