⚡️ Tiny string optimization
This commit is contained in:
parent
2d9262cc5a
commit
bf61e52390
|
@ -276,13 +276,13 @@ public:
|
|||
SString& set() { super::set(); return *this; }
|
||||
|
||||
template<typename... Args>
|
||||
SString& setf_P(PGM_P const fmt, Args... more) { snprintf_P(str, SIZE, fmt, more...); debug(F("setf_P")); return *this; }
|
||||
SString& setf_P(PGM_P const fmt, Args... more) { super::setf_P(fmt, more...); return *this; }
|
||||
|
||||
template<typename... Args>
|
||||
SString& setf(const char *fmt, Args... more) { snprintf(str, SIZE, fmt, more...); debug(F("setf")); return *this; }
|
||||
SString& setf(const char *fmt, Args... more) { super::setf(fmt, more...); return *this; }
|
||||
|
||||
template<typename... Args>
|
||||
SString& setf(FSTR_P const fmt, Args... more) { return setf_P(FTOP(fmt), more...); }
|
||||
SString& setf(FSTR_P const fmt, Args... more) { super::setf(fmt, more...); return *this; }
|
||||
|
||||
template <typename T>
|
||||
SString& set(const T &v) { super::set(v); return *this; }
|
||||
|
|
|
@ -376,11 +376,19 @@ void _lcd_ubl_storage_mesh() {
|
|||
* UBL LCD "radar" map point editing
|
||||
*/
|
||||
void _lcd_ubl_map_edit_cmd() {
|
||||
char ubl_lcd_gcode[50], str[10], str2[10];
|
||||
dtostrf(bedlevel.get_mesh_x(x_plot), 0, 2, str);
|
||||
dtostrf(bedlevel.get_mesh_y(y_plot), 0, 2, str2);
|
||||
snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode), PSTR("G29P4X%sY%sR%i"), str, str2, int(n_edit_pts));
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
// Costs 198 bytes on AVR with PLR disabled, but saves 60 bytes with PLR enabled
|
||||
queue.inject(TS(F("G29P4X"), x_plot, 'Y', y_plot, 'R', n_edit_pts));
|
||||
#else
|
||||
char ubl_lcd_gcode[50], str1[10], str2[10];
|
||||
snprintf_P(ubl_lcd_gcode, sizeof(ubl_lcd_gcode),
|
||||
PSTR("G29P4X%sY%sR%i"),
|
||||
dtostrf(bedlevel.get_mesh_x(x_plot), 0, 2, str1),
|
||||
dtostrf(bedlevel.get_mesh_y(y_plot), 0, 2, str2),
|
||||
int(n_edit_pts)
|
||||
);
|
||||
queue.inject(ubl_lcd_gcode);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue