gcode_process.c: be more explicit about X_MIN,... type.

Big surprise, this makes the binary a whopping 286 bytes smaller
with software endstops enabled. Looking at the produced assembly,
the former code caused gcc to do the float -> integer conversion
at runtime, using a __floatsisf(). Now the X_MIN, X_MAX... values
are compiled in as integers directly.

This is work related to issue #157.
This commit is contained in:
Markus Hitter 2015-06-03 22:15:19 +02:00
parent fa19a5ceb8
commit 9ea3941ffe
1 changed files with 12 additions and 13 deletions

View File

@ -63,31 +63,30 @@ void process_gcode_command() {
// implement axis limits
#ifdef X_MIN
if (next_target.target.axis[X] < X_MIN * 1000.)
next_target.target.axis[X] = X_MIN * 1000.;
if (next_target.target.axis[X] < (int32_t)(X_MIN * 1000.))
next_target.target.axis[X] = (int32_t)(X_MIN * 1000.);
#endif
#ifdef X_MAX
if (next_target.target.axis[X] > X_MAX * 1000.)
next_target.target.axis[X] = X_MAX * 1000.;
if (next_target.target.axis[X] > (int32_t)(X_MAX * 1000.))
next_target.target.axis[X] = (int32_t)(X_MAX * 1000.);
#endif
#ifdef Y_MIN
if (next_target.target.axis[Y] < Y_MIN * 1000.)
next_target.target.axis[Y] = Y_MIN * 1000.;
if (next_target.target.axis[Y] < (int32_t)(Y_MIN * 1000.))
next_target.target.axis[Y] = (int32_t)(Y_MIN * 1000.);
#endif
#ifdef Y_MAX
if (next_target.target.axis[Y] > Y_MAX * 1000.)
next_target.target.axis[Y] = Y_MAX * 1000.;
if (next_target.target.axis[Y] > (int32_t)(Y_MAX * 1000.))
next_target.target.axis[Y] = (int32_t)(Y_MAX * 1000.);
#endif
#ifdef Z_MIN
if (next_target.target.axis[Z] < Z_MIN * 1000.)
next_target.target.axis[Z] = Z_MIN * 1000.;
if (next_target.target.axis[Z] < (int32_t)(Z_MIN * 1000.))
next_target.target.axis[Z] = (int32_t)(Z_MIN * 1000.);
#endif
#ifdef Z_MAX
if (next_target.target.axis[Z] > Z_MAX * 1000.)
next_target.target.axis[Z] = Z_MAX * 1000.;
if (next_target.target.axis[Z] > (int32_t)(Z_MAX * 1000.))
next_target.target.axis[Z] = (int32_t)(Z_MAX * 1000.);
#endif
// The GCode documentation was taken from http://reprap.org/wiki/Gcode .
if (next_target.seen_T) {