From 7a7a80e6c5faf3fe87f6c0732c617e5ddd2f5cbf Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 2 Apr 2017 00:46:37 -0500 Subject: [PATCH] status_printf => lcd_status_printf_P --- Marlin/Marlin_main.cpp | 14 ++++---------- Marlin/endstops.cpp | 4 +--- Marlin/ultralcd.cpp | 6 +++--- Marlin/ultralcd.h | 4 ++-- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 4741afcf81..27ef4f6105 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1789,15 +1789,10 @@ static void clean_up_after_endstop_or_probe_move() { SERIAL_ECHOLNPGM(" " MSG_FIRST); #if ENABLED(ULTRA_LCD) - char message[3 * (LCD_WIDTH) + 1] = ""; // worst case is kana.utf with up to 3*LCD_WIDTH+1 - strcat_P(message, PSTR(MSG_HOME " ")); - if (xx) strcat_P(message, PSTR(MSG_X)); - if (yy) strcat_P(message, PSTR(MSG_Y)); - if (zz) strcat_P(message, PSTR(MSG_Z)); - strcat_P(message, PSTR(" " MSG_FIRST)); - lcd_setstatus(message); + lcd_status_printf_P(0, PSTR(MSG_HOME " %s%s%s " MSG_FIRST), xx ? MSG_X : "", yy ? MSG_Y : "", zz ? MSG_Z : ""); #endif return true; + } return false; } @@ -5153,7 +5148,6 @@ inline void gcode_M31() { char buffer[21]; duration_t elapsed = print_job_timer.duration(); elapsed.toString(buffer); - lcd_setstatus(buffer); SERIAL_ECHO_START; @@ -5700,7 +5694,7 @@ inline void gcode_M104() { } #endif - if (code_value_temp_abs() > thermalManager.degHotend(target_extruder)) status_printf(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING); + if (code_value_temp_abs() > thermalManager.degHotend(target_extruder)) lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING); } #if ENABLED(AUTOTEMP) @@ -5898,7 +5892,7 @@ inline void gcode_M109() { else print_job_timer.start(); #endif - if (thermalManager.isHeatingHotend(target_extruder)) status_printf(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING); + if (thermalManager.isHeatingHotend(target_extruder)) lcd_status_printf_P(0, PSTR("E%i %s"), target_extruder + 1, MSG_HEATING); } #if ENABLED(AUTOTEMP) diff --git a/Marlin/endstops.cpp b/Marlin/endstops.cpp index 54a512787d..a80a07dc17 100644 --- a/Marlin/endstops.cpp +++ b/Marlin/endstops.cpp @@ -170,9 +170,7 @@ void Endstops::report_state() { SERIAL_EOL; #if ENABLED(ULTRA_LCD) - char msg[3 * strlen(MSG_LCD_ENDSTOPS) + 8 + 1]; // Room for a UTF 8 string - sprintf_P(msg, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP); - lcd_setstatus(msg); + lcd_status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP); #endif hit_on_purpose(); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index d41281c927..5c36b5724b 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -3565,12 +3565,12 @@ void lcd_setstatuspgm(const char * const message, const uint8_t level) { lcd_finishstatus(level > 0); } -void status_printf(uint8_t level, const char *status, ...) { +void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { if (level < lcd_status_message_level) return; lcd_status_message_level = level; va_list args; - va_start(args, status); - vsnprintf_P(lcd_status_message, 3 * (LCD_WIDTH), status, args); + va_start(args, fmt); + vsnprintf_P(lcd_status_message, 3 * (LCD_WIDTH), fmt, args); va_end(args); lcd_finishstatus(level > 0); } diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 0713231578..0b32c09b6c 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -39,7 +39,7 @@ bool lcd_hasstatus(); void lcd_setstatus(const char* message, const bool persist=false); void lcd_setstatuspgm(const char* message, const uint8_t level=0); - void status_printf(uint8_t level, const char *Status, ...); + void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...); void lcd_setalertstatuspgm(const char* message); void lcd_reset_alert_level(); void lcd_kill_screen(); @@ -154,7 +154,7 @@ inline bool lcd_hasstatus() { return false; } inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); } - inline void status_printf(uint8_t level, const char *status, ...) { UNUSED(level); UNUSED(status); } + inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); } inline void lcd_buttons_update() {} inline void lcd_reset_alert_level() {} inline bool lcd_detected() { return true; }