Skip to content

Commit

Permalink
gcode_process.c: more preprocessor conditions for homing movements.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Traumflug committed Jul 10, 2014
1 parent d53407b commit e76bfa0
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions gcode_process.c
Expand Up @@ -295,25 +295,37 @@ 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:
//? --- G162: Home positive ---
//?
//? 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
Expand Down

0 comments on commit e76bfa0

Please sign in to comment.