Просмотр исходного кода

Merge pull request #4232 from thinkyhead/rc_no_axis_codes_needed

Don't use axis_codes if a literal will do
Scott Lahteine 8 лет назад
Родитель
Сommit
4e84c803a3
1 измененных файлов: 6 добавлений и 10 удалений
  1. 6
    10
      Marlin/Marlin_main.cpp

+ 6
- 10
Marlin/Marlin_main.cpp Просмотреть файл

@@ -2897,9 +2897,7 @@ inline void gcode_G28() {
2897 2897
 
2898 2898
   #else // NOT DELTA
2899 2899
 
2900
-    bool  homeX = code_seen(axis_codes[X_AXIS]),
2901
-          homeY = code_seen(axis_codes[Y_AXIS]),
2902
-          homeZ = code_seen(axis_codes[Z_AXIS]);
2900
+    bool homeX = code_seen('X'), homeY = code_seen('Y'), homeZ = code_seen('Z');
2903 2901
 
2904 2902
     home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
2905 2903
 
@@ -3522,7 +3520,7 @@ inline void gcode_G28() {
3522 3520
         delta_grid_spacing[0] = xGridSpacing;
3523 3521
         delta_grid_spacing[1] = yGridSpacing;
3524 3522
         float zoffset = zprobe_zoffset;
3525
-        if (code_seen(axis_codes[Z_AXIS])) zoffset += code_value_axis_units(Z_AXIS);
3523
+        if (code_seen('Z')) zoffset += code_value_axis_units(Z_AXIS);
3526 3524
       #else // !DELTA
3527 3525
         /**
3528 3526
          * solve the plane equation ax + by + d = z
@@ -3835,7 +3833,7 @@ inline void gcode_G28() {
3835 3833
  * G92: Set current position to given X Y Z E
3836 3834
  */
3837 3835
 inline void gcode_G92() {
3838
-  bool didE = code_seen(axis_codes[E_AXIS]);
3836
+  bool didE = code_seen('E');
3839 3837
 
3840 3838
   if (!didE) stepper.synchronize();
3841 3839
 
@@ -5017,7 +5015,7 @@ inline void gcode_M18_M84() {
5017 5015
     stepper_inactive_time = code_value_millis_from_seconds();
5018 5016
   }
5019 5017
   else {
5020
-    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])));
5018
+    bool all_axis = !((code_seen('X')) || (code_seen('Y')) || (code_seen('Z')) || (code_seen('E')));
5021 5019
     if (all_axis) {
5022 5020
       stepper.finish_and_disable();
5023 5021
     }
@@ -5265,11 +5263,9 @@ inline void gcode_M201() {
5265 5263
  * M203: Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in units/sec
5266 5264
  */
5267 5265
 inline void gcode_M203() {
5268
-  for (int8_t i = 0; i < NUM_AXIS; i++) {
5269
-    if (code_seen(axis_codes[i])) {
5266
+  for (int8_t i = 0; i < NUM_AXIS; i++)
5267
+    if (code_seen(axis_codes[i]))
5270 5268
       planner.max_feedrate[i] = code_value_axis_units(i);
5271
-    }
5272
-  }
5273 5269
 }
5274 5270
 
5275 5271
 /**

Загрузка…
Отмена
Сохранить