From 21ee0612e337bbb16ca532f25c016d918efba22d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 15 Jul 2016 01:57:02 -0700 Subject: [PATCH 1/3] Debug char --- Marlin/Marlin.h | 1 + Marlin/Marlin_main.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index bc1f567fe4..3c0ab801b9 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -105,6 +105,7 @@ extern const char echomagic[] PROGMEM; #define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value))) +void serial_echopair_P(const char* s_P, char v); void serial_echopair_P(const char* s_P, int v); void serial_echopair_P(const char* s_P, long v); void serial_echopair_P(const char* s_P, float v); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e7355292f8..df947a62bc 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -572,6 +572,7 @@ void prepare_move_to_destination(); void plan_cubic_move(const float offset[4]); #endif +void serial_echopair_P(const char* s_P, char v) { serialprintPGM(s_P); SERIAL_CHAR(v); } void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } From 94955a8bf750b08932a60d54c161b12c3e8366f4 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Jul 2016 11:33:01 -0700 Subject: [PATCH 2/3] pad string in lcd_finishstatus --- Marlin/ultralcd.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index bd8d6c3936..2b415cc3ef 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2738,7 +2738,18 @@ void lcd_update() { } } +void set_utf_strlen(char* s, uint8_t n) { + uint8_t i = 0, j = 0; + while (s[i] && (j < n)) { + if ((s[i] & 0xC0u) != 0x80u) j++; + i++; + } + while (j++ < n) s[i++] = ' '; + s[i] = '\0'; +} + void lcd_finishstatus(bool persist=false) { + set_utf_strlen(lcd_status_message, LCD_WIDTH); #if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0)) UNUSED(persist); #endif @@ -2760,32 +2771,19 @@ void lcd_finishstatus(bool persist=false) { void dontExpireStatus() { expire_status_ms = 0; } #endif -void set_utf_strlen(char* s, uint8_t n) { - uint8_t i = 0, j = 0; - while (s[i] && (j < n)) { - if ((s[i] & 0xc0u) != 0x80u) j++; - i++; - } - while (j++ < n) s[i++] = ' '; - s[i] = '\0'; -} - bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } void lcd_setstatus(const char* message, bool persist) { if (lcd_status_message_level > 0) return; strncpy(lcd_status_message, message, 3 * (LCD_WIDTH)); - set_utf_strlen(lcd_status_message, LCD_WIDTH); lcd_finishstatus(persist); } void lcd_setstatuspgm(const char* message, uint8_t level) { - if (level >= lcd_status_message_level) { - strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); - set_utf_strlen(lcd_status_message, LCD_WIDTH); - lcd_status_message_level = level; - lcd_finishstatus(level > 0); - } + if (level < lcd_status_message_level) return; + lcd_status_message_level = level; + strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); + lcd_finishstatus(level > 0); } void lcd_setalertstatuspgm(const char* message) { From 5e3d3918b6fe50d87cbb9f229522f762445847af Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Jul 2016 12:04:43 -0700 Subject: [PATCH 3/3] Patch compile error for RAMPS LCD pins --- Marlin/pins_RAMPS_14.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Marlin/pins_RAMPS_14.h b/Marlin/pins_RAMPS_14.h index 8731845f53..c51a8d02a1 100644 --- a/Marlin/pins_RAMPS_14.h +++ b/Marlin/pins_RAMPS_14.h @@ -149,19 +149,21 @@ #define LCD_PINS_D6 44 #define LCD_PINS_D7 64 #else - #define BEEPER_PIN 33 #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 #define LCD_PINS_D4 23 #define LCD_PINS_D5 25 #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 - // Buttons are attached to a shift register - // Not wired yet - //#define SHIFT_CLK 38 - //#define SHIFT_LD 42 - //#define SHIFT_OUT 40 - //#define SHIFT_EN 17 + #if DISABLED(NEWPANEL) + #define BEEPER_PIN 33 + // Buttons are attached to a shift register + // Not wired yet + //#define SHIFT_CLK 38 + //#define SHIFT_LD 42 + //#define SHIFT_OUT 40 + //#define SHIFT_EN 17 + #endif #endif #if ENABLED(NEWPANEL)