Browse Source

Reduce storage requirements for strings, make some PGM

Scott Lahteine 8 years ago
parent
commit
bd491818d6

+ 12
- 12
Marlin/M100_Free_Mem_Chk.cpp View File

@@ -86,7 +86,7 @@ void gcode_M100() {
86 86
     sp = top_of_stack();
87 87
     SERIAL_ECHOPGM("\nStack Pointer : ");
88 88
     prt_hex_word((unsigned int) sp);
89
-    SERIAL_ECHOPGM("\n");
89
+    SERIAL_EOL;
90 90
     sp = (unsigned char*)((unsigned long) sp | 0x000f);
91 91
     n = sp - ptr;
92 92
     //
@@ -94,25 +94,25 @@ void gcode_M100() {
94 94
     //
95 95
     while (ptr < sp) {
96 96
       prt_hex_word((unsigned int) ptr); // Print the address
97
-      SERIAL_ECHOPGM(":");
97
+      SERIAL_CHAR(':');
98 98
       for (i = 0; i < 16; i++) {      // and 16 data bytes
99 99
         prt_hex_byte(*(ptr + i));
100
-        SERIAL_ECHOPGM(" ");
100
+        SERIAL_CHAR(' ');
101 101
         delay(2);
102 102
       }
103
-      SERIAL_ECHO("|");         // now show where non 0xE5's are
103
+      SERIAL_CHAR('|');         // now show where non 0xE5's are
104 104
       for (i = 0; i < 16; i++) {
105 105
         delay(2);
106 106
         if (*(ptr + i) == 0xe5)
107
-          SERIAL_ECHOPGM(" ");
107
+          SERIAL_CHAR(' ');
108 108
         else
109
-          SERIAL_ECHOPGM("?");
109
+          SERIAL_CHAR('?');
110 110
       }
111
-      SERIAL_ECHO("\n");
111
+      SERIAL_EOL;
112 112
       ptr += 16;
113 113
       delay(2);
114 114
     }
115
-    SERIAL_ECHOLNPGM("Done.\n");
115
+    SERIAL_ECHOLNPGM("Done.");
116 116
     return;
117 117
   }
118 118
 #endif
@@ -137,7 +137,7 @@ void gcode_M100() {
137 137
           SERIAL_ECHOPAIR("Found ", j);
138 138
           SERIAL_ECHOPGM(" bytes free at 0x");
139 139
           prt_hex_word((int) ptr + i);
140
-          SERIAL_ECHOPGM("\n");
140
+          SERIAL_EOL;
141 141
           i += j;
142 142
           block_cnt++;
143 143
         }
@@ -150,8 +150,8 @@ void gcode_M100() {
150 150
       }
151 151
     }
152 152
     if (block_cnt > 1)
153
-      SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.\n");
154
-    SERIAL_ECHO("\nDone.\n");
153
+      SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
154
+    SERIAL_ECHOLNPGM("\nDone.");
155 155
     return;
156 156
   }
157 157
   //
@@ -173,7 +173,7 @@ void gcode_M100() {
173 173
     j = n / (x + 1);
174 174
     for (i = 1; i <= x; i++) {
175 175
       *(ptr + (i * j)) = i;
176
-      SERIAL_ECHO("\nCorrupting address: 0x");
176
+      SERIAL_ECHOPGM("\nCorrupting address: 0x");
177 177
       prt_hex_word((unsigned int)(ptr + (i * j)));
178 178
     }
179 179
     SERIAL_ECHOLNPGM("\n");

+ 2
- 1
Marlin/Marlin.h View File

@@ -84,8 +84,9 @@ typedef unsigned long millis_t;
84 84
 #define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y)
85 85
 #define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x))
86 86
 #define SERIAL_PROTOCOLLN(x) do{ MYSERIAL.print(x); SERIAL_EOL; }while(0)
87
-#define SERIAL_PROTOCOLLNPGM(x) do{ serialprintPGM(PSTR(x)); SERIAL_EOL; }while(0)
87
+#define SERIAL_PROTOCOLLNPGM(x) do{ serialprintPGM(PSTR(x "\n")); }while(0)
88 88
 
89
+#define SERIAL_PROTOCOLPAIR(name, value) SERIAL_ECHOPAIR(name, value)
89 90
 
90 91
 extern const char errormagic[] PROGMEM;
91 92
 extern const char echomagic[] PROGMEM;

+ 61
- 68
Marlin/Marlin_main.cpp View File

@@ -2107,7 +2107,7 @@ static void clean_up_after_endstop_or_probe_move() {
2107 2107
     do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
2108 2108
 
2109 2109
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2110
-      if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> deploy_z_probe");
2110
+      if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> ");
2111 2111
     #endif
2112 2112
     deploy_z_probe();
2113 2113
 
@@ -2543,7 +2543,7 @@ void unknown_command_error() {
2543 2543
   SERIAL_ECHO_START;
2544 2544
   SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);
2545 2545
   SERIAL_ECHO(current_command);
2546
-  SERIAL_ECHOPGM("\"\n");
2546
+  SERIAL_ECHOLNPGM("\"");
2547 2547
 }
2548 2548
 
2549 2549
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
@@ -3187,19 +3187,11 @@ inline void gcode_G28() {
3187 3187
     switch (state) {
3188 3188
       case MeshReport:
3189 3189
         if (mbl.has_mesh()) {
3190
-          SERIAL_PROTOCOLPGM("State: ");
3191
-          if (mbl.active())
3192
-            SERIAL_PROTOCOLPGM("On");
3193
-          else
3194
-            SERIAL_PROTOCOLPGM("Off");
3195
-          SERIAL_PROTOCOLPGM("\nNum X,Y: ");
3196
-          SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
3197
-          SERIAL_PROTOCOLCHAR(',');
3198
-          SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
3199
-          SERIAL_PROTOCOLPGM("\nZ search height: ");
3200
-          SERIAL_PROTOCOL(MESH_HOME_SEARCH_Z);
3201
-          SERIAL_PROTOCOLPGM("\nZ offset: ");
3202
-          SERIAL_PROTOCOL_F(mbl.z_offset, 5);
3190
+          SERIAL_PROTOCOLPAIR("State: ", mbl.active() ? "On" : "Off");
3191
+          SERIAL_PROTOCOLPAIR("\nNum X,Y: ", MESH_NUM_X_POINTS);
3192
+          SERIAL_PROTOCOLCHAR(','); SERIAL_PROTOCOL(MESH_NUM_Y_POINTS);
3193
+          SERIAL_PROTOCOLPAIR("\nZ search height: ", MESH_HOME_SEARCH_Z);
3194
+          SERIAL_PROTOCOLPGM("\nZ offset: "); SERIAL_PROTOCOL_F(mbl.z_offset, 5);
3203 3195
           SERIAL_PROTOCOLLNPGM("\nMeasured points:");
3204 3196
           for (py = 0; py < MESH_NUM_Y_POINTS; py++) {
3205 3197
             for (px = 0; px < MESH_NUM_X_POINTS; px++) {
@@ -3268,30 +3260,30 @@ inline void gcode_G28() {
3268 3260
         if (code_seen('X')) {
3269 3261
           px = code_value_int() - 1;
3270 3262
           if (px < 0 || px >= MESH_NUM_X_POINTS) {
3271
-            SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n");
3263
+            SERIAL_PROTOCOLLNPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").");
3272 3264
             return;
3273 3265
           }
3274 3266
         }
3275 3267
         else {
3276
-          SERIAL_PROTOCOLPGM("X not entered.\n");
3268
+          SERIAL_PROTOCOLLNPGM("X not entered.");
3277 3269
           return;
3278 3270
         }
3279 3271
         if (code_seen('Y')) {
3280 3272
           py = code_value_int() - 1;
3281 3273
           if (py < 0 || py >= MESH_NUM_Y_POINTS) {
3282
-            SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n");
3274
+            SERIAL_PROTOCOLLNPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").");
3283 3275
             return;
3284 3276
           }
3285 3277
         }
3286 3278
         else {
3287
-          SERIAL_PROTOCOLPGM("Y not entered.\n");
3279
+          SERIAL_PROTOCOLLNPGM("Y not entered.");
3288 3280
           return;
3289 3281
         }
3290 3282
         if (code_seen('Z')) {
3291 3283
           z = code_value_axis_units(Z_AXIS);
3292 3284
         }
3293 3285
         else {
3294
-          SERIAL_PROTOCOLPGM("Z not entered.\n");
3286
+          SERIAL_PROTOCOLLNPGM("Z not entered.");
3295 3287
           return;
3296 3288
         }
3297 3289
         mbl.z_values[py][px] = z;
@@ -3302,7 +3294,7 @@ inline void gcode_G28() {
3302 3294
           z = code_value_axis_units(Z_AXIS);
3303 3295
         }
3304 3296
         else {
3305
-          SERIAL_PROTOCOLPGM("Z not entered.\n");
3297
+          SERIAL_PROTOCOLLNPGM("Z not entered.");
3306 3298
           return;
3307 3299
         }
3308 3300
         mbl.z_offset = z;
@@ -3397,8 +3389,8 @@ inline void gcode_G28() {
3397 3389
       #endif
3398 3390
 
3399 3391
       if (verbose_level > 0) {
3400
-        SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling\n");
3401
-        if (dryrun) SERIAL_ECHOLNPGM("Running in DRY-RUN mode");
3392
+        SERIAL_PROTOCOLLNPGM("G29 Auto Bed Leveling");
3393
+        if (dryrun) SERIAL_PROTOCOLLNPGM("Running in DRY-RUN mode");
3402 3394
       }
3403 3395
 
3404 3396
       int auto_bed_leveling_grid_points = AUTO_BED_LEVELING_GRID_POINTS;
@@ -3406,7 +3398,7 @@ inline void gcode_G28() {
3406 3398
       #if DISABLED(DELTA)
3407 3399
         if (code_seen('P')) auto_bed_leveling_grid_points = code_value_int();
3408 3400
         if (auto_bed_leveling_grid_points < 2) {
3409
-          SERIAL_PROTOCOLPGM("?Number of probed (P)oints is implausible (2 minimum).\n");
3401
+          SERIAL_PROTOCOLLNPGM("?Number of probed (P)oints is implausible (2 minimum).");
3410 3402
           return;
3411 3403
         }
3412 3404
       #endif
@@ -3637,17 +3629,17 @@ inline void gcode_G28() {
3637 3629
         // Show the Topography map if enabled
3638 3630
         if (do_topography_map) {
3639 3631
 
3640
-          SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
3641
-          SERIAL_PROTOCOLPGM("   +--- BACK --+\n");
3642
-          SERIAL_PROTOCOLPGM("   |           |\n");
3643
-          SERIAL_PROTOCOLPGM(" L |    (+)    | R\n");
3644
-          SERIAL_PROTOCOLPGM(" E |           | I\n");
3645
-          SERIAL_PROTOCOLPGM(" F | (-) N (+) | G\n");
3646
-          SERIAL_PROTOCOLPGM(" T |           | H\n");
3647
-          SERIAL_PROTOCOLPGM("   |    (-)    | T\n");
3648
-          SERIAL_PROTOCOLPGM("   |           |\n");
3649
-          SERIAL_PROTOCOLPGM("   O-- FRONT --+\n");
3650
-          SERIAL_PROTOCOLPGM(" (0,0)\n");
3632
+          SERIAL_PROTOCOLLNPGM("\nBed Height Topography:\n"
3633
+                                 "   +--- BACK --+\n"
3634
+                                 "   |           |\n"
3635
+                                 " L |    (+)    | R\n"
3636
+                                 " E |           | I\n"
3637
+                                 " F | (-) N (+) | G\n"
3638
+                                 " T |           | H\n"
3639
+                                 "   |    (-)    | T\n"
3640
+                                 "   |           |\n"
3641
+                                 "   O-- FRONT --+\n"
3642
+                                 " (0,0)");
3651 3643
 
3652 3644
           float min_diff = 999;
3653 3645
 
@@ -3674,7 +3666,7 @@ inline void gcode_G28() {
3674 3666
           } // yy
3675 3667
           SERIAL_EOL;
3676 3668
           if (verbose_level > 3) {
3677
-            SERIAL_PROTOCOLPGM(" \nCorrected Bed Height vs. Bed Topology: \n");
3669
+            SERIAL_PROTOCOLLNPGM("\nCorrected Bed Height vs. Bed Topology:");
3678 3670
 
3679 3671
             for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
3680 3672
               for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
@@ -3703,7 +3695,7 @@ inline void gcode_G28() {
3703 3695
 
3704 3696
     #if DISABLED(DELTA)
3705 3697
       if (verbose_level > 0)
3706
-        planner.bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
3698
+        planner.bed_level_matrix.debug("\n\nBed Level Correction Matrix:");
3707 3699
 
3708 3700
       if (!dryrun) {
3709 3701
         /**
@@ -3747,7 +3739,7 @@ inline void gcode_G28() {
3747 3739
     #ifdef Z_PROBE_END_SCRIPT
3748 3740
       #if ENABLED(DEBUG_LEVELING_FEATURE)
3749 3741
         if (DEBUGGING(LEVELING)) {
3750
-          SERIAL_ECHO("Z Probe End Script: ");
3742
+          SERIAL_ECHOPGM("Z Probe End Script: ");
3751 3743
           SERIAL_ECHOLNPGM(Z_PROBE_END_SCRIPT);
3752 3744
         }
3753 3745
       #endif
@@ -4130,16 +4122,16 @@ inline void gcode_M42() {
4130 4122
 
4131 4123
     int8_t verbose_level = code_seen('V') ? code_value_byte() : 1;
4132 4124
     if (verbose_level < 0 || verbose_level > 4) {
4133
-      SERIAL_PROTOCOLPGM("?Verbose Level not plausible (0-4).\n");
4125
+      SERIAL_PROTOCOLLNPGM("?Verbose Level not plausible (0-4).");
4134 4126
       return;
4135 4127
     }
4136 4128
 
4137 4129
     if (verbose_level > 0)
4138
-      SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n");
4130
+      SERIAL_PROTOCOLLNPGM("M48 Z-Probe Repeatability test");
4139 4131
 
4140 4132
     int8_t n_samples = code_seen('P') ? code_value_byte() : 10;
4141 4133
     if (n_samples < 4 || n_samples > 50) {
4142
-      SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n");
4134
+      SERIAL_PROTOCOLLNPGM("?Sample size not plausible (4-50).");
4143 4135
       return;
4144 4136
     }
4145 4137
 
@@ -4168,7 +4160,7 @@ inline void gcode_M42() {
4168 4160
       }
4169 4161
     #else
4170 4162
       if (sqrt(X_probe_location * X_probe_location + Y_probe_location * Y_probe_location) > DELTA_PROBEABLE_RADIUS) {
4171
-        SERIAL_PROTOCOLPGM("? (X,Y) location outside of probeable radius.\n");
4163
+        SERIAL_PROTOCOLLNPGM("? (X,Y) location outside of probeable radius.");
4172 4164
         return;
4173 4165
       }
4174 4166
     #endif
@@ -4176,7 +4168,7 @@ inline void gcode_M42() {
4176 4168
     bool seen_L = code_seen('L');
4177 4169
     uint8_t n_legs = seen_L ? code_value_byte() : 0;
4178 4170
     if (n_legs > 15) {
4179
-      SERIAL_PROTOCOLPGM("?Number of legs in movement not plausible (0-15).\n");
4171
+      SERIAL_PROTOCOLLNPGM("?Number of legs in movement not plausible (0-15).");
4180 4172
       return;
4181 4173
     }
4182 4174
     if (n_legs == 1) n_legs = 2;
@@ -4190,7 +4182,7 @@ inline void gcode_M42() {
4190 4182
      * we don't want to use that as a starting point for each probe.
4191 4183
      */
4192 4184
     if (verbose_level > 2)
4193
-      SERIAL_PROTOCOLPGM("Positioning the probe...\n");
4185
+      SERIAL_PROTOCOLLNPGM("Positioning the probe...");
4194 4186
 
4195 4187
     #if ENABLED(DELTA)
4196 4188
       // we don't do bed level correction in M48 because we want the raw data when we probe
@@ -4223,9 +4215,9 @@ inline void gcode_M42() {
4223 4215
         if (verbose_level > 3) {
4224 4216
           SERIAL_ECHOPAIR("Starting radius: ", radius);
4225 4217
           SERIAL_ECHOPAIR("   angle: ", angle);
4226
-          SERIAL_ECHO(" Direction: ");
4227
-          if (dir > 0) SERIAL_ECHO("Counter ");
4228
-          SERIAL_ECHOLN("Clockwise");
4218
+          SERIAL_ECHOPGM(" Direction: ");
4219
+          if (dir > 0) SERIAL_ECHOPGM("Counter-");
4220
+          SERIAL_ECHOLNPGM("Clockwise");
4229 4221
         }
4230 4222
 
4231 4223
         for (uint8_t l = 0; l < n_legs - 1; l++) {
@@ -4268,10 +4260,10 @@ inline void gcode_M42() {
4268 4260
             }
4269 4261
           #endif
4270 4262
           if (verbose_level > 3) {
4271
-            SERIAL_PROTOCOL("Going to:");
4272
-            SERIAL_ECHOPAIR("x: ", X_current);
4273
-            SERIAL_ECHOPAIR("y: ", Y_current);
4274
-            SERIAL_ECHOPAIR("  z: ", current_position[Z_AXIS]);
4263
+            SERIAL_PROTOCOLPGM("Going to:");
4264
+            SERIAL_ECHOPAIR(" X", X_current);
4265
+            SERIAL_ECHOPAIR(" Y", Y_current);
4266
+            SERIAL_ECHOPAIR(" Z", current_position[Z_AXIS]);
4275 4267
             SERIAL_EOL;
4276 4268
           }
4277 4269
           do_blocking_move_to_xy(X_current, Y_current);
@@ -5542,9 +5534,9 @@ inline void gcode_M226() {
5542 5534
     }
5543 5535
     else if (servo_index >= 0) {
5544 5536
       SERIAL_ECHO_START;
5545
-      SERIAL_ECHO(" Servo ");
5537
+      SERIAL_ECHOPGM(" Servo ");
5546 5538
       SERIAL_ECHO(servo_index);
5547
-      SERIAL_ECHO(": ");
5539
+      SERIAL_ECHOPGM(": ");
5548 5540
       SERIAL_ECHOLN(servo[servo_index].read());
5549 5541
     }
5550 5542
   }
@@ -5601,17 +5593,17 @@ inline void gcode_M226() {
5601 5593
       thermalManager.updatePID();
5602 5594
       SERIAL_ECHO_START;
5603 5595
       #if ENABLED(PID_PARAMS_PER_HOTEND)
5604
-        SERIAL_ECHO(" e:"); // specify extruder in serial output
5596
+        SERIAL_ECHOPGM(" e:"); // specify extruder in serial output
5605 5597
         SERIAL_ECHO(e);
5606 5598
       #endif // PID_PARAMS_PER_HOTEND
5607
-      SERIAL_ECHO(" p:");
5599
+      SERIAL_ECHOPGM(" p:");
5608 5600
       SERIAL_ECHO(PID_PARAM(Kp, e));
5609
-      SERIAL_ECHO(" i:");
5601
+      SERIAL_ECHOPGM(" i:");
5610 5602
       SERIAL_ECHO(unscalePID_i(PID_PARAM(Ki, e)));
5611
-      SERIAL_ECHO(" d:");
5603
+      SERIAL_ECHOPGM(" d:");
5612 5604
       SERIAL_ECHO(unscalePID_d(PID_PARAM(Kd, e)));
5613 5605
       #if ENABLED(PID_ADD_EXTRUSION_RATE)
5614
-        SERIAL_ECHO(" c:");
5606
+        SERIAL_ECHOPGM(" c:");
5615 5607
         //Kc does not have scaling applied above, or in resetting defaults
5616 5608
         SERIAL_ECHO(PID_PARAM(Kc, e));
5617 5609
       #endif
@@ -5635,11 +5627,11 @@ inline void gcode_M226() {
5635 5627
     thermalManager.updatePID();
5636 5628
 
5637 5629
     SERIAL_ECHO_START;
5638
-    SERIAL_ECHO(" p:");
5630
+    SERIAL_ECHOPGM(" p:");
5639 5631
     SERIAL_ECHO(thermalManager.bedKp);
5640
-    SERIAL_ECHO(" i:");
5632
+    SERIAL_ECHOPGM(" i:");
5641 5633
     SERIAL_ECHO(unscalePID_i(thermalManager.bedKi));
5642
-    SERIAL_ECHO(" d:");
5634
+    SERIAL_ECHOPGM(" d:");
5643 5635
     SERIAL_ECHOLN(unscalePID_d(thermalManager.bedKd));
5644 5636
   }
5645 5637
 
@@ -5739,7 +5731,7 @@ inline void gcode_M303() {
5739 5731
 #if ENABLED(SCARA)
5740 5732
   bool SCARA_move_to_cal(uint8_t delta_x, uint8_t delta_y) {
5741 5733
     //SoftEndsEnabled = false;              // Ignore soft endstops during calibration
5742
-    //SERIAL_ECHOLN(" Soft endstops disabled ");
5734
+    //SERIAL_ECHOLNPGM(" Soft endstops disabled");
5743 5735
     if (IsRunning()) {
5744 5736
       //gcode_get_destination(); // For X Y Z E F
5745 5737
       delta[X_AXIS] = delta_x;
@@ -5758,7 +5750,7 @@ inline void gcode_M303() {
5758 5750
    * M360: SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
5759 5751
    */
5760 5752
   inline bool gcode_M360() {
5761
-    SERIAL_ECHOLN(" Cal: Theta 0 ");
5753
+    SERIAL_ECHOLNPGM(" Cal: Theta 0");
5762 5754
     return SCARA_move_to_cal(0, 120);
5763 5755
   }
5764 5756
 
@@ -5766,7 +5758,7 @@ inline void gcode_M303() {
5766 5758
    * M361: SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
5767 5759
    */
5768 5760
   inline bool gcode_M361() {
5769
-    SERIAL_ECHOLN(" Cal: Theta 90 ");
5761
+    SERIAL_ECHOLNPGM(" Cal: Theta 90");
5770 5762
     return SCARA_move_to_cal(90, 130);
5771 5763
   }
5772 5764
 
@@ -5774,7 +5766,7 @@ inline void gcode_M303() {
5774 5766
    * M362: SCARA calibration: Move to cal-position PsiA (0 deg calibration)
5775 5767
    */
5776 5768
   inline bool gcode_M362() {
5777
-    SERIAL_ECHOLN(" Cal: Psi 0 ");
5769
+    SERIAL_ECHOLNPGM(" Cal: Psi 0");
5778 5770
     return SCARA_move_to_cal(60, 180);
5779 5771
   }
5780 5772
 
@@ -5782,7 +5774,7 @@ inline void gcode_M303() {
5782 5774
    * M363: SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree)
5783 5775
    */
5784 5776
   inline bool gcode_M363() {
5785
-    SERIAL_ECHOLN(" Cal: Psi 90 ");
5777
+    SERIAL_ECHOLNPGM(" Cal: Psi 90");
5786 5778
     return SCARA_move_to_cal(50, 90);
5787 5779
   }
5788 5780
 
@@ -5790,7 +5782,7 @@ inline void gcode_M303() {
5790 5782
    * M364: SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position)
5791 5783
    */
5792 5784
   inline bool gcode_M364() {
5793
-    SERIAL_ECHOLN(" Cal: Theta-Psi 90 ");
5785
+    SERIAL_ECHOLNPGM(" Cal: Theta-Psi 90");
5794 5786
     return SCARA_move_to_cal(45, 135);
5795 5787
   }
5796 5788
 
@@ -6109,6 +6101,7 @@ inline void gcode_M503() {
6109 6101
       else {
6110 6102
         SERIAL_ECHOPGM(MSG_Z_MIN);
6111 6103
         SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MIN);
6104
+        SERIAL_CHAR(' ');
6112 6105
         SERIAL_ECHOPGM(MSG_Z_MAX);
6113 6106
         SERIAL_ECHO(Z_PROBE_OFFSET_RANGE_MAX);
6114 6107
       }
@@ -6625,7 +6618,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
6625 6618
   #endif
6626 6619
 
6627 6620
   SERIAL_ECHO_START;
6628
-  SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
6621
+  SERIAL_ECHOPGM(MSG_ACTIVE_EXTRUDER);
6629 6622
   SERIAL_PROTOCOLLN((int)active_extruder);
6630 6623
 }
6631 6624
 

+ 20
- 23
Marlin/cardreader.cpp View File

@@ -102,7 +102,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
102 102
       if (!dir.open(parent, lfilename, O_READ)) {
103 103
         if (lsAction == LS_SerialPrint) {
104 104
           SERIAL_ECHO_START;
105
-          SERIAL_ECHOLN(MSG_SD_CANT_OPEN_SUBDIR);
105
+          SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR);
106 106
           SERIAL_ECHOLN(lfilename);
107 107
         }
108 108
       }
@@ -357,8 +357,8 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
357 357
     dirname_start = &name[1];
358 358
     while (dirname_start != NULL) {
359 359
       dirname_end = strchr(dirname_start, '/');
360
-      //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start - name));
361
-      //SERIAL_ECHO("end  :");SERIAL_ECHOLN((int)(dirname_end - name));
360
+      //SERIAL_ECHOPGM("start:");SERIAL_ECHOLN((int)(dirname_start - name));
361
+      //SERIAL_ECHOPGM("end  :");SERIAL_ECHOLN((int)(dirname_end - name));
362 362
       if (dirname_end != NULL && dirname_end > dirname_start) {
363 363
         char subdirname[FILENAME_LENGTH];
364 364
         strncpy(subdirname, dirname_start, dirname_end - dirname_start);
@@ -371,7 +371,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
371 371
           return;
372 372
         }
373 373
         else {
374
-          //SERIAL_ECHOLN("dive ok");
374
+          //SERIAL_ECHOLNPGM("dive ok");
375 375
         }
376 376
 
377 377
         curDir = &myDir;
@@ -379,7 +379,7 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
379 379
       }
380 380
       else { // the remainder after all /fsa/fdsa/ is the filename
381 381
         fname = dirname_start;
382
-        //SERIAL_ECHOLN("remainder");
382
+        //SERIAL_ECHOLNPGM("remainder");
383 383
         //SERIAL_ECHOLN(fname);
384 384
         break;
385 385
       }
@@ -392,10 +392,9 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
392 392
   if (read) {
393 393
     if (file.open(curDir, fname, O_READ)) {
394 394
       filesize = file.fileSize();
395
-      SERIAL_PROTOCOLPGM(MSG_SD_FILE_OPENED);
396
-      SERIAL_PROTOCOL(fname);
397
-      SERIAL_PROTOCOLPGM(MSG_SD_SIZE);
398
-      SERIAL_PROTOCOLLN(filesize);
395
+      SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
396
+      SERIAL_PROTOCOLPAIR(MSG_SD_SIZE, filesize);
397
+      SERIAL_EOL;
399 398
       sdpos = 0;
400 399
 
401 400
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
@@ -403,21 +402,20 @@ void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
403 402
       lcd_setstatus(longFilename[0] ? longFilename : fname);
404 403
     }
405 404
     else {
406
-      SERIAL_PROTOCOLPGM(MSG_SD_OPEN_FILE_FAIL);
407
-      SERIAL_PROTOCOL(fname);
408
-      SERIAL_PROTOCOLPGM(".\n");
405
+      SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
406
+      SERIAL_PROTOCOLCHAR('.');
407
+      SERIAL_EOL;
409 408
     }
410 409
   }
411 410
   else { //write
412 411
     if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
413
-      SERIAL_PROTOCOLPGM(MSG_SD_OPEN_FILE_FAIL);
414
-      SERIAL_PROTOCOL(fname);
415
-      SERIAL_PROTOCOLPGM(".\n");
412
+      SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
413
+      SERIAL_PROTOCOLCHAR('.');
414
+      SERIAL_EOL;
416 415
     }
417 416
     else {
418 417
       saving = true;
419
-      SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
420
-      SERIAL_PROTOCOLLN(name);
418
+      SERIAL_PROTOCOLPAIR(MSG_SD_WRITE_TO_FILE, name);
421 419
       lcd_setstatus(fname);
422 420
     }
423 421
   }
@@ -438,21 +436,20 @@ void CardReader::removeFile(char* name) {
438 436
     dirname_start = strchr(name, '/') + 1;
439 437
     while (dirname_start != NULL) {
440 438
       dirname_end = strchr(dirname_start, '/');
441
-      //SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start - name));
442
-      //SERIAL_ECHO("end  :");SERIAL_ECHOLN((int)(dirname_end - name));
439
+      //SERIAL_ECHOPGM("start:");SERIAL_ECHOLN((int)(dirname_start - name));
440
+      //SERIAL_ECHOPGM("end  :");SERIAL_ECHOLN((int)(dirname_end - name));
443 441
       if (dirname_end != NULL && dirname_end > dirname_start) {
444 442
         char subdirname[FILENAME_LENGTH];
445 443
         strncpy(subdirname, dirname_start, dirname_end - dirname_start);
446 444
         subdirname[dirname_end - dirname_start] = 0;
447 445
         SERIAL_ECHOLN(subdirname);
448 446
         if (!myDir.open(curDir, subdirname, O_READ)) {
449
-          SERIAL_PROTOCOLPGM("open failed, File: ");
450
-          SERIAL_PROTOCOL(subdirname);
447
+          SERIAL_PROTOCOLPAIR("open failed, File: ", subdirname);
451 448
           SERIAL_PROTOCOLCHAR('.');
452 449
           return;
453 450
         }
454 451
         else {
455
-          //SERIAL_ECHOLN("dive ok");
452
+          //SERIAL_ECHOLNPGM("dive ok");
456 453
         }
457 454
 
458 455
         curDir = &myDir;
@@ -460,7 +457,7 @@ void CardReader::removeFile(char* name) {
460 457
       }
461 458
       else { // the remainder after all /fsa/fdsa/ is the filename
462 459
         fname = dirname_start;
463
-        //SERIAL_ECHOLN("remainder");
460
+        //SERIAL_ECHOLNPGM("remainder");
464 461
         //SERIAL_ECHOLN(fname);
465 462
         break;
466 463
       }

+ 3
- 3
Marlin/configuration_store.cpp View File

@@ -344,7 +344,7 @@ void Config_RetrieveSettings() {
344 344
   char stored_ver[4];
345 345
   char ver[4] = EEPROM_VERSION;
346 346
   EEPROM_READ_VAR(i, stored_ver); //read stored version
347
-  //  SERIAL_ECHOLN("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
347
+  //  SERIAL_ECHO("Version: [" << ver << "] Stored version: [" << stored_ver << "]\n");
348 348
 
349 349
   if (strncmp(ver, stored_ver, 3) != 0) {
350 350
     Config_ResetDefault();
@@ -717,7 +717,7 @@ void Config_PrintSettings(bool forReplay) {
717 717
 
718 718
   CONFIG_ECHO_START;
719 719
   if (!forReplay) {
720
-    SERIAL_ECHOLNPGM("Home offset (mm):");
720
+    SERIAL_ECHOLNPGM("Home offset (mm)");
721 721
     CONFIG_ECHO_START;
722 722
   }
723 723
   SERIAL_ECHOPAIR("  M206 X", home_offset[X_AXIS]);
@@ -883,7 +883,7 @@ void Config_PrintSettings(bool forReplay) {
883 883
       SERIAL_ECHOLNPGM("Auto-Retract: S=0 to disable, 1 to interpret extrude-only moves as retracts or recoveries");
884 884
       CONFIG_ECHO_START;
885 885
     }
886
-    SERIAL_ECHOPAIR("  M209 S", (autoretract_enabled ? 1 : 0));
886
+    SERIAL_ECHOPAIR("  M209 S", autoretract_enabled ? 1 : 0);
887 887
     SERIAL_EOL;
888 888
 
889 889
   #endif // FWRETRACT

+ 1
- 1
Marlin/endstops.cpp View File

@@ -197,7 +197,7 @@ void Endstops::report_state() {
197 197
 } // Endstops::report_state
198 198
 
199 199
 void Endstops::M119() {
200
-  SERIAL_PROTOCOLLN(MSG_M119_REPORT);
200
+  SERIAL_PROTOCOLLNPGM(MSG_M119_REPORT);
201 201
   #if HAS_X_MIN
202 202
     SERIAL_PROTOCOLPGM(MSG_X_MIN);
203 203
     SERIAL_PROTOCOLLN(((READ(X_MIN_PIN)^X_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));

+ 1
- 1
Marlin/language.h View File

@@ -157,7 +157,7 @@
157 157
 #define MSG_ENDSTOP_OPEN                    "open"
158 158
 #define MSG_HOTEND_OFFSET                   "Hotend offsets:"
159 159
 
160
-#define MSG_SD_CANT_OPEN_SUBDIR             "Cannot open subdir"
160
+#define MSG_SD_CANT_OPEN_SUBDIR             "Cannot open subdir "
161 161
 #define MSG_SD_INIT_FAIL                    "SD init fail"
162 162
 #define MSG_SD_VOL_INIT_FAIL                "volume.init failed"
163 163
 #define MSG_SD_OPENROOT_FAIL                "openRoot failed"

+ 1
- 1
Marlin/stepper.cpp View File

@@ -1103,7 +1103,7 @@ void Stepper::microstep_mode(uint8_t driver, uint8_t stepping_mode) {
1103 1103
 }
1104 1104
 
1105 1105
 void Stepper::microstep_readings() {
1106
-  SERIAL_PROTOCOLPGM("MS1,MS2 Pins\n");
1106
+  SERIAL_PROTOCOLLNPGM("MS1,MS2 Pins");
1107 1107
   SERIAL_PROTOCOLPGM("X: ");
1108 1108
   SERIAL_PROTOCOL(digitalRead(X_MS1_PIN));
1109 1109
   SERIAL_PROTOCOLLN(digitalRead(X_MS2_PIN));

+ 1
- 1
Marlin/stepper_dac.cpp View File

@@ -98,7 +98,7 @@
98 98
     SERIAL_ECHOPAIR(" (",   dac_amps(2));
99 99
     SERIAL_ECHOPAIR(") E:", dac_perc(3));
100 100
     SERIAL_ECHOPAIR(" (",   dac_amps(3));
101
-    SERIAL_ECHOLN(")");
101
+    SERIAL_ECHOLNPGM(")");
102 102
   }
103 103
 
104 104
   void dac_commit_eeprom() {

+ 32
- 32
Marlin/temperature.cpp View File

@@ -304,37 +304,37 @@ unsigned char Temperature::soft_pwm[HOTENDS];
304 304
               bias = constrain(bias, 20, max_pow - 20);
305 305
               d = (bias > max_pow / 2) ? max_pow - 1 - bias : bias;
306 306
 
307
-              SERIAL_PROTOCOLPGM(MSG_BIAS); SERIAL_PROTOCOL(bias);
308
-              SERIAL_PROTOCOLPGM(MSG_D);    SERIAL_PROTOCOL(d);
309
-              SERIAL_PROTOCOLPGM(MSG_T_MIN);  SERIAL_PROTOCOL(min);
310
-              SERIAL_PROTOCOLPGM(MSG_T_MAX);  SERIAL_PROTOCOLLN(max);
307
+              SERIAL_PROTOCOLPAIR(MSG_BIAS, bias);
308
+              SERIAL_PROTOCOLPAIR(MSG_D, d);
309
+              SERIAL_PROTOCOLPAIR(MSG_T_MIN, min);
310
+              SERIAL_PROTOCOLPAIR(MSG_T_MAX, max);
311 311
               if (cycles > 2) {
312 312
                 Ku = (4.0 * d) / (3.14159265 * (max - min) / 2.0);
313 313
                 Tu = ((float)(t_low + t_high) / 1000.0);
314
-                SERIAL_PROTOCOLPGM(MSG_KU); SERIAL_PROTOCOL(Ku);
315
-                SERIAL_PROTOCOLPGM(MSG_TU); SERIAL_PROTOCOLLN(Tu);
314
+                SERIAL_PROTOCOLPAIR(MSG_KU, Ku);
315
+                SERIAL_PROTOCOLPAIR(MSG_TU, Tu);
316 316
                 workKp = 0.6 * Ku;
317 317
                 workKi = 2 * workKp / Tu;
318 318
                 workKd = workKp * Tu / 8;
319 319
                 SERIAL_PROTOCOLLNPGM(MSG_CLASSIC_PID);
320
-                SERIAL_PROTOCOLPGM(MSG_KP); SERIAL_PROTOCOLLN(workKp);
321
-                SERIAL_PROTOCOLPGM(MSG_KI); SERIAL_PROTOCOLLN(workKi);
322
-                SERIAL_PROTOCOLPGM(MSG_KD); SERIAL_PROTOCOLLN(workKd);
320
+                SERIAL_PROTOCOLPAIR(MSG_KP, workKp);
321
+                SERIAL_PROTOCOLPAIR(MSG_KI, workKi);
322
+                SERIAL_PROTOCOLPAIR(MSG_KD, workKd);
323 323
                 /**
324 324
                 workKp = 0.33*Ku;
325 325
                 workKi = workKp/Tu;
326 326
                 workKd = workKp*Tu/3;
327
-                SERIAL_PROTOCOLLNPGM(" Some overshoot ");
328
-                SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(workKp);
329
-                SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(workKi);
330
-                SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(workKd);
327
+                SERIAL_PROTOCOLLNPGM(" Some overshoot");
328
+                SERIAL_PROTOCOLPAIR(" Kp: ", workKp);
329
+                SERIAL_PROTOCOLPAIR(" Ki: ", workKi);
330
+                SERIAL_PROTOCOLPAIR(" Kd: ", workKd);
331 331
                 workKp = 0.2*Ku;
332 332
                 workKi = 2*workKp/Tu;
333 333
                 workKd = workKp*Tu/3;
334
-                SERIAL_PROTOCOLLNPGM(" No overshoot ");
335
-                SERIAL_PROTOCOLPGM(" Kp: "); SERIAL_PROTOCOLLN(workKp);
336
-                SERIAL_PROTOCOLPGM(" Ki: "); SERIAL_PROTOCOLLN(workKi);
337
-                SERIAL_PROTOCOLPGM(" Kd: "); SERIAL_PROTOCOLLN(workKd);
334
+                SERIAL_PROTOCOLLNPGM(" No overshoot");
335
+                SERIAL_PROTOCOLPAIR(" Kp: ", workKp);
336
+                SERIAL_PROTOCOLPAIR(" Ki: ", workKi);
337
+                SERIAL_PROTOCOLPAIR(" Kd: ", workKd);
338 338
                 */
339 339
               }
340 340
             }
@@ -377,17 +377,17 @@ unsigned char Temperature::soft_pwm[HOTENDS];
377 377
 
378 378
         #if HAS_PID_FOR_BOTH
379 379
           const char* estring = hotend < 0 ? "bed" : "";
380
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Kp "); SERIAL_PROTOCOLLN(workKp);
381
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Ki "); SERIAL_PROTOCOLLN(workKi);
382
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_"); SERIAL_PROTOCOL(estring); SERIAL_PROTOCOLPGM("Kd "); SERIAL_PROTOCOLLN(workKd);
380
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kp ", workKp);
381
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Ki ", workKi);
382
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_", estring); SERIAL_PROTOCOLPAIR("Kd ", workKd);
383 383
         #elif ENABLED(PIDTEMP)
384
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_Kp "); SERIAL_PROTOCOLLN(workKp);
385
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_Ki "); SERIAL_PROTOCOLLN(workKi);
386
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_Kd "); SERIAL_PROTOCOLLN(workKd);
384
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Kp ", workKp);
385
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Ki ", workKi);
386
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_Kd ", workKd);
387 387
         #else
388
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_bedKp "); SERIAL_PROTOCOLLN(workKp);
389
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_bedKi "); SERIAL_PROTOCOLLN(workKi);
390
-          SERIAL_PROTOCOLPGM("#define  DEFAULT_bedKd "); SERIAL_PROTOCOLLN(workKd);
388
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKp ", workKp);
389
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKi ", workKi);
390
+          SERIAL_PROTOCOLPAIR("#define  DEFAULT_bedKd ", workKd);
391 391
         #endif
392 392
 
393 393
         #define _SET_BED_PID() \
@@ -626,16 +626,16 @@ float Temperature::get_pid_output(int e) {
626 626
 
627 627
     #if ENABLED(PID_BED_DEBUG)
628 628
       SERIAL_ECHO_START;
629
-      SERIAL_ECHO(" PID_BED_DEBUG ");
630
-      SERIAL_ECHO(": Input ");
629
+      SERIAL_ECHOPGM(" PID_BED_DEBUG ");
630
+      SERIAL_ECHOPGM(": Input ");
631 631
       SERIAL_ECHO(current_temperature_bed);
632
-      SERIAL_ECHO(" Output ");
632
+      SERIAL_ECHOPGM(" Output ");
633 633
       SERIAL_ECHO(pid_output);
634
-      SERIAL_ECHO(" pTerm ");
634
+      SERIAL_ECHOPGM(" pTerm ");
635 635
       SERIAL_ECHO(pTerm_bed);
636
-      SERIAL_ECHO(" iTerm ");
636
+      SERIAL_ECHOPGM(" iTerm ");
637 637
       SERIAL_ECHO(iTerm_bed);
638
-      SERIAL_ECHO(" dTerm ");
638
+      SERIAL_ECHOPGM(" dTerm ");
639 639
       SERIAL_ECHOLN(dTerm_bed);
640 640
     #endif //PID_BED_DEBUG
641 641
 

+ 5
- 8
Marlin/ultralcd.cpp View File

@@ -2266,14 +2266,11 @@ void lcd_update() {
2266 2266
 
2267 2267
                 #if ENABLED(ENCODER_RATE_MULTIPLIER_DEBUG)
2268 2268
                   SERIAL_ECHO_START;
2269
-                  SERIAL_ECHO("Enc Step Rate: ");
2270
-                  SERIAL_ECHO(encoderStepRate);
2271
-                  SERIAL_ECHO("  Multiplier: ");
2272
-                  SERIAL_ECHO(encoderMultiplier);
2273
-                  SERIAL_ECHO("  ENCODER_10X_STEPS_PER_SEC: ");
2274
-                  SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC);
2275
-                  SERIAL_ECHO("  ENCODER_100X_STEPS_PER_SEC: ");
2276
-                  SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC);
2269
+                  SERIAL_ECHOPAIR("Enc Step Rate: ", encoderStepRate);
2270
+                  SERIAL_ECHOPAIR("  Multiplier: ", encoderMultiplier);
2271
+                  SERIAL_ECHOPAIR("  ENCODER_10X_STEPS_PER_SEC: ", ENCODER_10X_STEPS_PER_SEC);
2272
+                  SERIAL_ECHOPAIR("  ENCODER_100X_STEPS_PER_SEC: ", ENCODER_100X_STEPS_PER_SEC);
2273
+                  SERIAL_EOL;
2277 2274
                 #endif //ENCODER_RATE_MULTIPLIER_DEBUG
2278 2275
               }
2279 2276
 

Loading…
Cancel
Save