Browse Source

More concise M503 output for M906, M913, M914 (#10947)

Scott Lahteine 6 years ago
parent
commit
d8b983f624
No account linked to committer's email address
1 changed files with 84 additions and 66 deletions
  1. 84
    66
      Marlin/src/module/configuration_store.cpp

+ 84
- 66
Marlin/src/module/configuration_store.cpp View File

@@ -1896,12 +1896,12 @@ void MarlinSettings::reset(PORTARG_SOLO) {
1896 1896
   #define CONFIG_ECHO_START do{ if (!forReplay) SERIAL_ECHO_START_P(port); }while(0)
1897 1897
 
1898 1898
   #if HAS_TRINAMIC
1899
-    void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M906 "); }
1899
+    void say_M906(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M906"); }
1900 1900
     #if ENABLED(HYBRID_THRESHOLD)
1901
-      void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M913 "); }
1901
+      void say_M913(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M913"); }
1902 1902
     #endif
1903 1903
     #if ENABLED(SENSORLESS_HOMING)
1904
-      void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M914 "); }
1904
+      void say_M914(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M914"); }
1905 1905
     #endif
1906 1906
   #endif
1907 1907
 
@@ -2409,49 +2409,56 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2409 2409
         SERIAL_ECHOLNPGM_P(port, "Stepper driver current:");
2410 2410
       }
2411 2411
       CONFIG_ECHO_START;
2412
-      #if X_IS_TRINAMIC
2412
+      #if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC
2413 2413
         say_M906(PORTVAR_SOLO);
2414
-        SERIAL_ECHOLNPAIR_P(port, "X", stepperX.getCurrent());
2415 2414
       #endif
2416
-      #if X2_IS_TRINAMIC
2417
-        say_M906(PORTVAR_SOLO);
2418
-        SERIAL_ECHOLNPAIR_P(port, "I1 X", stepperX2.getCurrent());
2415
+      #if X_IS_TRINAMIC
2416
+        SERIAL_ECHOPAIR_P(port, " X", stepperX.getCurrent());
2419 2417
       #endif
2420 2418
       #if Y_IS_TRINAMIC
2421
-        say_M906(PORTVAR_SOLO);
2422
-        SERIAL_ECHOLNPAIR_P(port, "Y", stepperY.getCurrent());
2423
-      #endif
2424
-      #if Y2_IS_TRINAMIC
2425
-        say_M906(PORTVAR_SOLO);
2426
-        SERIAL_ECHOLNPAIR_P(port, "I1 Y", stepperY2.getCurrent());
2419
+        SERIAL_ECHOPAIR_P(port, " Y", stepperY.getCurrent());
2427 2420
       #endif
2428 2421
       #if Z_IS_TRINAMIC
2422
+        SERIAL_ECHOPAIR_P(port, " Z", stepperZ.getCurrent());
2423
+      #endif
2424
+      #if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC
2425
+        SERIAL_EOL_P(port);
2426
+      #endif
2427
+      #if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC
2429 2428
         say_M906(PORTVAR_SOLO);
2430
-        SERIAL_ECHOLNPAIR_P(port, "Z", stepperZ.getCurrent());
2429
+        SERIAL_ECHOPGM_P(port, " I1");
2430
+      #endif
2431
+      #if X2_IS_TRINAMIC
2432
+        SERIAL_ECHOPAIR_P(port, " X", stepperX2.getCurrent());
2433
+      #endif
2434
+      #if Y2_IS_TRINAMIC
2435
+        SERIAL_ECHOPAIR_P(port, " Y", stepperY2.getCurrent());
2431 2436
       #endif
2432 2437
       #if Z2_IS_TRINAMIC
2433
-        say_M906(PORTVAR_SOLO);
2434
-        SERIAL_ECHOLNPAIR_P(port, "I1 Z", stepperZ2.getCurrent());
2438
+        SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.getCurrent());
2439
+      #endif
2440
+      #if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC
2441
+        SERIAL_EOL_P(port);
2435 2442
       #endif
2436 2443
       #if E0_IS_TRINAMIC
2437 2444
         say_M906(PORTVAR_SOLO);
2438
-        SERIAL_ECHOLNPAIR_P(port, "T0 E", stepperE0.getCurrent());
2445
+        SERIAL_ECHOLNPAIR_P(port, " T0 E", stepperE0.getCurrent());
2439 2446
       #endif
2440 2447
       #if E_STEPPERS > 1 && E1_IS_TRINAMIC
2441 2448
         say_M906(PORTVAR_SOLO);
2442
-        SERIAL_ECHOLNPAIR_P(port, "T1 E", stepperE1.getCurrent());
2449
+        SERIAL_ECHOLNPAIR_P(port, " T1 E", stepperE1.getCurrent());
2443 2450
       #endif
2444 2451
       #if E_STEPPERS > 2 && E2_IS_TRINAMIC
2445 2452
         say_M906(PORTVAR_SOLO);
2446
-        SERIAL_ECHOLNPAIR_P(port, "T2 E", stepperE2.getCurrent());
2453
+        SERIAL_ECHOLNPAIR_P(port, " T2 E", stepperE2.getCurrent());
2447 2454
       #endif
2448 2455
       #if E_STEPPERS > 3 && E3_IS_TRINAMIC
2449 2456
         say_M906(PORTVAR_SOLO);
2450
-        SERIAL_ECHOLNPAIR_P(port, "T3 E", stepperE3.getCurrent());
2457
+        SERIAL_ECHOLNPAIR_P(port, " T3 E", stepperE3.getCurrent());
2451 2458
       #endif
2452 2459
       #if E_STEPPERS > 4 && E4_IS_TRINAMIC
2453 2460
         say_M906(PORTVAR_SOLO);
2454
-        SERIAL_ECHOLNPAIR_P(port, "T4 E", stepperE4.getCurrent());
2461
+        SERIAL_ECHOLNPAIR_P(port, " T4 E", stepperE4.getCurrent());
2455 2462
       #endif
2456 2463
       SERIAL_EOL_P(port);
2457 2464
 
@@ -2464,49 +2471,56 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2464 2471
           SERIAL_ECHOLNPGM_P(port, "Hybrid Threshold:");
2465 2472
         }
2466 2473
         CONFIG_ECHO_START;
2467
-        #if X_IS_TRINAMIC
2474
+        #if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC
2468 2475
           say_M913(PORTVAR_SOLO);
2469
-          SERIAL_ECHOLNPAIR_P(port, "X", TMC_GET_PWMTHRS(X, X));
2470 2476
         #endif
2471
-        #if X2_IS_TRINAMIC
2472
-          say_M913(PORTVAR_SOLO);
2473
-          SERIAL_ECHOLNPAIR_P(port, "I1 X", TMC_GET_PWMTHRS(X, X2));
2477
+        #if X_IS_TRINAMIC
2478
+          SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X));
2474 2479
         #endif
2475 2480
         #if Y_IS_TRINAMIC
2476
-          say_M913(PORTVAR_SOLO);
2477
-          SERIAL_ECHOLNPAIR_P(port, "Y", TMC_GET_PWMTHRS(Y, Y));
2478
-        #endif
2479
-        #if Y2_IS_TRINAMIC
2480
-          say_M913(PORTVAR_SOLO);
2481
-          SERIAL_ECHOLNPAIR_P(port, "I1 Y", TMC_GET_PWMTHRS(Y, Y2));
2481
+          SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y));
2482 2482
         #endif
2483 2483
         #if Z_IS_TRINAMIC
2484
+          SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z));
2485
+        #endif
2486
+        #if X_IS_TRINAMIC || Y_IS_TRINAMIC || Z_IS_TRINAMIC
2487
+          SERIAL_EOL_P(port);
2488
+        #endif
2489
+        #if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC
2484 2490
           say_M913(PORTVAR_SOLO);
2485
-          SERIAL_ECHOLNPAIR_P(port, "Z", TMC_GET_PWMTHRS(Z, Z));
2491
+          SERIAL_ECHOPGM_P(port, " I1");
2492
+        #endif
2493
+        #if X2_IS_TRINAMIC
2494
+          SERIAL_ECHOPAIR_P(port, " X", TMC_GET_PWMTHRS(X, X2));
2495
+        #endif
2496
+        #if Y2_IS_TRINAMIC
2497
+          SERIAL_ECHOPAIR_P(port, " Y", TMC_GET_PWMTHRS(Y, Y2));
2486 2498
         #endif
2487 2499
         #if Z2_IS_TRINAMIC
2488
-          say_M913(PORTVAR_SOLO);
2489
-          SERIAL_ECHOLNPAIR_P(port, "I1 Z", TMC_GET_PWMTHRS(Z, Z2));
2500
+          SERIAL_ECHOPAIR_P(port, " Z", TMC_GET_PWMTHRS(Z, Z2));
2501
+        #endif
2502
+        #if X2_IS_TRINAMIC || Y2_IS_TRINAMIC || Z2_IS_TRINAMIC
2503
+          SERIAL_EOL_P(port);
2490 2504
         #endif
2491 2505
         #if E0_IS_TRINAMIC
2492 2506
           say_M913(PORTVAR_SOLO);
2493
-          SERIAL_ECHOLNPAIR_P(port, "T0 E", TMC_GET_PWMTHRS(E, E0));
2507
+          SERIAL_ECHOLNPAIR_P(port, " T0 E", TMC_GET_PWMTHRS(E, E0));
2494 2508
         #endif
2495 2509
         #if E_STEPPERS > 1 && E1_IS_TRINAMIC
2496 2510
           say_M913(PORTVAR_SOLO);
2497
-          SERIAL_ECHOLNPAIR_P(port, "T1 E", TMC_GET_PWMTHRS(E, E1));
2511
+          SERIAL_ECHOLNPAIR_P(port, " T1 E", TMC_GET_PWMTHRS(E, E1));
2498 2512
         #endif
2499 2513
         #if E_STEPPERS > 2 && E2_IS_TRINAMIC
2500 2514
           say_M913(PORTVAR_SOLO);
2501
-          SERIAL_ECHOLNPAIR_P(port, "T2 E", TMC_GET_PWMTHRS(E, E2));
2515
+          SERIAL_ECHOLNPAIR_P(port, " T2 E", TMC_GET_PWMTHRS(E, E2));
2502 2516
         #endif
2503 2517
         #if E_STEPPERS > 3 && E3_IS_TRINAMIC
2504 2518
           say_M913(PORTVAR_SOLO);
2505
-          SERIAL_ECHOLNPAIR_P(port, "T3 E", TMC_GET_PWMTHRS(E, E3));
2519
+          SERIAL_ECHOLNPAIR_P(port, " T3 E", TMC_GET_PWMTHRS(E, E3));
2506 2520
         #endif
2507 2521
         #if E_STEPPERS > 4 && E4_IS_TRINAMIC
2508 2522
           say_M913(PORTVAR_SOLO);
2509
-          SERIAL_ECHOLNPAIR_P(port, "T4 E", TMC_GET_PWMTHRS(E, E4));
2523
+          SERIAL_ECHOLNPAIR_P(port, " T4 E", TMC_GET_PWMTHRS(E, E4));
2510 2524
         #endif
2511 2525
         SERIAL_EOL_P(port);
2512 2526
       #endif // HYBRID_THRESHOLD
@@ -2520,38 +2534,42 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2520 2534
           SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:");
2521 2535
         }
2522 2536
         CONFIG_ECHO_START;
2523
-        #ifdef X_HOMING_SENSITIVITY
2524
-          #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
2525
-            say_M914(PORTVAR_SOLO);
2526
-            SERIAL_ECHOLNPAIR_P(port, "X", stepperX.sgt());
2527
-          #endif
2528
-          #if ENABLED(X2_IS_TMC2130)
2529
-            say_M914(PORTVAR_SOLO);
2530
-            SERIAL_ECHOLNPAIR_P(port, "I1 X", stepperX2.sgt());
2537
+        #define HAS_X_SENSORLESS (defined(X_HOMING_SENSITIVITY) && (ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)))
2538
+        #define HAS_Y_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && (ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)))
2539
+        #define HAS_Z_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && (ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)))
2540
+        #if HAS_X_SENSORLESS || HAS_Y_SENSORLESS || HAS_Z_SENSORLESS
2541
+          say_M914(PORTVAR_SOLO);
2542
+          #if HAS_X_SENSORLESS
2543
+            SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt());
2531 2544
           #endif
2532
-        #endif
2533
-        #ifdef Y_HOMING_SENSITIVITY
2534
-          #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
2535
-            say_M914(PORTVAR_SOLO);
2536
-            SERIAL_ECHOLNPAIR_P(port, "Y", stepperY.sgt());
2545
+          #if HAS_Y_SENSORLESS
2546
+            SERIAL_ECHOPAIR_P(port, " Y", stepperY.sgt());
2537 2547
           #endif
2538
-          #if ENABLED(Y2_IS_TMC2130)
2539
-            say_M914(PORTVAR_SOLO);
2540
-            SERIAL_ECHOLNPAIR_P(port, "I1 Y", stepperY2.sgt());
2548
+          #if HAS_Z_SENSORLESS
2549
+            SERIAL_ECHOPAIR_P(port, " Z", stepperZ.sgt());
2541 2550
           #endif
2551
+          SERIAL_EOL_P(port);
2542 2552
         #endif
2543
-        #ifdef Z_HOMING_SENSITIVITY
2544
-          #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
2545
-            say_M914(PORTVAR_SOLO);
2546
-            SERIAL_ECHOLNPAIR_P(port, "Z", stepperZ.sgt());
2553
+
2554
+        #define HAS_X2_SENSORLESS (defined(X_HOMING_SENSITIVITY) && ENABLED(X2_IS_TMC2130))
2555
+        #define HAS_Y2_SENSORLESS (defined(Y_HOMING_SENSITIVITY) && ENABLED(Y2_IS_TMC2130))
2556
+        #define HAS_Z2_SENSORLESS (defined(Z_HOMING_SENSITIVITY) && ENABLED(Z2_IS_TMC2130))
2557
+        #if HAS_X2_SENSORLESS || HAS_Y2_SENSORLESS || HAS_Z2_SENSORLESS
2558
+          say_M914(PORTVAR_SOLO);
2559
+          SERIAL_ECHOPGM_P(port, " I1");
2560
+          #if HAS_X2_SENSORLESS
2561
+            SERIAL_ECHOPAIR_P(port, " X", stepperX2.sgt());
2547 2562
           #endif
2548
-          #if ENABLED(Z2_IS_TMC2130)
2549
-            say_M914(PORTVAR_SOLO);
2550
-            SERIAL_ECHOLNPAIR_P(port, "I1 Z", stepperZ2.sgt());
2563
+          #if HAS_Y2_SENSORLESS
2564
+            SERIAL_ECHOPAIR_P(port, " Y", stepperY2.sgt());
2551 2565
           #endif
2566
+          #if HAS_Z2_SENSORLESS
2567
+            SERIAL_ECHOPAIR_P(port, " Z", stepperZ2.sgt());
2568
+          #endif
2569
+          SERIAL_EOL_P(port);
2552 2570
         #endif
2553
-        SERIAL_EOL_P(port);
2554
-      #endif
2571
+
2572
+      #endif // SENSORLESS_HOMING
2555 2573
 
2556 2574
     #endif // HAS_TRINAMIC
2557 2575
 

Loading…
Cancel
Save