Tuned opening on StepperTest
This commit is contained in:
parent
4b2c0478a2
commit
76911cf9fe
1 changed files with 19 additions and 14 deletions
|
@ -75,34 +75,39 @@ void setPosition() {
|
||||||
Serial.println(currentPosition[2]);
|
Serial.println(currentPosition[2]);
|
||||||
|
|
||||||
if (currentPosition[2] != nextPosition[2]) {
|
if (currentPosition[2] != nextPosition[2]) {
|
||||||
rotateCcwTo(nextPosition[2]);
|
rotateCcwTo(nextPosition[2], false);
|
||||||
rotateCcwTo(nextPosition[2]);
|
rotateCcwTo(nextPosition[2], true);
|
||||||
rotateCcwTo(nextPosition[2]);
|
rotateCcwTo(nextPosition[2], true);
|
||||||
rotateCcwTo(nextPosition[2]);
|
rotateCcwTo(nextPosition[2], true);
|
||||||
|
currentPosition[1] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPosition[1] != nextPosition[1]) {
|
if (currentPosition[1] != nextPosition[1]) {
|
||||||
rotateCwTo(nextPosition[1]);
|
rotateCwTo(nextPosition[1], false);
|
||||||
rotateCwTo(nextPosition[1]);
|
rotateCwTo(nextPosition[1], true);
|
||||||
rotateCwTo(nextPosition[1]);
|
rotateCwTo(nextPosition[1], true);
|
||||||
|
currentPosition[0] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPosition[0] != nextPosition[0]) {
|
if (currentPosition[0] != nextPosition[0]) {
|
||||||
rotateCcwTo(nextPosition[0]);
|
rotateCcwTo(nextPosition[0], false);
|
||||||
rotateCcwTo(nextPosition[0]);
|
rotateCcwTo(nextPosition[0], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
rotateCwTo(10);
|
if (stepperPosition <= 10) {
|
||||||
|
rotateCwTo(0, true);
|
||||||
|
}
|
||||||
|
rotateCwTo(10, false);
|
||||||
|
|
||||||
currentPosition[0] = nextPosition[0];
|
currentPosition[0] = nextPosition[0];
|
||||||
currentPosition[1] = nextPosition[1];
|
currentPosition[1] = nextPosition[1];
|
||||||
currentPosition[2] = nextPosition[2];
|
currentPosition[2] = nextPosition[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
void rotateCwTo(int pos) {
|
void rotateCwTo(int pos, boolean forceFullRotation) {
|
||||||
Serial.print("CW to ");
|
Serial.print("CW to ");
|
||||||
Serial.println(pos);
|
Serial.println(pos);
|
||||||
if (stepperPosition == pos) {
|
if (stepperPosition == pos && forceFullRotation) {
|
||||||
// make sure we actually move one whole turn
|
// make sure we actually move one whole turn
|
||||||
stepper.move(-200 * microStepsFactor);
|
stepper.move(-200 * microStepsFactor);
|
||||||
stepper.runToPosition();
|
stepper.runToPosition();
|
||||||
|
@ -112,10 +117,10 @@ void rotateCwTo(int pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rotateCcwTo(int pos) {
|
void rotateCcwTo(int pos, boolean forceFullRotation) {
|
||||||
Serial.print("CCW to ");
|
Serial.print("CCW to ");
|
||||||
Serial.println(pos);
|
Serial.println(pos);
|
||||||
if (stepperPosition == pos) {
|
if (stepperPosition == pos && forceFullRotation) {
|
||||||
// make sure we actually move one whole turn
|
// make sure we actually move one whole turn
|
||||||
stepper.move(200 * microStepsFactor);
|
stepper.move(200 * microStepsFactor);
|
||||||
stepper.runToPosition();
|
stepper.runToPosition();
|
||||||
|
|
Loading…
Reference in a new issue