From ed7f3ad55922407f08960fefaf73258e944bc6dc Mon Sep 17 00:00:00 2001 From: Phil Hord Date: Fri, 13 Dec 2013 11:10:02 -0500 Subject: [PATCH] simulator: Respect XYZE_INVERT_DIR settings Simulator assumes a basic set of config pins. Most it ignores and redefines. But the INVERT_DIR pins it did not, and these could be useful to simulate. So teach Simulator to respect them. --- simulator/simulator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/simulator/simulator.c b/simulator/simulator.c index 2388708..003d76a 100644 --- a/simulator/simulator.c +++ b/simulator/simulator.c @@ -340,18 +340,30 @@ void WRITE(pin_t pin, bool s) { switch (pin) { case X_STEP_PIN: dir = state[X_DIR_PIN] ? 1 : -1; + #ifdef X_INVERT_DIR + dir = -dir; + #endif axis = X_AXIS; break; case Y_STEP_PIN: dir = state[Y_DIR_PIN] ? 1 : -1; + #ifdef Y_INVERT_DIR + dir = -dir; + #endif axis = Y_AXIS; break; case Z_STEP_PIN: dir = state[Z_DIR_PIN] ? 1 : -1; + #ifdef Z_INVERT_DIR + dir = -dir; + #endif axis = Z_AXIS; break; case E_STEP_PIN: dir = state[E_DIR_PIN] ? 1 : -1; + #ifdef E_INVERT_DIR + dir = -dir; + #endif axis = E_AXIS; break; default: