Merge pull request #6877 from thinkyhead/bf_scrolling_status

Scrolling status message (option)
This commit is contained in:
Scott Lahteine 2017-05-28 14:12:36 -05:00 committed by GitHub
commit 58556991da
37 changed files with 226 additions and 94 deletions

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -5746,9 +5746,9 @@ inline void gcode_M17() {
static bool sd_print_paused = false; static bool sd_print_paused = false;
#endif #endif
static void filament_change_beep(const int max_beep_count, const bool init=false) { static void filament_change_beep(const int8_t max_beep_count, const bool init=false) {
static millis_t next_buzz = 0; static millis_t next_buzz = 0;
static uint16_t runout_beep = 0; static int8_t runout_beep = 0;
if (init) next_buzz = runout_beep = 0; if (init) next_buzz = runout_beep = 0;
@ -5763,7 +5763,8 @@ inline void gcode_M17() {
} }
static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos, static bool pause_print(const float &retract, const float &z_lift, const float &x_pos, const float &y_pos,
const float& unload_length = 0 , int max_beep_count = 0, bool show_lcd = false) { const float &unload_length = 0 , int8_t max_beep_count = 0, bool show_lcd = false
) {
if (move_away_flag) return false; // already paused if (move_away_flag) return false; // already paused
if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) { if (!DEBUGGING(DRYRUN) && thermalManager.tooColdToExtrude(active_extruder) && unload_length > 0) {
@ -5772,8 +5773,6 @@ inline void gcode_M17() {
return false; return false;
} }
const bool job_running = print_job_timer.isRunning();
// Indicate that the printer is paused // Indicate that the printer is paused
move_away_flag = true; move_away_flag = true;
@ -5857,7 +5856,7 @@ inline void gcode_M17() {
return true; return true;
} }
static void wait_for_filament_reload(int max_beep_count = 0) { static void wait_for_filament_reload(int8_t max_beep_count = 0) {
bool nozzle_timed_out = false; bool nozzle_timed_out = false;
// Wait for filament insert by user and press button // Wait for filament insert by user and press button
@ -5882,7 +5881,7 @@ inline void gcode_M17() {
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
} }
static void resume_print(const float& load_length = 0, const float& initial_extrude_length = 0, int max_beep_count = 0) { static void resume_print(const float &load_length = 0, const float &initial_extrude_length = 0, int8_t max_beep_count = 0) {
bool nozzle_timed_out = false; bool nozzle_timed_out = false;
if (!move_away_flag) return; if (!move_away_flag) return;

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -443,6 +443,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
#define LCD_INFO_MENU #define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
#define LCD_DECIMAL_SMALL_XY #define LCD_DECIMAL_SMALL_XY

View file

@ -455,6 +455,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
#define LCD_INFO_MENU #define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -444,6 +444,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -444,6 +444,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -444,6 +444,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -444,6 +444,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -449,6 +449,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -444,6 +444,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
//#define LCD_INFO_MENU //#define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -442,6 +442,9 @@
// Include a page of printer information in the LCD Main Menu // Include a page of printer information in the LCD Main Menu
#define LCD_INFO_MENU #define LCD_INFO_MENU
// Scroll a longer status message into view
//#define STATUS_MESSAGE_SCROLLING
// On the Info Screen, display XY with one decimal place when possible // On the Info Screen, display XY with one decimal place when possible
//#define LCD_DECIMAL_SMALL_XY //#define LCD_DECIMAL_SMALL_XY

View file

@ -133,7 +133,7 @@ public:
// Code is found in the string. If not found, value_ptr is unchanged. // Code is found in the string. If not found, value_ptr is unchanged.
// This allows "if (seen('A')||seen('B'))" to use the last-found value. // This allows "if (seen('A')||seen('B'))" to use the last-found value.
static bool seen(const char c) { static bool seen(const char c) {
char *p = strchr(command_args, c); const char *p = strchr(command_args, c);
const bool b = !!p; const bool b = !!p;
if (b) value_ptr = DECIMAL_SIGNED(p[1]) ? &p[1] : NULL; if (b) value_ptr = DECIMAL_SIGNED(p[1]) ? &p[1] : NULL;
return b; return b;

View file

@ -67,8 +67,11 @@ float Temperature::current_temperature[HOTENDS] = { 0.0 },
Temperature::current_temperature_bed = 0.0; Temperature::current_temperature_bed = 0.0;
int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 }, int16_t Temperature::current_temperature_raw[HOTENDS] = { 0 },
Temperature::target_temperature[HOTENDS] = { 0 }, Temperature::target_temperature[HOTENDS] = { 0 },
Temperature::current_temperature_bed_raw = 0, Temperature::current_temperature_bed_raw = 0;
Temperature::target_temperature_bed = 0;
#if HAS_HEATER_BED
int16_t Temperature::target_temperature_bed = 0;
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT) #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
float Temperature::redundant_temperature = 0.0; float Temperature::redundant_temperature = 0.0;

View file

@ -92,6 +92,10 @@ enum ADCSensorState {
#define ACTUAL_ADC_SAMPLES max(int(MIN_ADC_ISR_LOOPS), int(SensorsReady)) #define ACTUAL_ADC_SAMPLES max(int(MIN_ADC_ISR_LOOPS), int(SensorsReady))
#if !HAS_HEATER_BED
constexpr int16_t target_temperature_bed = 0;
#endif
class Temperature { class Temperature {
public: public:
@ -100,8 +104,11 @@ class Temperature {
current_temperature_bed; current_temperature_bed;
static int16_t current_temperature_raw[HOTENDS], static int16_t current_temperature_raw[HOTENDS],
target_temperature[HOTENDS], target_temperature[HOTENDS],
current_temperature_bed_raw, current_temperature_bed_raw;
target_temperature_bed;
#if HAS_HEATER_BED
static int16_t target_temperature_bed;
#endif
static volatile bool in_temp_isr; static volatile bool in_temp_isr;
@ -382,10 +389,18 @@ class Temperature {
} }
static void setTargetBed(const int16_t celsius) { static void setTargetBed(const int16_t celsius) {
target_temperature_bed = celsius; #if HAS_HEATER_BED
target_temperature_bed =
#ifdef BED_MAXTEMP
min(celsius, BED_MAXTEMP)
#else
celsius
#endif
;
#if WATCH_THE_BED #if WATCH_THE_BED
start_watching_bed(); start_watching_bed();
#endif #endif
#endif
} }
static bool isHeatingHotend(uint8_t e) { static bool isHeatingHotend(uint8_t e) {

View file

@ -60,6 +60,9 @@ int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2
uint8_t lcd_status_message_level; uint8_t lcd_status_message_level;
char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
#if ENABLED(STATUS_MESSAGE_SCROLLING)
uint8_t status_scroll_pos = 0;
#endif
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
#include "ultralcd_impl_DOGM.h" #include "ultralcd_impl_DOGM.h"
@ -3961,6 +3964,8 @@ void lcd_update() {
} // ELAPSED(ms, next_lcd_update_ms) } // ELAPSED(ms, next_lcd_update_ms)
} }
#if DISABLED(STATUS_MESSAGE_SCROLLING)
void set_utf_strlen(char* s, uint8_t n) { void set_utf_strlen(char* s, uint8_t n) {
uint8_t i = 0, j = 0; uint8_t i = 0, j = 0;
while (s[i] && (j < n)) { while (s[i] && (j < n)) {
@ -3975,8 +3980,13 @@ void set_utf_strlen(char* s, uint8_t n) {
s[i] = '\0'; s[i] = '\0';
} }
#endif // !STATUS_MESSAGE_SCROLLING
void lcd_finishstatus(bool persist=false) { void lcd_finishstatus(bool persist=false) {
#if DISABLED(STATUS_MESSAGE_SCROLLING)
set_utf_strlen(lcd_status_message, LCD_WIDTH); set_utf_strlen(lcd_status_message, LCD_WIDTH);
#endif
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
UNUSED(persist); UNUSED(persist);
#endif #endif
@ -3992,6 +4002,10 @@ void lcd_finishstatus(bool persist=false) {
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
previous_lcd_status_ms = millis(); //get status message to show up for a while previous_lcd_status_ms = millis(); //get status message to show up for a while
#endif #endif
#if ENABLED(STATUS_MESSAGE_SCROLLING)
status_scroll_pos = 0;
#endif
} }
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0

View file

@ -234,13 +234,24 @@ char lcd_print_and_count(const char c) {
else return charset_mapper(c); else return charset_mapper(c);
} }
void lcd_print(const char* const str) { /**
for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c); * Core LCD printing functions
* On DOGM all strings go through a filter for utf
* But only use lcd_print_utf and lcd_printPGM_utf for translated text
*/
void lcd_print(const char* const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd_print(c); }
void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd_print(c); }
void lcd_print_utf(const char* const str, const uint8_t maxLength=LCD_WIDTH) {
char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
} }
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */ void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
void lcd_printPGM(const char* str) { char c;
for (; char c = pgm_read_byte(str); ++str) lcd_print(c); for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
} }
// Initialize or re-initialize the LCD // Initialize or re-initialize the LCD
@ -320,7 +331,7 @@ static void lcd_implementation_init() {
void lcd_kill_screen() { void lcd_kill_screen() {
lcd_setFont(FONT_MENU); lcd_setFont(FONT_MENU);
u8g.setPrintPos(0, u8g.getHeight()/4*1); u8g.setPrintPos(0, u8g.getHeight()/4*1);
lcd_print(lcd_status_message); lcd_print_utf(lcd_status_message);
u8g.setPrintPos(0, u8g.getHeight()/4*2); u8g.setPrintPos(0, u8g.getHeight()/4*2);
lcd_printPGM(PSTR(MSG_HALTED)); lcd_printPGM(PSTR(MSG_HALTED));
u8g.setPrintPos(0, u8g.getHeight()/4*3); u8g.setPrintPos(0, u8g.getHeight()/4*3);
@ -395,6 +406,20 @@ FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr,
} }
} }
inline void lcd_implementation_status_message() {
#if ENABLED(STATUS_MESSAGE_SCROLLING)
lcd_print_utf(lcd_status_message + status_scroll_pos);
const uint8_t slen = lcd_strlen(lcd_status_message);
if (slen > LCD_WIDTH) {
// Skip any non-printing bytes
while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
}
#else
lcd_print_utf(lcd_status_message);
#endif
}
//#define DOGM_SD_PERCENT //#define DOGM_SD_PERCENT
static void lcd_implementation_status_screen() { static void lcd_implementation_status_screen() {
@ -645,10 +670,7 @@ static void lcd_implementation_status_screen() {
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line
const char *str = lcd_status_message; lcd_implementation_status_message();
uint8_t i = LCD_WIDTH;
char c;
while (i-- && (c = *str++)) lcd_print(c);
} }
else { else {
lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); lcd_printPGM(PSTR(LCD_STR_FILAM_DIA));
@ -660,10 +682,7 @@ static void lcd_implementation_status_screen() {
u8g.print('%'); u8g.print('%');
} }
#else #else
const char *str = lcd_status_message; lcd_implementation_status_message();
uint8_t i = LCD_WIDTH;
char c;
while (i-- && (c = *str++)) lcd_print(c);
#endif #endif
} }
} }

View file

@ -380,17 +380,23 @@ static void lcd_implementation_init(
void lcd_implementation_clear() { lcd.clear(); } void lcd_implementation_clear() { lcd.clear(); }
/* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
void lcd_printPGM(const char *str) {
for (; char c = pgm_read_byte(str); ++str) charset_mapper(c);
}
void lcd_print(const char* const str) {
for (uint8_t i = 0; const char c = str[i]; ++i) charset_mapper(c);
}
void lcd_print(const char c) { charset_mapper(c); } void lcd_print(const char c) { charset_mapper(c); }
void lcd_print(const char * const str) { for (uint8_t i = 0; char c = str[i]; ++i) lcd.print(c); }
void lcd_printPGM(const char* str) { for (; char c = pgm_read_byte(str); ++str) lcd.print(c); }
void lcd_print_utf(const char * const str, const uint8_t maxLength=LCD_WIDTH) {
char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
}
void lcd_printPGM_utf(const char* str, const uint8_t maxLength=LCD_WIDTH) {
char c;
for (uint8_t i = 0, n = maxLength; n && (c = str[i]); ++i)
n -= charset_mapper(c);
}
#if ENABLED(SHOW_BOOTSCREEN) #if ENABLED(SHOW_BOOTSCREEN)
void lcd_erase_line(const int line) { void lcd_erase_line(const int line) {
@ -545,7 +551,7 @@ void lcd_print(const char c) { charset_mapper(c); }
void lcd_kill_screen() { void lcd_kill_screen() {
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd_print(lcd_status_message); lcd_print_utf(lcd_status_message);
#if LCD_HEIGHT < 4 #if LCD_HEIGHT < 4
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
#else #else
@ -818,10 +824,17 @@ static void lcd_implementation_status_screen() {
#endif // FILAMENT_LCD_DISPLAY && SDSUPPORT #endif // FILAMENT_LCD_DISPLAY && SDSUPPORT
const char *str = lcd_status_message; #if ENABLED(STATUS_MESSAGE_SCROLLING)
uint8_t i = LCD_WIDTH; lcd_print_utf(lcd_status_message + status_scroll_pos);
char c; const uint8_t slen = lcd_strlen(lcd_status_message);
while (i-- && (c = *str++)) lcd_print(c); if (slen > LCD_WIDTH) {
// Skip any non-printing bytes
while (!charset_mapper(lcd_status_message[status_scroll_pos])) ++status_scroll_pos;
if (++status_scroll_pos > slen - LCD_WIDTH) status_scroll_pos = 0;
}
#else
lcd_print_utf(lcd_status_message);
#endif
} }
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)