Allocate sufficient MSG_MOVE_Z_DIST buffer

See #19158
This commit is contained in:
Scott Lahteine 2020-08-27 12:22:47 -05:00
parent cb75bec06d
commit e8dcbd8300

View file

@ -195,11 +195,12 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int
SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); });
SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); });
if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) {
char tmp[20], numstr[10];
// Determine digits needed right of decimal
const uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 :
!UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2;
sprintf_P(tmp, GET_TEXT(MSG_MOVE_Z_DIST), dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr));
constexpr uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 :
!UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2;
PGM_P const label = GET_TEXT(MSG_MOVE_Z_DIST);
char tmp[strlen_P(label) + 10 + 1], numstr[10];
sprintf_P(tmp, label, dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr));
#if DISABLED(HAS_GRAPHICAL_TFT)
extern const char NUL_STR[];