Skip to content

Commit

Permalink
Don't use axis_codes if a literal will do
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jul 7, 2016
1 parent 799c60c commit e2f7cb0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2897,9 +2897,7 @@ inline void gcode_G28() {

#else // NOT DELTA

bool homeX = code_seen(axis_codes[X_AXIS]),
homeY = code_seen(axis_codes[Y_AXIS]),
homeZ = code_seen(axis_codes[Z_AXIS]);
bool homeX = code_seen('X'), homeY = code_seen('Y'), homeZ = code_seen('Z');

home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);

Expand Down Expand Up @@ -3522,7 +3520,7 @@ inline void gcode_G28() {
delta_grid_spacing[0] = xGridSpacing;
delta_grid_spacing[1] = yGridSpacing;
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
/**
* solve the plane equation ax + by + d = z
Expand Down Expand Up @@ -3835,7 +3833,7 @@ inline void gcode_G28() {
* G92: Set current position to given X Y Z E
*/
inline void gcode_G92() {
bool didE = code_seen(axis_codes[E_AXIS]);
bool didE = code_seen('E');

if (!didE) stepper.synchronize();

Expand Down Expand Up @@ -5017,7 +5015,7 @@ inline void gcode_M18_M84() {
stepper_inactive_time = code_value_millis_from_seconds();
}
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) {
stepper.finish_and_disable();
}
Expand Down Expand Up @@ -5265,11 +5263,9 @@ inline void gcode_M201() {
* M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec
*/
inline void gcode_M203() {
for (int8_t i = 0; i < NUM_AXIS; i++) {
if (code_seen(axis_codes[i])) {
for (int8_t i = 0; i < NUM_AXIS; i++)
if (code_seen(axis_codes[i]))
planner.max_feedrate[i] = code_value_axis_units(i);
}
}
}

/**
Expand Down

0 comments on commit e2f7cb0

Please sign in to comment.