浏览代码

Minor string storage optimization

Scott Lahteine 4 年前
父节点
当前提交
0e72c315a0

+ 2
- 0
Marlin/src/MarlinCore.cpp 查看文件

@@ -187,6 +187,8 @@ const char NUL_STR[] PROGMEM = "",
187 187
            M21_STR[] PROGMEM = "M21",
188 188
            M23_STR[] PROGMEM = "M23 %s",
189 189
            M24_STR[] PROGMEM = "M24",
190
+           SP_P_STR[] PROGMEM = " P",
191
+           SP_T_STR[] PROGMEM = " T",
190 192
            SP_X_STR[] PROGMEM = " X",
191 193
            SP_Y_STR[] PROGMEM = " Y",
192 194
            SP_Z_STR[] PROGMEM = " Z",

+ 1
- 1
Marlin/src/MarlinCore.h 查看文件

@@ -121,4 +121,4 @@ void protected_pin_err();
121 121
 #endif
122 122
 
123 123
 extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
124
-                  SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
124
+                  SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];

+ 1
- 1
Marlin/src/gcode/config/M200-M205.cpp 查看文件

@@ -96,7 +96,7 @@ void GcodeSuite::M204() {
96 96
   if (!parser.seen("PRST")) {
97 97
     SERIAL_ECHOPAIR("Acceleration: P", planner.settings.acceleration);
98 98
     SERIAL_ECHOPAIR(" R", planner.settings.retract_acceleration);
99
-    SERIAL_ECHOLNPAIR(" T", planner.settings.travel_acceleration);
99
+    SERIAL_ECHOLNPAIR_P(SP_T_STR, planner.settings.travel_acceleration);
100 100
   }
101 101
   else {
102 102
     //planner.synchronize();

+ 1
- 1
Marlin/src/gcode/config/M217.cpp 查看文件

@@ -37,7 +37,7 @@ void M217_report(const bool eeprom=false) {
37 37
     serialprintPGM(eeprom ? PSTR("  M217") : PSTR("Toolchange:"));
38 38
     SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
39 39
     SERIAL_ECHOPAIR_P(SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime));
40
-    SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
40
+    SERIAL_ECHOPAIR_P(SP_P_STR, LINEAR_UNIT(toolchange_settings.prime_speed));
41 41
     SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
42 42
 
43 43
     #if ENABLED(TOOLCHANGE_PARK)

+ 1
- 1
Marlin/src/gcode/control/M605.cpp 查看文件

@@ -137,7 +137,7 @@
137 137
         DEBUG_EOL();
138 138
 
139 139
         HOTEND_LOOP() {
140
-          DEBUG_ECHOPAIR(" T", int(e));
140
+          DEBUG_ECHOPAIR_P(SP_T_STR, int(e));
141 141
           LOOP_XYZ(a) DEBUG_ECHOPAIR("  hotend_offset[", int(e), "].", axis_codes[a] | 0x20, "=", hotend_offset[e][a]);
142 142
           DEBUG_EOL();
143 143
         }

+ 1
- 1
Marlin/src/gcode/feature/mixing/M166.cpp 查看文件

@@ -35,7 +35,7 @@ inline void echo_mix() {
35 35
 
36 36
 inline void echo_zt(const int t, const float &z) {
37 37
   mixer.update_mix_from_vtool(t);
38
-  SERIAL_ECHOPAIR_P(SP_Z_STR, z, PSTR(" T"), t);
38
+  SERIAL_ECHOPAIR_P(SP_Z_STR, z, SP_T_STR, t);
39 39
   echo_mix();
40 40
 }
41 41
 

+ 2
- 2
Marlin/src/gcode/queue.cpp 查看文件

@@ -254,8 +254,8 @@ void GCodeQueue::ok_to_send() {
254 254
       while (NUMERIC_SIGNED(*p))
255 255
         SERIAL_ECHO(*p++);
256 256
     }
257
-    SERIAL_ECHOPGM(" P"); SERIAL_ECHO(int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
258
-    SERIAL_ECHOPGM(" B"); SERIAL_ECHO(BUFSIZE - length);
257
+    SERIAL_ECHOPAIR_P(SP_P_STR, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
258
+    SERIAL_ECHOPAIR(" B", BUFSIZE - length);
259 259
   #endif
260 260
   SERIAL_EOL();
261 261
 }

+ 8
- 8
Marlin/src/module/configuration_store.cpp 查看文件

@@ -2922,10 +2922,10 @@ void MarlinSettings::reset() {
2922 2922
 
2923 2923
     CONFIG_ECHO_HEADING("Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
2924 2924
     CONFIG_ECHO_START();
2925
-    SERIAL_ECHOLNPAIR(
2926
-        "  M204 P", LINEAR_UNIT(planner.settings.acceleration)
2927
-      , " R", LINEAR_UNIT(planner.settings.retract_acceleration)
2928
-      , " T", LINEAR_UNIT(planner.settings.travel_acceleration)
2925
+    SERIAL_ECHOLNPAIR_P(
2926
+        PSTR("  M204 P"), LINEAR_UNIT(planner.settings.acceleration)
2927
+      , PSTR(" R"), LINEAR_UNIT(planner.settings.retract_acceleration)
2928
+      , SP_T_STR, LINEAR_UNIT(planner.settings.travel_acceleration)
2929 2929
     );
2930 2930
 
2931 2931
     if (!forReplay) {
@@ -2946,7 +2946,7 @@ void MarlinSettings::reset() {
2946 2946
     SERIAL_ECHOLNPAIR_P(
2947 2947
         PSTR("  M205 B"), LINEAR_UNIT(planner.settings.min_segment_time_us)
2948 2948
       , PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s)
2949
-      , PSTR(" T"), LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
2949
+      , SP_T_STR, LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
2950 2950
       #if DISABLED(CLASSIC_JERK)
2951 2951
         , PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm)
2952 2952
       #endif
@@ -3089,8 +3089,8 @@ void MarlinSettings::reset() {
3089 3089
       CONFIG_ECHO_START();
3090 3090
       SERIAL_ECHOLNPAIR_P(
3091 3091
           PSTR("  M665 S"), delta_segments_per_second
3092
-        , PSTR(" P"), scara_home_offset.a
3093
-        , PSTR(" T"), scara_home_offset.b
3092
+        , SP_P_STR, scara_home_offset.a
3093
+        , SP_T_STR, scara_home_offset.b
3094 3094
         , SP_Z_STR, LINEAR_UNIT(scara_home_offset.z)
3095 3095
       );
3096 3096
 
@@ -3168,7 +3168,7 @@ void MarlinSettings::reset() {
3168 3168
           SERIAL_ECHOPAIR_P(
3169 3169
             #if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND)
3170 3170
               PSTR("  M301 E"), e,
3171
-              PSTR(" P")
3171
+              SP_P_STR
3172 3172
             #else
3173 3173
               PSTR("  M301 P")
3174 3174
             #endif

+ 1
- 1
Marlin/src/module/temperature.cpp 查看文件

@@ -1326,7 +1326,7 @@ void Temperature::manage_heater() {
1326 1326
     const user_thermistor_t &t = user_thermistor[t_index];
1327 1327
 
1328 1328
     SERIAL_ECHOPAIR_F(" R", t.series_res, 1);
1329
-    SERIAL_ECHOPAIR_F(" T", t.res_25, 1);
1329
+    SERIAL_ECHOPAIR_F_P(SP_T_STR, t.res_25, 1);
1330 1330
     SERIAL_ECHOPAIR_F(" B", t.beta, 1);
1331 1331
     SERIAL_ECHOPAIR_F(" C", t.sh_c_coeff, 9);
1332 1332
     SERIAL_ECHOPGM(" ; ");

正在加载...
取消
保存