Is there a way to invert motor direction with GCode instead of Firmware in Marlin
Is there a way to change the direction a motor goes with GCode instead of reconfiguring Marlin firmware?
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.
So, you dont need to invert mootor direction for that porpuse, you need to indicate homing inverted.
Yes, thank you, that makes sense. Is there a way do do that with a GCode command instead of editing the firmware?
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, usingM92 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.
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.
I want to upvote you but it doesn't show because I don't have sufficient reputation points.
License under CC-BY-SA with attribution
Content dated before 7/24/2021 11:53 AM
Fernando Baltazar 5 years ago
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.