Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix status_printf() jumbled script #26949

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Marlin/src/core/mstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ class MString {

// Set with format string and arguments, like printf
template<typename... Args>
MString& setf_P(PGM_P const fmt, Args... more) { SNPRINTF_P(str, SIZE, fmt, more...); debug(F("setf_P")); return *this; }
MString& setf_P(PGM_P const pfmt, Args... more) { SNPRINTF_P(str, SIZE, pfmt, more...); debug(F("setf_P")); return *this; }

template<typename... Args>
MString& setf(const char *fmt, Args... more) { SNPRINTF(str, SIZE, fmt, more...); debug(F("setf")); return *this; }
MString& setf(const char *fmt, Args... more) { SNPRINTF(str, SIZE, fmt, more...); debug(F("setf")); return *this; }

template<typename... Args>
MString& setf(FSTR_P const fmt, Args... more) { return setf_P(FTOP(fmt), more...); }
MString& setf(FSTR_P const ffmt, Args... more) { return setf_P(FTOP(ffmt), more...); }

// Chainable String appenders
MString& append() { debug(F("nil")); return *this; } // for macros that might emit no output
Expand Down Expand Up @@ -206,9 +206,9 @@ class MString {
MString& append(const spaces_t &s) { return append(repchr_t(' ', s.count)); }

template<typename... Args>
MString& appendf_P(PGM_P const fmt, Args... more) {
MString& appendf_P(PGM_P const pfmt, Args... more) {
int sz = length();
if (sz < SIZE) SNPRINTF_P(str + sz, SIZE - sz, fmt, more...);
if (sz < SIZE) SNPRINTF_P(str + sz, SIZE - sz, pfmt, more...);
debug(F("appendf_P"));
return *this;
}
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/core/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,13 @@ class SString : public MString<SIZE> {
SString& set() { super::set(); return *this; }

template<typename... Args>
SString& setf_P(PGM_P const fmt, Args... more) { super::setf_P(fmt, more...); return *this; }
SString& setf_P(PGM_P const pfmt, Args... more) { super::setf_P(pfmt, more...); return *this; }

template<typename... Args>
SString& setf(const char *fmt, Args... more) { super::setf(fmt, more...); 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) { super::setf(fmt, more...); return *this; }
SString& setf(FSTR_P const ffmt, Args... more) { super::setf(ffmt, more...); return *this; }

template <typename T>
SString& set(const T &v) { super::set(v); return *this; }
Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1563,12 +1563,12 @@ void MarlinUI::host_notify(const char * const cstr) {
*
* @param pfmt A constant format P-string
*/
void MarlinUI::status_printf_P(int8_t level, PGM_P const fmt, ...) {
void MarlinUI::status_printf_P(int8_t level, PGM_P const pfmt, ...) {
if (set_alert_level(level)) return;

va_list args;
va_start(args, fmt);
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args);
va_start(args, pfmt);
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, pfmt, args);
va_end(args);

host_notify(status_message);
Expand Down Expand Up @@ -1642,12 +1642,12 @@ void MarlinUI::host_notify(const char * const cstr) {
void MarlinUI::_set_status_and_level(const char * const ustr, const int8_t=0, const bool pgm) {
pgm ? host_notify_P(ustr) : host_notify(ustr);
}
void MarlinUI::status_printf_P(int8_t level, PGM_P const fmt, ...) {
void MarlinUI::status_printf_P(int8_t level, PGM_P const pfmt, ...) {
MString<30> msg;

va_list args;
va_start(args, fmt);
vsnprintf_P(&msg, 30, fmt, args);
va_start(args, pfmt);
vsnprintf_P(&msg, 30, pfmt, args);
va_end(args);

host_notify(msg);
Expand Down
Loading