Browse Source

Expand on serial debugging (#13577)

Scott Lahteine 6 years ago
parent
commit
cf12fc8366
No account linked to committer's email address

+ 2
- 0
Marlin/src/core/debug_out.h View File

@@ -47,6 +47,7 @@
47 47
 #undef DEBUG_DELAY
48 48
 
49 49
 #if DEBUG_OUT
50
+  #define DEBUG_PRINT_P(P)        serialprintPGM(P)
50 51
   #define DEBUG_ECHO_START        SERIAL_ECHO_START
51 52
   #define DEBUG_ERROR_START       SERIAL_ERROR_START
52 53
   #define DEBUG_CHAR              SERIAL_CHAR
@@ -66,6 +67,7 @@
66 67
   #define DEBUG_XYZ               SERIAL_XYZ
67 68
   #define DEBUG_DELAY(ms)         serial_delay(ms)
68 69
 #else
70
+  #define DEBUG_PRINT_P(P)        NOOP
69 71
   #define DEBUG_ECHO_START()      NOOP
70 72
   #define DEBUG_ERROR_START()     NOOP
71 73
   #define DEBUG_CHAR(...)         NOOP

+ 6
- 0
Marlin/src/core/serial.cpp View File

@@ -50,8 +50,14 @@ void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P)
50 50
 
51 51
 void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
52 52
 
53
+void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=NULL*/) {
54
+  if (pre) serialprintPGM(pre);
55
+  serialprintPGM(onoff ? on : off);
56
+  if (post) serialprintPGM(post);
57
+}
53 58
 void serialprint_onoff(const bool onoff) { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
54 59
 void serialprintln_onoff(const bool onoff) { serialprint_onoff(onoff); SERIAL_EOL(); }
60
+void serialprint_truefalse(const bool tf) { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
55 61
 
56 62
 void print_bin(const uint16_t val) {
57 63
   uint16_t mask = 0x8000;

+ 2
- 0
Marlin/src/core/serial.h View File

@@ -174,8 +174,10 @@ inline void serial_echopair_PGM(PGM_P const s_P, void *v)   { serial_echopair_PG
174 174
 void serialprintPGM(PGM_P str);
175 175
 void serial_echo_start();
176 176
 void serial_error_start();
177
+void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post=NULL);
177 178
 void serialprint_onoff(const bool onoff);
178 179
 void serialprintln_onoff(const bool onoff);
180
+void serialprint_truefalse(const bool tf);
179 181
 void serial_spaces(uint8_t count);
180 182
 
181 183
 void print_bin(const uint16_t val);

+ 2
- 4
Marlin/src/feature/I2CPositionEncoder.cpp View File

@@ -227,13 +227,11 @@ bool I2CPositionEncoder::passes_test(const bool report) {
227 227
   if (report) {
228 228
     if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
229 229
     SERIAL_ECHO(axis_codes[encoderAxis]);
230
-    SERIAL_ECHOPGM(" axis ");
231
-    serialprintPGM(H == I2CPE_MAG_SIG_BAD ? PSTR("magnetic strip ") : PSTR("encoder "));
230
+    serial_ternary(H == I2CPE_MAG_SIG_BAD, PSTR(" axis "), PSTR("magnetic strip "), PSTR("encoder "));
232 231
     switch (H) {
233 232
       case I2CPE_MAG_SIG_GOOD:
234 233
       case I2CPE_MAG_SIG_MID:
235
-        SERIAL_ECHOLNPGM("passes test; field strength ");
236
-        serialprintPGM(H == I2CPE_MAG_SIG_GOOD ? PSTR("good.\n") : PSTR("fair.\n"));
234
+        serial_ternary(H == I2CPE_MAG_SIG_GOOD, PSTR("passes test; field strength "), PSTR("good"), PSTR("fair"), PSTR(".\n"));
237 235
         break;
238 236
       default:
239 237
         SERIAL_ECHOLNPGM("not detected!");

+ 2
- 3
Marlin/src/feature/I2CPositionEncoder.h View File

@@ -275,9 +275,8 @@ class I2CPositionEncodersMgr {
275 275
     static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
276 276
       CHECK_IDX();
277 277
       encoders[idx].set_ec_enabled(enabled);
278
-      SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis], " axis is ");
279
-      serialprintPGM(encoders[idx].get_ec_enabled() ? PSTR("en") : PSTR("dis"));
280
-      SERIAL_ECHOLNPGM("abled.");
278
+      SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]);
279
+      serial_ternary(encoders[idx].get_ec_enabled(), PSTR(" axis is "), PSTR("en"), PSTR("dis"), PSTR("abled.\n"));
281 280
     }
282 281
 
283 282
     static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {

+ 0
- 4
Marlin/src/feature/bedlevel/bedlevel.cpp View File

@@ -42,10 +42,6 @@
42 42
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
43 43
 #include "../../core/debug_out.h"
44 44
 
45
-#if ENABLED(G26_MESH_VALIDATION)
46
-  bool g26_debug_flag; // = false
47
-#endif
48
-
49 45
 bool leveling_is_valid() {
50 46
   return
51 47
     #if ENABLED(MESH_BED_LEVELING)

+ 0
- 6
Marlin/src/feature/bedlevel/bedlevel.h View File

@@ -28,12 +28,6 @@ typedef struct {
28 28
   float distance; // When populated, the distance from the search location
29 29
 } mesh_index_pair;
30 30
 
31
-#if ENABLED(G26_MESH_VALIDATION)
32
-  extern bool g26_debug_flag;
33
-#else
34
-  constexpr bool g26_debug_flag = false;
35
-#endif
36
-
37 31
 #if ENABLED(PROBE_MANUALLY)
38 32
   extern bool g29_in_progress;
39 33
 #else

+ 1
- 45
Marlin/src/feature/bedlevel/ubl/ubl.cpp View File

@@ -58,54 +58,10 @@
58 58
 
59 59
   void unified_bed_leveling::report_state() {
60 60
     echo_name();
61
-    SERIAL_ECHOPGM(" System v" UBL_VERSION " ");
62
-    if (!planner.leveling_active) SERIAL_ECHOPGM("in");
63
-    SERIAL_ECHOLNPGM("active.");
61
+    serial_ternary(planner.leveling_active, PSTR(" System v" UBL_VERSION " "), PSTR(""), PSTR("in"), PSTR("active\n"));
64 62
     serial_delay(50);
65 63
   }
66 64
 
67
-  #if ENABLED(UBL_DEVEL_DEBUGGING)
68
-
69
-    static void debug_echo_axis(const AxisEnum axis) {
70
-      if (current_position[axis] == destination[axis])
71
-        SERIAL_ECHOPGM("-------------");
72
-      else
73
-        SERIAL_ECHO_F(destination[X_AXIS], 6);
74
-    }
75
-
76
-    void debug_current_and_destination(PGM_P title) {
77
-
78
-      // if the title message starts with a '!' it is so important, we are going to
79
-      // ignore the status of the g26_debug_flag
80
-      if (*title != '!' && !g26_debug_flag) return;
81
-
82
-      const float de = destination[E_AXIS] - current_position[E_AXIS];
83
-
84
-      if (de == 0.0) return; // Printing moves only
85
-
86
-      const float dx = destination[X_AXIS] - current_position[X_AXIS],
87
-                  dy = destination[Y_AXIS] - current_position[Y_AXIS],
88
-                  xy_dist = HYPOT(dx, dy);
89
-
90
-      if (xy_dist == 0.0) return;
91
-
92
-      const float fpmm = de / xy_dist;
93
-      SERIAL_ECHOPAIR_F("   fpmm=", fpmm, 6);
94
-      SERIAL_ECHOPAIR_F("    current=( ", current_position[X_AXIS], 6);
95
-      SERIAL_ECHOPAIR_F(", ", current_position[Y_AXIS], 6);
96
-      SERIAL_ECHOPAIR_F(", ", current_position[Z_AXIS], 6);
97
-      SERIAL_ECHOPAIR_F(", ", current_position[E_AXIS], 6);
98
-      SERIAL_ECHOPGM(" )   destination=( "); debug_echo_axis(X_AXIS);
99
-      SERIAL_ECHOPGM(", "); debug_echo_axis(Y_AXIS);
100
-      SERIAL_ECHOPGM(", "); debug_echo_axis(Z_AXIS);
101
-      SERIAL_ECHOPGM(", "); debug_echo_axis(E_AXIS);
102
-      SERIAL_ECHOPGM(" )   ");
103
-      serialprintPGM(title);
104
-      SERIAL_EOL();
105
-    }
106
-
107
-  #endif // UBL_DEVEL_DEBUGGING
108
-
109 65
   int8_t unified_bed_leveling::storage_slot;
110 66
 
111 67
   float unified_bed_leveling::z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];

+ 0
- 8
Marlin/src/feature/bedlevel/ubl/ubl.h View File

@@ -39,14 +39,6 @@
39 39
 #define USE_NOZZLE_AS_REFERENCE 0
40 40
 #define USE_PROBE_AS_REFERENCE 1
41 41
 
42
-// ubl_motion.cpp
43
-
44
-#if ENABLED(UBL_DEVEL_DEBUGGING)
45
-  void debug_current_and_destination(PGM_P const title);
46
-#else
47
-  FORCE_INLINE void debug_current_and_destination(PGM_P const title) { UNUSED(title); }
48
-#endif
49
-
50 42
 // ubl_G29.cpp
51 43
 
52 44
 enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP };

+ 0
- 2
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -24,8 +24,6 @@
24 24
 
25 25
 #if ENABLED(AUTO_BED_LEVELING_UBL)
26 26
 
27
-  //#define UBL_DEVEL_DEBUGGING
28
-
29 27
   #include "ubl.h"
30 28
 
31 29
   #include "../../../Marlin.h"

+ 0
- 26
Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp View File

@@ -64,17 +64,6 @@
64 64
               cell_dest_xi  = get_cell_index_x(end[X_AXIS]),
65 65
               cell_dest_yi  = get_cell_index_y(end[Y_AXIS]);
66 66
 
67
-    if (g26_debug_flag) {
68
-      SERIAL_ECHOLNPAIR(
69
-        " ubl.line_to_destination_cartesian(xe=", destination[X_AXIS],
70
-        ", ye=", destination[Y_AXIS],
71
-        ", ze=", destination[Z_AXIS],
72
-        ", ee=", destination[E_AXIS],
73
-        ")"
74
-      );
75
-      debug_current_and_destination(PSTR("Start of ubl.line_to_destination_cartesian()"));
76
-    }
77
-
78 67
     // A move within the same cell needs no splitting
79 68
     if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) {
80 69
 
@@ -93,9 +82,6 @@
93 82
         planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
94 83
         set_current_from_destination();
95 84
 
96
-        if (g26_debug_flag)
97
-          debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination_cartesian()"));
98
-
99 85
         return;
100 86
       }
101 87
 
@@ -119,9 +105,6 @@
119 105
       // Replace NAN corrections with 0.0 to prevent NAN propagation.
120 106
       planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder);
121 107
 
122
-      if (g26_debug_flag)
123
-        debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination_cartesian()"));
124
-
125 108
       set_current_from_destination();
126 109
       return;
127 110
     }
@@ -215,9 +198,6 @@
215 198
         } //else printf("FIRST MOVE PRUNED  ");
216 199
       }
217 200
 
218
-      if (g26_debug_flag)
219
-        debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination_cartesian()"));
220
-
221 201
       // At the final destination? Usually not, but when on a Y Mesh Line it's completed.
222 202
       if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
223 203
         goto FINAL_MOVE;
@@ -267,9 +247,6 @@
267 247
         } //else printf("FIRST MOVE PRUNED  ");
268 248
       }
269 249
 
270
-      if (g26_debug_flag)
271
-        debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination_cartesian()"));
272
-
273 250
       if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
274 251
         goto FINAL_MOVE;
275 252
 
@@ -353,9 +330,6 @@
353 330
       if (xi_cnt < 0 || yi_cnt < 0) break; // Too far! Exit the loop and go to FINAL_MOVE
354 331
     }
355 332
 
356
-    if (g26_debug_flag)
357
-      debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination_cartesian()"));
358
-
359 333
     if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
360 334
       goto FINAL_MOVE;
361 335
 

+ 37
- 42
Marlin/src/feature/power_loss_recovery.cpp View File

@@ -50,6 +50,9 @@ job_recovery_info_t PrintJobRecovery::info;
50 50
   #include "fwretract.h"
51 51
 #endif
52 52
 
53
+#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
54
+#include "../core/debug_out.h"
55
+
53 56
 PrintJobRecovery recovery;
54 57
 
55 58
 /**
@@ -110,9 +113,7 @@ void PrintJobRecovery::load() {
110 113
     (void)file.read(&info, sizeof(info));
111 114
     close();
112 115
   }
113
-  #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
114
-    debug(PSTR("Load"));
115
-  #endif
116
+  debug(PSTR("Load"));
116 117
 }
117 118
 
118 119
 /**
@@ -216,20 +217,14 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
216 217
  */
217 218
 void PrintJobRecovery::write() {
218 219
 
219
-  #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
220
-    debug(PSTR("Write"));
221
-  #endif
220
+  debug(PSTR("Write"));
222 221
 
223 222
   open(false);
224 223
   file.seekSet(0);
225 224
   const int16_t ret = file.write(&info, sizeof(info));
226 225
   close();
227 226
 
228
-  #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
229
-    if (ret == -1) SERIAL_ECHOLNPGM("Power-loss file write failed.");
230
-  #else
231
-    UNUSED(ret);
232
-  #endif
227
+  if (ret == -1) DEBUG_ECHOLNPGM("Power-loss file write failed.");
233 228
 }
234 229
 
235 230
 /**
@@ -367,65 +362,65 @@ void PrintJobRecovery::resume() {
367 362
 #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
368 363
 
369 364
   void PrintJobRecovery::debug(PGM_P const prefix) {
370
-    serialprintPGM(prefix);
371
-    SERIAL_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
365
+    DEBUG_PRINT_P(prefix);
366
+    DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", int(info.valid_head), " valid_foot:", int(info.valid_foot));
372 367
     if (info.valid_head) {
373 368
       if (info.valid_head == info.valid_foot) {
374
-        SERIAL_ECHOPGM("current_position: ");
369
+        DEBUG_ECHOPGM("current_position: ");
375 370
         LOOP_XYZE(i) {
376
-          if (i) SERIAL_CHAR(',');
377
-          SERIAL_ECHO(info.current_position[i]);
371
+          if (i) DEBUG_CHAR(',');
372
+          DEBUG_ECHO(info.current_position[i]);
378 373
         }
379
-        SERIAL_EOL();
380
-        SERIAL_ECHOLNPAIR("feedrate: ", info.feedrate);
374
+        DEBUG_EOL();
375
+        DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate);
381 376
 
382 377
         #if HOTENDS > 1
383
-          SERIAL_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
378
+          DEBUG_ECHOLNPAIR("active_hotend: ", int(info.active_hotend));
384 379
         #endif
385 380
 
386
-        SERIAL_ECHOPGM("target_temperature: ");
381
+        DEBUG_ECHOPGM("target_temperature: ");
387 382
         HOTEND_LOOP() {
388
-          SERIAL_ECHO(info.target_temperature[e]);
389
-          if (e < HOTENDS - 1) SERIAL_CHAR(',');
383
+          DEBUG_ECHO(info.target_temperature[e]);
384
+          if (e < HOTENDS - 1) DEBUG_CHAR(',');
390 385
         }
391
-        SERIAL_EOL();
386
+        DEBUG_EOL();
392 387
 
393 388
         #if HAS_HEATED_BED
394
-          SERIAL_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
389
+          DEBUG_ECHOLNPAIR("target_temperature_bed: ", info.target_temperature_bed);
395 390
         #endif
396 391
 
397 392
         #if FAN_COUNT
398
-          SERIAL_ECHOPGM("fan_speed: ");
393
+          DEBUG_ECHOPGM("fan_speed: ");
399 394
           FANS_LOOP(i) {
400
-            SERIAL_ECHO(int(info.fan_speed[i]));
401
-            if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
395
+            DEBUG_ECHO(int(info.fan_speed[i]));
396
+            if (i < FAN_COUNT - 1) DEBUG_CHAR(',');
402 397
           }
403
-          SERIAL_EOL();
398
+          DEBUG_EOL();
404 399
         #endif
405 400
 
406 401
         #if HAS_LEVELING
407
-          SERIAL_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
402
+          DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), "\n fade: ", int(info.fade));
408 403
         #endif
409 404
         #if ENABLED(FWRETRACT)
410
-          SERIAL_ECHOPGM("retract: ");
405
+          DEBUG_ECHOPGM("retract: ");
411 406
           for (int8_t e = 0; e < EXTRUDERS; e++) {
412
-            SERIAL_ECHO(info.retract[e]);
413
-            if (e < EXTRUDERS - 1) SERIAL_CHAR(',');
407
+            DEBUG_ECHO(info.retract[e]);
408
+            if (e < EXTRUDERS - 1) DEBUG_CHAR(',');
414 409
           }
415
-          SERIAL_EOL();
416
-          SERIAL_ECHOLNPAIR("retract_hop: ", info.retract_hop);
410
+          DEBUG_EOL();
411
+          DEBUG_ECHOLNPAIR("retract_hop: ", info.retract_hop);
417 412
         #endif
418
-        SERIAL_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
419
-        SERIAL_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
420
-        for (uint8_t i = 0; i < info.commands_in_queue; i++) SERIAL_ECHOLNPAIR("> ", info.command_queue[i]);
421
-        SERIAL_ECHOLNPAIR("sd_filename: ", info.sd_filename);
422
-        SERIAL_ECHOLNPAIR("sdpos: ", info.sdpos);
423
-        SERIAL_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
413
+        DEBUG_ECHOLNPAIR("cmd_queue_index_r: ", int(info.cmd_queue_index_r));
414
+        DEBUG_ECHOLNPAIR("commands_in_queue: ", int(info.commands_in_queue));
415
+        for (uint8_t i = 0; i < info.commands_in_queue; i++) DEBUG_ECHOLNPAIR("> ", info.command_queue[i]);
416
+        DEBUG_ECHOLNPAIR("sd_filename: ", info.sd_filename);
417
+        DEBUG_ECHOLNPAIR("sdpos: ", info.sdpos);
418
+        DEBUG_ECHOLNPAIR("print_job_elapsed: ", info.print_job_elapsed);
424 419
       }
425 420
       else
426
-        SERIAL_ECHOLNPGM("INVALID DATA");
421
+        DEBUG_ECHOLNPGM("INVALID DATA");
427 422
     }
428
-    SERIAL_ECHOLNPGM("---");
423
+    DEBUG_ECHOLNPGM("---");
429 424
   }
430 425
 
431 426
 #endif // DEBUG_POWER_LOSS_RECOVERY

+ 5
- 3
Marlin/src/feature/power_loss_recovery.h View File

@@ -125,9 +125,11 @@ class PrintJobRecovery {
125 125
 
126 126
   static inline bool valid() { return info.valid_head && info.valid_head == info.valid_foot; }
127 127
 
128
-    #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
129
-      static void debug(PGM_P const prefix);
130
-    #endif
128
+  #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
129
+    static void debug(PGM_P const prefix);
130
+  #else
131
+    static inline void debug(PGM_P const prefix) {}
132
+  #endif
131 133
 
132 134
   private:
133 135
     static void write();

+ 9
- 9
Marlin/src/feature/tmc_util.cpp View File

@@ -474,7 +474,7 @@
474 474
       switch (i) {
475 475
         case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
476 476
         case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
477
-        case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break;
477
+        case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
478 478
         default: break;
479 479
       }
480 480
     }
@@ -497,7 +497,7 @@
497 497
       switch (i) {
498 498
         case TMC_PWM_SCALE: SERIAL_PRINT(st.PWM_SCALE(), DEC); break;
499 499
         case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
500
-        case TMC_STEALTHCHOP: serialprintPGM(st.en_pwm_mode() ? PSTR("true") : PSTR("false")); break;
500
+        case TMC_STEALTHCHOP: serialprint_truefalse(st.en_pwm_mode()); break;
501 501
         case TMC_GLOBAL_SCALER:
502 502
           {
503 503
             uint16_t value = st.GLOBAL_SCALER();
@@ -514,7 +514,7 @@
514 514
     static void tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
515 515
       switch (i) {
516 516
         case TMC_PWM_SCALE: SERIAL_PRINT(st.pwm_scale_sum(), DEC); break;
517
-        case TMC_STEALTHCHOP: serialprintPGM(st.stealth() ? PSTR("true") : PSTR("false")); break;
517
+        case TMC_STEALTHCHOP: serialprint_truefalse(st.stealth()); break;
518 518
         case TMC_S2VSA: if (st.s2vsa()) SERIAL_CHAR('X'); break;
519 519
         case TMC_S2VSB: if (st.s2vsb()) SERIAL_CHAR('X'); break;
520 520
         default: break;
@@ -541,7 +541,7 @@
541 541
     SERIAL_CHAR('\t');
542 542
     switch (i) {
543 543
       case TMC_CODES: st.printLabel(); break;
544
-      case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
544
+      case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break;
545 545
       case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
546 546
       case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
547 547
       case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
@@ -578,9 +578,9 @@
578 578
             SERIAL_CHAR('-');
579 579
         }
580 580
         break;
581
-      case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
581
+      case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
582 582
       #if ENABLED(MONITOR_DRIVER_STATUS)
583
-        case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
583
+        case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
584 584
       #endif
585 585
       case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
586 586
       case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;
@@ -596,7 +596,7 @@
596 596
       SERIAL_CHAR('\t');
597 597
       switch (i) {
598 598
         case TMC_CODES: st.printLabel(); break;
599
-        case TMC_ENABLED: serialprintPGM(st.isEnabled() ? PSTR("true") : PSTR("false")); break;
599
+        case TMC_ENABLED: serialprint_truefalse(st.isEnabled()); break;
600 600
         case TMC_CURRENT: SERIAL_ECHO(st.getMilliamps()); break;
601 601
         case TMC_RMS_CURRENT: SERIAL_ECHO(st.rms_current()); break;
602 602
         case TMC_MAX_CURRENT: SERIAL_PRINT((float)st.rms_current() * 1.41, 0); break;
@@ -606,8 +606,8 @@
606 606
           break;
607 607
         case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break;
608 608
         case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break;
609
-        //case TMC_OTPW: serialprintPGM(st.otpw() ? PSTR("true") : PSTR("false")); break;
610
-        //case TMC_OTPW_TRIGGERED: serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false")); break;
609
+        //case TMC_OTPW: serialprint_truefalse(st.otpw()); break;
610
+        //case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break;
611 611
         case TMC_SGT: SERIAL_PRINT(st.sgt(), DEC); break;
612 612
         case TMC_TOFF: SERIAL_PRINT(st.toff(), DEC); break;
613 613
         case TMC_TBL: SERIAL_PRINT(st.blank_time(), DEC); break;

+ 1
- 1
Marlin/src/feature/tmc_util.h View File

@@ -227,7 +227,7 @@ void tmc_set_current(TMC &st, const int mA) {
227 227
   void tmc_report_otpw(TMC &st) {
228 228
     st.printLabel();
229 229
     SERIAL_ECHOPGM(" temperature prewarn triggered: ");
230
-    serialprintPGM(st.getOTPW() ? PSTR("true") : PSTR("false"));
230
+    serialprint_truefalse(st.getOTPW());
231 231
     SERIAL_EOL();
232 232
   }
233 233
   template<typename TMC>

+ 13
- 57
Marlin/src/gcode/bedlevel/G26.cpp View File

@@ -246,8 +246,6 @@ void move_to(const float &rx, const float &ry, const float &z, const float &e_de
246 246
   // Yes: a 'normal' movement. No: a retract() or recover()
247 247
   feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5;
248 248
 
249
-  if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
250
-
251 249
   destination[X_AXIS] = rx;
252 250
   destination[Y_AXIS] = ry;
253 251
   destination[E_AXIS] += e_delta;
@@ -327,19 +325,15 @@ inline bool look_for_lines_to_connect() {
327 325
     for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
328 326
 
329 327
       #if HAS_LCD_MENU
330
-        if (user_canceled()) return true;     // Check if the user wants to stop the Mesh Validation
328
+        if (user_canceled()) return true;
331 329
       #endif
332 330
 
333
-      if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
334
-                                   // This is already a half circle because we are at the edge of the bed.
331
+      if (i < GRID_MAX_POINTS_X) { // Can't connect to anything to the right than GRID_MAX_POINTS_X.
332
+                                   // Already a half circle at the edge of the bed.
335 333
 
336 334
         if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
337 335
           if (!is_bitmap_set(horizontal_mesh_line_flags, i, j)) {
338
-
339
-            //
340
-            // We found two circles that need a horizontal line to connect them
341
-            // Print it!
342
-            //
336
+            // Two circles need a horizontal line to connect them
343 337
             sx = _GET_MESH_X(  i  ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // right edge
344 338
             ex = _GET_MESH_X(i + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // left edge
345 339
 
@@ -347,27 +341,19 @@ inline bool look_for_lines_to_connect() {
347 341
             sy = ey = constrain(_GET_MESH_Y(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
348 342
             ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
349 343
 
350
-            if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
351
-
352
-              if (g26_debug_flag) {
353
-                SERIAL_ECHOLNPAIR(" Connecting with horizontal line (sx=", sx, ", sy=", sy, ") -> (ex=", ex, ", ey=", ey, ")");
354
-                //debug_current_and_destination(PSTR("Connecting horizontal line."));
355
-              }
344
+            if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey))
356 345
               print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
357
-            }
358
-            bitmap_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
346
+
347
+            bitmap_set(horizontal_mesh_line_flags, i, j); // Mark done, even if skipped
359 348
           }
360 349
         }
361 350
 
362
-        if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y.
363
-                                         // This is already a half circle because we are at the edge  of the bed.
351
+        if (j < GRID_MAX_POINTS_Y) {  // Can't connect to anything further back than GRID_MAX_POINTS_Y.
352
+                                      // Already a half circle at the edge of the bed.
364 353
 
365 354
           if (is_bitmap_set(circle_flags, i, j) && is_bitmap_set(circle_flags, i, j + 1)) { // check if we can do a line straight down
366 355
             if (!is_bitmap_set( vertical_mesh_line_flags, i, j)) {
367
-              //
368
-              // We found two circles that need a vertical line to connect them
369
-              // Print it!
370
-              //
356
+              // Two circles that need a vertical line to connect them
371 357
               sy = _GET_MESH_Y(  j  ) + (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // top edge
372 358
               ey = _GET_MESH_Y(j + 1) - (INTERSECTION_CIRCLE_RADIUS - (CROSSHAIRS_SIZE)); // bottom edge
373 359
 
@@ -375,23 +361,10 @@ inline bool look_for_lines_to_connect() {
375 361
               sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
376 362
               ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
377 363
 
378
-              if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey)) {
379
-
380
-                if (g26_debug_flag) {
381
-                  SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
382
-                  SERIAL_ECHOPAIR(", sy=", sy);
383
-                  SERIAL_ECHOPAIR(") -> (ex=", ex);
384
-                  SERIAL_ECHOPAIR(", ey=", ey);
385
-                  SERIAL_CHAR(')');
386
-                  SERIAL_EOL();
387
-
388
-                  #if ENABLED(AUTO_BED_LEVELING_UBL)
389
-                    debug_current_and_destination(PSTR("Connecting vertical line."));
390
-                  #endif
391
-                }
364
+              if (position_is_reachable(sx, sy) && position_is_reachable(ex, ey))
392 365
                 print_line_from_here_to_there(sx, sy, g26_layer_height, ex, ey, g26_layer_height);
393
-              }
394
-              bitmap_set(vertical_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if skipped
366
+
367
+              bitmap_set(vertical_mesh_line_flags, i, j); // Mark done, even if skipped
395 368
             }
396 369
           }
397 370
         }
@@ -725,8 +698,6 @@ void GcodeSuite::G26() {
725 698
     ui.capture();
726 699
   #endif
727 700
 
728
-  //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
729
-
730 701
   #if DISABLED(ARC_SUPPORT)
731 702
 
732 703
     /**
@@ -819,18 +790,6 @@ void GcodeSuite::G26() {
819 790
         const float save_feedrate = feedrate_mm_s;
820 791
         feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0;
821 792
 
822
-        if (g26_debug_flag) {
823
-          SERIAL_ECHOPAIR(" plan_arc(ex=", endpoint[X_AXIS]);
824
-          SERIAL_ECHOPAIR(", ey=", endpoint[Y_AXIS]);
825
-          SERIAL_ECHOPAIR(", ez=", endpoint[Z_AXIS]);
826
-          SERIAL_ECHOPAIR(", len=", arc_length);
827
-          SERIAL_ECHOPAIR(") -> (ex=", current_position[X_AXIS]);
828
-          SERIAL_ECHOPAIR(", ey=", current_position[Y_AXIS]);
829
-          SERIAL_ECHOPAIR(", ez=", current_position[Z_AXIS]);
830
-          SERIAL_CHAR(')');
831
-          SERIAL_EOL();
832
-        }
833
-
834 793
         plan_arc(endpoint, arc_offset, false);  // Draw a counter-clockwise arc
835 794
         feedrate_mm_s = save_feedrate;
836 795
         set_destination_from_current();
@@ -898,16 +857,13 @@ void GcodeSuite::G26() {
898 857
   retract_filament(destination);
899 858
   destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
900 859
 
901
-  //debug_current_and_destination(PSTR("ready to do Z-Raise."));
902 860
   move_to(destination, 0); // Raise the nozzle
903
-  //debug_current_and_destination(PSTR("done doing Z-Raise."));
904 861
 
905 862
   destination[X_AXIS] = g26_x_pos;                            // Move back to the starting position
906 863
   destination[Y_AXIS] = g26_y_pos;
907 864
   //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;         // Keep the nozzle where it is
908 865
 
909 866
   move_to(destination, 0);                                    // Move back to the starting position
910
-  //debug_current_and_destination(PSTR("done doing X/Y move."));
911 867
 
912 868
   #if DISABLED(NO_VOLUMETRICS)
913 869
     parser.volumetric_enabled = volumetric_was_enabled;

+ 0
- 40
Marlin/src/gcode/bedlevel/ubl/M49.cpp View File

@@ -1,40 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-/**
24
- * M49.cpp - Toggle the G26 debug flag
25
- */
26
-
27
-#include "../../../inc/MarlinConfig.h"
28
-
29
-#if ENABLED(G26_MESH_VALIDATION)
30
-
31
-#include "../../gcode.h"
32
-#include "../../../feature/bedlevel/bedlevel.h"
33
-
34
-void GcodeSuite::M49() {
35
-  g26_debug_flag ^= true;
36
-  SERIAL_ECHOPGM("G26 Debug: ");
37
-  serialprintPGM(g26_debug_flag ? PSTR("On\n") : PSTR("Off\n"));
38
-}
39
-
40
-#endif // G26_MESH_VALIDATION

+ 13
- 13
Marlin/src/gcode/feature/powerloss/M1000.cpp View File

@@ -29,17 +29,20 @@
29 29
 #include "../../../module/motion.h"
30 30
 #include "../../../lcd/ultralcd.h"
31 31
 
32
-void menu_job_recovery();
32
+#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
33
+#include "../../../core/debug_out.h"
33 34
 
34
-#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
35
+void menu_job_recovery();
35 36
 
36
-  inline void plr_error(PGM_P const prefix) {
37
-    SERIAL_ECHO_START();
37
+inline void plr_error(PGM_P const prefix) {
38
+  #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
39
+    DEBUG_ECHO_START();
38 40
     serialprintPGM(prefix);
39
-    SERIAL_ECHOLNPGM(" Power-Loss Recovery Data");
40
-  }
41
-
42
-#endif
41
+    DEBUG_ECHOLNPGM(" Power-Loss Recovery Data");
42
+  #else
43
+    UNUSED(prefix);
44
+  #endif
45
+}
43 46
 
44 47
 /**
45 48
  * M1000: Resume from power-loss (undocumented)
@@ -54,11 +57,8 @@ void GcodeSuite::M1000() {
54 57
     else
55 58
       recovery.resume();
56 59
   }
57
-  else {
58
-    #if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
59
-      plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
60
-    #endif
61
-  }
60
+  else
61
+    plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
62 62
 
63 63
 }
64 64
 

+ 0
- 4
Marlin/src/gcode/gcode.cpp View File

@@ -348,10 +348,6 @@ void GcodeSuite::process_parsed_command(
348 348
         case 48: M48(); break;                                    // M48: Z probe repeatability test
349 349
       #endif
350 350
 
351
-      #if ENABLED(G26_MESH_VALIDATION)
352
-        case 49: M49(); break;                                    // M49: Turn on or off G26 debug flag for verbose output
353
-      #endif
354
-
355 351
       #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
356 352
         case 73: M73(); break;                                    // M73: Set progress percentage (for display on LCD)
357 353
       #endif

+ 0
- 4
Marlin/src/gcode/gcode.h View File

@@ -495,10 +495,6 @@ private:
495 495
     static void M48();
496 496
   #endif
497 497
 
498
-  #if ENABLED(G26_MESH_VALIDATION)
499
-    static void M49();
500
-  #endif
501
-
502 498
   #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
503 499
     static void M73();
504 500
   #endif

Loading…
Cancel
Save