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:
parent
fa19a5ceb8
commit
9ea3941ffe
|
|
@ -63,31 +63,30 @@ void process_gcode_command() {
|
||||||
|
|
||||||
// implement axis limits
|
// implement axis limits
|
||||||
#ifdef X_MIN
|
#ifdef X_MIN
|
||||||
if (next_target.target.axis[X] < X_MIN * 1000.)
|
if (next_target.target.axis[X] < (int32_t)(X_MIN * 1000.))
|
||||||
next_target.target.axis[X] = X_MIN * 1000.;
|
next_target.target.axis[X] = (int32_t)(X_MIN * 1000.);
|
||||||
#endif
|
#endif
|
||||||
#ifdef X_MAX
|
#ifdef X_MAX
|
||||||
if (next_target.target.axis[X] > X_MAX * 1000.)
|
if (next_target.target.axis[X] > (int32_t)(X_MAX * 1000.))
|
||||||
next_target.target.axis[X] = X_MAX * 1000.;
|
next_target.target.axis[X] = (int32_t)(X_MAX * 1000.);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Y_MIN
|
#ifdef Y_MIN
|
||||||
if (next_target.target.axis[Y] < Y_MIN * 1000.)
|
if (next_target.target.axis[Y] < (int32_t)(Y_MIN * 1000.))
|
||||||
next_target.target.axis[Y] = Y_MIN * 1000.;
|
next_target.target.axis[Y] = (int32_t)(Y_MIN * 1000.);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Y_MAX
|
#ifdef Y_MAX
|
||||||
if (next_target.target.axis[Y] > Y_MAX * 1000.)
|
if (next_target.target.axis[Y] > (int32_t)(Y_MAX * 1000.))
|
||||||
next_target.target.axis[Y] = Y_MAX * 1000.;
|
next_target.target.axis[Y] = (int32_t)(Y_MAX * 1000.);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Z_MIN
|
#ifdef Z_MIN
|
||||||
if (next_target.target.axis[Z] < Z_MIN * 1000.)
|
if (next_target.target.axis[Z] < (int32_t)(Z_MIN * 1000.))
|
||||||
next_target.target.axis[Z] = Z_MIN * 1000.;
|
next_target.target.axis[Z] = (int32_t)(Z_MIN * 1000.);
|
||||||
#endif
|
#endif
|
||||||
#ifdef Z_MAX
|
#ifdef Z_MAX
|
||||||
if (next_target.target.axis[Z] > Z_MAX * 1000.)
|
if (next_target.target.axis[Z] > (int32_t)(Z_MAX * 1000.))
|
||||||
next_target.target.axis[Z] = Z_MAX * 1000.;
|
next_target.target.axis[Z] = (int32_t)(Z_MAX * 1000.);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// The GCode documentation was taken from http://reprap.org/wiki/Gcode .
|
// The GCode documentation was taken from http://reprap.org/wiki/Gcode .
|
||||||
|
|
||||||
if (next_target.seen_T) {
|
if (next_target.seen_T) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue