Browse Source

Use PSTR for common labels

Scott Lahteine 4 years ago
parent
commit
5e9a10dbae

+ 9
- 1
Marlin/src/MarlinCore.cpp View File

@@ -192,7 +192,15 @@ const char NUL_STR[] PROGMEM = "",
192 192
            SP_X_STR[] PROGMEM = " X",
193 193
            SP_Y_STR[] PROGMEM = " Y",
194 194
            SP_Z_STR[] PROGMEM = " Z",
195
-           SP_E_STR[] PROGMEM = " E";
195
+           SP_E_STR[] PROGMEM = " E",
196
+              X_LBL[] PROGMEM =  "X:",
197
+              Y_LBL[] PROGMEM =  "Y:",
198
+              Z_LBL[] PROGMEM =  "Z:",
199
+              E_LBL[] PROGMEM =  "E:",
200
+           SP_X_LBL[] PROGMEM = " X:",
201
+           SP_Y_LBL[] PROGMEM = " Y:",
202
+           SP_Z_LBL[] PROGMEM = " Z:",
203
+           SP_E_LBL[] PROGMEM = " E:";
196 204
 
197 205
 bool Running = true;
198 206
 

+ 3
- 1
Marlin/src/MarlinCore.h View File

@@ -123,4 +123,6 @@ void protected_pin_err();
123 123
 #endif
124 124
 
125 125
 extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
126
-                  SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
126
+                  SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[],
127
+                  X_LBL[], Y_LBL[], Z_LBL[], E_LBL[], SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_E_LBL[];
128
+

+ 5
- 5
Marlin/src/feature/dac/stepper_dac.cpp View File

@@ -88,11 +88,11 @@ void dac_print_values() {
88 88
 
89 89
   SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
90 90
   SERIAL_ECHO_START();
91
-  SERIAL_ECHOLNPAIR(
92
-    " X:", dac_perc(X_AXIS), " (", dac_amps(X_AXIS), ")"
93
-    " Y:", dac_perc(Y_AXIS), " (", dac_amps(Y_AXIS), ")"
94
-    " Z:", dac_perc(Z_AXIS), " (", dac_amps(Z_AXIS), ")"
95
-    " E:", dac_perc(E_AXIS), " (", dac_amps(E_AXIS), ")"
91
+  SERIAL_ECHOLNPAIR_P(
92
+    SP_X_LBL, dac_perc(X_AXIS), PSTR(" ("), dac_amps(X_AXIS), PSTR(")")
93
+    SP_Y_LBL, dac_perc(Y_AXIS), PSTR(" ("), dac_amps(Y_AXIS), PSTR(")")
94
+    SP_Z_LBL, dac_perc(Z_AXIS), PSTR(" ("), dac_amps(Z_AXIS), PSTR(")")
95
+    SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")")
96 96
   );
97 97
 }
98 98
 

+ 4
- 4
Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp View File

@@ -1212,10 +1212,10 @@ void MarlinUI::draw_status_screen() {
1212 1212
         #define _LCD_W_POS 12
1213 1213
         #define _PLOT_X 1
1214 1214
         #define _MAP_X 3
1215
-        #define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C)
1216
-        #define _XLABEL(X,Y) _LABEL("X:",X,Y)
1217
-        #define _YLABEL(X,Y) _LABEL("Y:",X,Y)
1218
-        #define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
1215
+        #define _LABEL(C,X,Y) lcd_put_u8str_P(X, Y, C)
1216
+        #define _XLABEL(X,Y) _LABEL(X_LBL,X,Y)
1217
+        #define _YLABEL(X,Y) _LABEL(Y_LBL,X,Y)
1218
+        #define _ZLABEL(X,Y) _LABEL(Z_LBL,X,Y)
1219 1219
       #else
1220 1220
         #define _LCD_W_POS 8
1221 1221
         #define _PLOT_X 0

+ 2
- 2
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

@@ -652,11 +652,11 @@ void MarlinUI::draw_status_screen() {
652 652
           }
653 653
         }
654 654
         else if (progress_state == 2 && estimation_string[0]) {
655
-          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, "R:");
655
+          lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, PSTR("R:"));
656 656
           lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
657 657
         }
658 658
         else if (elapsed_string[0]) {
659
-          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, "E:");
659
+          lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, E_LBL);
660 660
           lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
661 661
         }
662 662
 

+ 3
- 3
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp View File

@@ -548,9 +548,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
548 548
       if (PAGE_UNDER(7)) {
549 549
         const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
550 550
                        lpos = pos.asLogical();
551
-        lcd_put_u8str(5, 7, "X:");
551
+        lcd_put_u8str_P(5, 7, X_LBL);
552 552
         lcd_put_u8str(ftostr52(lpos.x));
553
-        lcd_put_u8str(74, 7, "Y:");
553
+        lcd_put_u8str_P(74, 7, Y_LBL);
554 554
         lcd_put_u8str(ftostr52(lpos.y));
555 555
       }
556 556
 
@@ -563,7 +563,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
563 563
         lcd_put_wchar(')');
564 564
 
565 565
         // Show the location value
566
-        lcd_put_u8str(74, LCD_PIXEL_HEIGHT, "Z:");
566
+        lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
567 567
         if (!isnan(ubl.z_values[x_plot][y_plot]))
568 568
           lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
569 569
         else

+ 7
- 4
Marlin/src/module/planner.cpp View File

@@ -2628,21 +2628,24 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
2628 2628
       SERIAL_ECHOPAIR("->", target.a);
2629 2629
       SERIAL_ECHOPAIR(") B:", b);
2630 2630
     #else
2631
-      SERIAL_ECHOPAIR(" X:", a);
2631
+      SERIAL_ECHOPAIR_P(SP_X_LBL, a);
2632 2632
       SERIAL_ECHOPAIR(" (", position.x);
2633 2633
       SERIAL_ECHOPAIR("->", target.x);
2634
-      SERIAL_ECHOPAIR(") Y:", b);
2634
+      SERIAL_CHAR(')');
2635
+      SERIAL_ECHOPAIR_P(SP_Y_LBL, b);
2635 2636
     #endif
2636 2637
     SERIAL_ECHOPAIR(" (", position.y);
2637 2638
     SERIAL_ECHOPAIR("->", target.y);
2638 2639
     #if ENABLED(DELTA)
2639 2640
       SERIAL_ECHOPAIR(") C:", c);
2640 2641
     #else
2641
-      SERIAL_ECHOPAIR(") Z:", c);
2642
+      SERIAL_CHAR(')');
2643
+      SERIAL_ECHOPAIR_P(SP_Z_LBL, c);
2642 2644
     #endif
2643 2645
     SERIAL_ECHOPAIR(" (", position.z);
2644 2646
     SERIAL_ECHOPAIR("->", target.z);
2645
-    SERIAL_ECHOPAIR(") E:", e);
2647
+    SERIAL_CHAR(')');
2648
+    SERIAL_ECHOPAIR_P(SP_E_LBL, e);
2646 2649
     SERIAL_ECHOPAIR(" (", position.e);
2647 2650
     SERIAL_ECHOPAIR("->", target.e);
2648 2651
     SERIAL_ECHOLNPGM(")");

+ 4
- 2
Marlin/src/module/scara.cpp View File

@@ -53,11 +53,13 @@ void scara_set_axis_is_at_home(const AxisEnum axis) {
53 53
       current_position[axis] = cartes[axis];
54 54
     #else
55 55
       // MP_SCARA uses a Cartesian XY home position
56
-      // SERIAL_ECHOLNPAIR("homeposition X:", homeposition.x, " Y:", homeposition.y);
56
+      // SERIAL_ECHOPGM("homeposition");
57
+      // SERIAL_ECHOLNPAIR_P(SP_X_LBL, homeposition.x, SP_Y_LBL, homeposition.y);
57 58
       current_position[axis] = homeposition[axis];
58 59
     #endif
59 60
 
60
-    // SERIAL_ECHOLNPAIR("Cartesian X:", current_position.x, " Y:", current_position.y);
61
+    // SERIAL_ECHOPGM("Cartesian");
62
+    // SERIAL_ECHOLNPAIR_P(SP_X_LBL, current_position.x, SP_Y_LBL, current_position.y);
61 63
     update_software_endstops(axis);
62 64
   }
63 65
 }

+ 2
- 2
Marlin/src/module/stepper.cpp View File

@@ -2464,12 +2464,12 @@ void Stepper::report_positions() {
2464 2464
   #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
2465 2465
     SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y);
2466 2466
   #else
2467
-    SERIAL_ECHOPAIR(STR_COUNT_X, pos.x, " Y:", pos.y);
2467
+    SERIAL_ECHOPAIR_P(PSTR(STR_COUNT_X), pos.x, SP_Y_LBL, pos.y);
2468 2468
   #endif
2469 2469
   #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
2470 2470
     SERIAL_ECHOLNPAIR(" C:", pos.z);
2471 2471
   #else
2472
-    SERIAL_ECHOLNPAIR(" Z:", pos.z);
2472
+    SERIAL_ECHOLNPAIR_P(SP_Z_LBL, pos.z);
2473 2473
   #endif
2474 2474
 }
2475 2475
 

Loading…
Cancel
Save