Browse Source

Call code_seen only once per parameter

Scott Lahteine 10 years ago
parent
commit
2945eb6650
1 changed files with 14 additions and 14 deletions
  1. 14
    14
      Marlin/Marlin_main.cpp

+ 14
- 14
Marlin/Marlin_main.cpp View File

@@ -2388,7 +2388,7 @@ inline void gcode_G28() {
2388 2388
   inline void gcode_G29() {
2389 2389
 
2390 2390
     static int probe_point = -1;
2391
-    MeshLevelingState state = code_seen('S') || code_seen('s') ? (MeshLevelingState)code_value_short() : MeshReport;
2391
+    MeshLevelingState state = code_seen('S') ? (MeshLevelingState)code_value_short() : MeshReport;
2392 2392
     if (state < 0 || state > 3) {
2393 2393
       SERIAL_PROTOCOLLNPGM("S out of range (0-3).");
2394 2394
       return;
@@ -2466,7 +2466,7 @@ inline void gcode_G28() {
2466 2466
         break;
2467 2467
 
2468 2468
       case MeshSet:
2469
-        if (code_seen('X') || code_seen('x')) {
2469
+        if (code_seen('X')) {
2470 2470
           ix = code_value_long()-1;
2471 2471
           if (ix < 0 || ix >= MESH_NUM_X_POINTS) {
2472 2472
             SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n");
@@ -2476,7 +2476,7 @@ inline void gcode_G28() {
2476 2476
             SERIAL_PROTOCOLPGM("X not entered.\n");
2477 2477
             return;
2478 2478
         }
2479
-        if (code_seen('Y') || code_seen('y')) {
2479
+        if (code_seen('Y')) {
2480 2480
           iy = code_value_long()-1;
2481 2481
           if (iy < 0 || iy >= MESH_NUM_Y_POINTS) {
2482 2482
             SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n");
@@ -2486,7 +2486,7 @@ inline void gcode_G28() {
2486 2486
             SERIAL_PROTOCOLPGM("Y not entered.\n");
2487 2487
             return;
2488 2488
         }
2489
-        if (code_seen('Z') || code_seen('z')) {
2489
+        if (code_seen('Z')) {
2490 2490
           z = code_value();
2491 2491
         } else {
2492 2492
           SERIAL_PROTOCOLPGM("Z not entered.\n");
@@ -2553,19 +2553,19 @@ inline void gcode_G28() {
2553 2553
       return;
2554 2554
     }
2555 2555
 
2556
-    int verbose_level = code_seen('V') || code_seen('v') ? code_value_short() : 1;
2556
+    int verbose_level = code_seen('V') ? code_value_short() : 1;
2557 2557
     if (verbose_level < 0 || verbose_level > 4) {
2558 2558
       SERIAL_ECHOLNPGM("?(V)erbose Level is implausible (0-4).");
2559 2559
       return;
2560 2560
     }
2561 2561
 
2562
-    bool dryrun = code_seen('D') || code_seen('d'),
2563
-         deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2562
+    bool dryrun = code_seen('D'),
2563
+         deploy_probe_for_each_reading = code_seen('E');
2564 2564
 
2565 2565
     #ifdef AUTO_BED_LEVELING_GRID
2566 2566
 
2567 2567
       #ifndef DELTA
2568
-        bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t');
2568
+        bool do_topography_map = verbose_level > 2 || code_seen('T');
2569 2569
       #endif
2570 2570
 
2571 2571
       if (verbose_level > 0) {
@@ -3223,7 +3223,7 @@ inline void gcode_M42() {
3223 3223
     double sum = 0.0, mean = 0.0, sigma = 0.0, sample_set[50];
3224 3224
     uint8_t verbose_level = 1, n_samples = 10, n_legs = 0;
3225 3225
 
3226
-    if (code_seen('V') || code_seen('v')) {
3226
+    if (code_seen('V')) {
3227 3227
       verbose_level = code_value_short();
3228 3228
       if (verbose_level < 0 || verbose_level > 4 ) {
3229 3229
         SERIAL_PROTOCOLPGM("?Verbose Level not plausible (0-4).\n");
@@ -3234,7 +3234,7 @@ inline void gcode_M42() {
3234 3234
     if (verbose_level > 0)
3235 3235
       SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n");
3236 3236
 
3237
-    if (code_seen('P') || code_seen('p')) {
3237
+    if (code_seen('P')) {
3238 3238
       n_samples = code_value_short();
3239 3239
       if (n_samples < 4 || n_samples > 50) {
3240 3240
         SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n");
@@ -3249,9 +3249,9 @@ inline void gcode_M42() {
3249 3249
            X_probe_location = X_current, Y_probe_location = Y_current,
3250 3250
            Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING;
3251 3251
 
3252
-    bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
3252
+    bool deploy_probe_for_each_reading = code_seen('E');
3253 3253
 
3254
-    if (code_seen('X') || code_seen('x')) {
3254
+    if (code_seen('X')) {
3255 3255
       X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER;
3256 3256
       if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) {
3257 3257
         out_of_range_error(PSTR("X"));
@@ -3259,7 +3259,7 @@ inline void gcode_M42() {
3259 3259
       }
3260 3260
     }
3261 3261
 
3262
-    if (code_seen('Y') || code_seen('y')) {
3262
+    if (code_seen('Y')) {
3263 3263
       Y_probe_location = code_value() -  Y_PROBE_OFFSET_FROM_EXTRUDER;
3264 3264
       if (Y_probe_location < Y_MIN_POS || Y_probe_location > Y_MAX_POS) {
3265 3265
         out_of_range_error(PSTR("Y"));
@@ -3267,7 +3267,7 @@ inline void gcode_M42() {
3267 3267
       }
3268 3268
     }
3269 3269
 
3270
-    if (code_seen('L') || code_seen('l')) {
3270
+    if (code_seen('L')) {
3271 3271
       n_legs = code_value_short();
3272 3272
       if (n_legs == 1) n_legs = 2;
3273 3273
       if (n_legs < 0 || n_legs > 15) {

Loading…
Cancel
Save