Przeglądaj źródła

Allocate sufficient MSG_MOVE_Z_DIST buffer

See #19158
Scott Lahteine 4 lat temu
rodzic
commit
e8dcbd8300
1 zmienionych plików z 5 dodań i 4 usunięć
  1. 5
    4
      Marlin/src/lcd/menu/menu_motion.cpp

+ 5
- 4
Marlin/src/lcd/menu/menu_motion.cpp Wyświetl plik

195
     SUBMENU(MSG_MOVE_1MM,  []{ _goto_manual_move( 1);    });
195
     SUBMENU(MSG_MOVE_1MM,  []{ _goto_manual_move( 1);    });
196
     SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); });
196
     SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); });
197
     if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) {
197
     if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) {
198
-      char tmp[20], numstr[10];
199
       // Determine digits needed right of decimal
198
       // Determine digits needed right of decimal
200
-      const uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 :
201
-                           !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) *  100 - int((SHORT_MANUAL_Z_MOVE) *  100)) ? 3 : 2;
202
-      sprintf_P(tmp, GET_TEXT(MSG_MOVE_Z_DIST), dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr));
199
+      constexpr uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 :
200
+                               !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) *  100 - int((SHORT_MANUAL_Z_MOVE) *  100)) ? 3 : 2;
201
+      PGM_P const label = GET_TEXT(MSG_MOVE_Z_DIST);
202
+      char tmp[strlen_P(label) + 10 + 1], numstr[10];
203
+      sprintf_P(tmp, label, dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr));
203
 
204
 
204
       #if DISABLED(HAS_GRAPHICAL_TFT)
205
       #if DISABLED(HAS_GRAPHICAL_TFT)
205
         extern const char NUL_STR[];
206
         extern const char NUL_STR[];

Ładowanie…
Anuluj
Zapisz