Is there a way to change the direction a motor goes with GCode instead of reconfiguring Marlin firmware?

  • 1
    $\begingroup$ I don't understand the purpose of your question, but you can try to invert wiring of step motors instead creating another G-code or modifying the firmware. $\endgroup$ Jul 16 '17 at 20:48
  • $\begingroup$ The purpose of inverting a motor's direction in software would be to home to a switch placed in the opposite direction of the usual one, so as to use the homing routine as a Z probe. $\endgroup$
    – jbiondo
    Jul 17 '17 at 21:56
  • $\begingroup$ So, you dont need to invert mootor direction for that porpuse, you need to indicate homing inverted. $\endgroup$ Jul 19 '17 at 15:52
  • $\begingroup$ Yes, thank you, that makes sense. Is there a way do do that with a GCode command instead of editing the firmware? $\endgroup$
    – jbiondo
    Jul 20 '17 at 16:45

You can use M92 to change the axis steps per unit to a negative value, which causes it to move in the opposite direction. I.e. if normally your X axis has 160 steps per mm, using M92 X-160 will invert all of its movements.

However, this is more of a hack than a real, intended solution. It would be better to (if you are concerned with the homing direction) change the configuration to have the printer home in the other direction. Unfortunately, this can only be done by changing the firmware and not through G-code.

  • $\begingroup$ What a brilliant and creative answer! That worked perfectly. I can now use the Z-MAX input as a Z probe, which allows me to probe in the down direction, and I can home in the up direction using the Z-MIN input, just by changing the axis steps to negative or positive as you described. $\endgroup$
    – jbiondo
    Aug 5 '17 at 21:00
  • $\begingroup$ I want to upvote you but it doesn't show because I don't have sufficient reputation points. $\endgroup$
    – jbiondo
    Aug 5 '17 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.