From 5118f788d24db64dd721c9a672bb2ab1e4f990f7 Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Tue, 8 Feb 2011 17:52:10 +1100 Subject: [PATCH] preliminary support for soft-limits --- gcode_process.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gcode_process.c b/gcode_process.c index df1b979..cb61c12 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -82,6 +82,33 @@ void process_gcode_command() { // startpoint.E = 0; // moved to dda.c, end of dda_create() and dda_queue.c, next_move() + // implement axis limits + #ifdef X_MIN + if (next_target.X < (X_MIN * STEPS_PER_MM_X)) + next_target.X = X_MIN; + #endif + #ifdef X_MAX + if (next_target.X > (X_MAX * STEPS_PER_MM_X)) + next_target.X = X_MAX; + #endif + #ifdef Y_MIN + if (next_target.Y < (Y_MIN * STEPS_PER_MM_Y)) + next_target.Y = Y_MIN; + #endif + #ifdef Y_MAY + if (next_target.Y > (Y_MAX * STEPS_PER_MM_Y)) + next_target.Y = Y_MAX; + #endif + #ifdef Z_MIN + if (next_target.Z < (Z_MIN * STEPS_PER_MM_Z)) + next_target.Z = Z_MIN; + #endif + #ifdef Z_MAX + if (next_target.Z > (Z_MAX * STEPS_PER_MM_Z)) + next_target.Z = Z_MAX; + #endif + + if (next_target.seen_T) { next_tool = next_target.T; }