Skip to content

Commit

Permalink
Merge pull request #464 from blurfl/fix-G38.2-for-reversed-z-motor-
Browse files Browse the repository at this point in the history
If zEncoderSteps is negative, use that same sign in G38.2 gcode
  • Loading branch information
MaslowCommunityGardenRobot authored Sep 28, 2018
2 parents 91ce159 + 4e4649e commit 54a517b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cnc_ctrl_v1/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,9 @@ void G38(const String& readString) {


float currentZPos = zAxis.read();
int zDirection = sysSettings.zEncoderSteps<0 ? -1 : 1;

zgoto = sys.inchesToMMConversion * extractGcodeValue(readString, 'Z', currentZPos / sys.inchesToMMConversion);
zgoto = zDirection * sys.inchesToMMConversion * extractGcodeValue(readString, 'Z', currentZPos / sys.inchesToMMConversion);
sys.feedrate = sys.inchesToMMConversion * extractGcodeValue(readString, 'F', sys.feedrate / sys.inchesToMMConversion);
sys.feedrate = constrain(sys.feedrate, 1, sysSettings.maxZRPM * abs(zAxis.getPitch()));

Expand Down

0 comments on commit 54a517b

Please sign in to comment.