From e76bfa0d05e3d81aa646da8b9963cb59ecd40adf Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Sun, 25 May 2014 19:06:07 +0200 Subject: [PATCH] gcode_process.c: more preprocessor conditions for homing movements. Well, optimizer isn't _that_ smart. It apparently removes empty functions in the same compilation unit ( = source code file), but not ones across units. This saves 10 bytes binary size per endstop not used, so 30 bytes in a standard configuration. All without any drawbacks. --- gcode_process.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/gcode_process.c b/gcode_process.c index 9460fdd64..5ad15a282 100644 --- a/gcode_process.c +++ b/gcode_process.c @@ -295,12 +295,18 @@ void process_gcode_command() { //? //? Find the minimum limit of the specified axes by searching for the limit switch. //? - if (next_target.seen_X) - home_x_negative(); - if (next_target.seen_Y) - home_y_negative(); - if (next_target.seen_Z) - home_z_negative(); + #if defined X_MIN_PIN + if (next_target.seen_X) + home_x_negative(); + #endif + #if defined Y_MIN_PIN + if (next_target.seen_Y) + home_y_negative(); + #endif + #if defined Z_MIN_PIN + if (next_target.seen_Z) + home_z_negative(); + #endif break; case 162: @@ -308,12 +314,18 @@ void process_gcode_command() { //? //? Find the maximum limit of the specified axes by searching for the limit switch. //? - if (next_target.seen_X) - home_x_positive(); - if (next_target.seen_Y) - home_y_positive(); - if (next_target.seen_Z) - home_z_positive(); + #if defined X_MAX_PIN + if (next_target.seen_X) + home_x_positive(); + #endif + #if defined Y_MAX_PIN + if (next_target.seen_Y) + home_y_positive(); + #endif + #if defined Z_MAX_PIN + if (next_target.seen_Z) + home_z_positive(); + #endif break; // unknown gcode: spit an error