Scrolling status message option

This commit is contained in:
Scott Lahteine
2017-05-28 11:12:12 -05:00
parent b0eae68f57
commit 71367fd518
26 changed files with 156 additions and 41 deletions

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;
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)
#include "ultralcd_impl_DOGM.h"
@ -3961,22 +3964,29 @@ void lcd_update() {
} // ELAPSED(ms, next_lcd_update_ms)
}
void set_utf_strlen(char* s, uint8_t n) {
uint8_t i = 0, j = 0;
while (s[i] && (j < n)) {
#if ENABLED(MAPPER_NON)
j++;
#else
if ((s[i] & 0xC0u) != 0x80u) j++;
#endif
i++;
#if DISABLED(STATUS_MESSAGE_SCROLLING)
void set_utf_strlen(char* s, uint8_t n) {
uint8_t i = 0, j = 0;
while (s[i] && (j < n)) {
#if ENABLED(MAPPER_NON)
j++;
#else
if ((s[i] & 0xC0u) != 0x80u) j++;
#endif
i++;
}
while (j++ < n) s[i++] = ' ';
s[i] = '\0';
}
while (j++ < n) s[i++] = ' ';
s[i] = '\0';
}
#endif // !STATUS_MESSAGE_SCROLLING
void lcd_finishstatus(bool persist=false) {
set_utf_strlen(lcd_status_message, LCD_WIDTH);
#if DISABLED(STATUS_MESSAGE_SCROLLING)
set_utf_strlen(lcd_status_message, LCD_WIDTH);
#endif
#if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
UNUSED(persist);
#endif
@ -3992,6 +4002,10 @@ void lcd_finishstatus(bool persist=false) {
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
previous_lcd_status_ms = millis(); //get status message to show up for a while
#endif
#if ENABLED(STATUS_MESSAGE_SCROLLING)
status_scroll_pos = 0;
#endif
}
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0