Don't use axis_codes if a literal will do

This commit is contained in:
Scott Lahteine 2016-07-06 18:37:21 -07:00
parent 799c60cadc
commit e2f7cb0905

View file

@ -2897,9 +2897,7 @@ inline void gcode_G28() {
#else // NOT DELTA #else // NOT DELTA
bool homeX = code_seen(axis_codes[X_AXIS]), bool homeX = code_seen('X'), homeY = code_seen('Y'), homeZ = code_seen('Z');
homeY = code_seen(axis_codes[Y_AXIS]),
homeZ = code_seen(axis_codes[Z_AXIS]);
home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ); home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
@ -3522,7 +3520,7 @@ inline void gcode_G28() {
delta_grid_spacing[0] = xGridSpacing; delta_grid_spacing[0] = xGridSpacing;
delta_grid_spacing[1] = yGridSpacing; delta_grid_spacing[1] = yGridSpacing;
float zoffset = zprobe_zoffset; float zoffset = zprobe_zoffset;
if (code_seen(axis_codes[Z_AXIS])) zoffset += code_value_axis_units(Z_AXIS); if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
#else // !DELTA #else // !DELTA
/** /**
* solve the plane equation ax + by + d = z * solve the plane equation ax + by + d = z
@ -3835,7 +3833,7 @@ inline void gcode_G28() {
* G92: Set current position to given X Y Z E * G92: Set current position to given X Y Z E
*/ */
inline void gcode_G92() { inline void gcode_G92() {
bool didE = code_seen(axis_codes[E_AXIS]); bool didE = code_seen('E');
if (!didE) stepper.synchronize(); if (!didE) stepper.synchronize();
@ -5017,7 +5015,7 @@ inline void gcode_M18_M84() {
stepper_inactive_time = code_value_millis_from_seconds(); stepper_inactive_time = code_value_millis_from_seconds();
} }
else { else {
bool all_axis = !((code_seen(axis_codes[X_AXIS])) || (code_seen(axis_codes[Y_AXIS])) || (code_seen(axis_codes[Z_AXIS])) || (code_seen(axis_codes[E_AXIS]))); bool all_axis = !((code_seen('X')) || (code_seen('Y')) || (code_seen('Z')) || (code_seen('E')));
if (all_axis) { if (all_axis) {
stepper.finish_and_disable(); stepper.finish_and_disable();
} }
@ -5265,12 +5263,10 @@ inline void gcode_M201() {
* M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec * M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec
*/ */
inline void gcode_M203() { inline void gcode_M203() {
for (int8_t i = 0; i < NUM_AXIS; i++) { for (int8_t i = 0; i < NUM_AXIS; i++)
if (code_seen(axis_codes[i])) { if (code_seen(axis_codes[i]))
planner.max_feedrate[i] = code_value_axis_units(i); planner.max_feedrate[i] = code_value_axis_units(i);
} }
}
}
/** /**
* M204: Set Accelerations in units/sec^2 (M204 P1200 R3000 T3000) * M204: Set Accelerations in units/sec^2 (M204 P1200 R3000 T3000)