From d2984c9c547aa60b0aec8c26e59fdcc251d6d069 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 10 Sep 2021 19:47:03 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20TOUCH=5FUI=5FFTDI=5FEVE=20?= =?UTF-8?q?warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/core/debug_out.h | 1 - .../lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h | 4 ++++ .../ftdi_eve_lib/extended/text_ellipsis.cpp | 5 ++--- .../ftdi_eve_lib/extended/unicode/unicode.cpp | 2 +- .../ftdi_eve_lib/extended/unicode/unicode.h | 6 +++--- .../extui/ftdi_eve_touch_ui/generic/string_format.cpp | 10 +++++++--- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h index 3187e03254aab..4e30a5306e9e6 100644 --- a/Marlin/src/core/debug_out.h +++ b/Marlin/src/core/debug_out.h @@ -56,7 +56,6 @@ #include "debug_section.h" #define DEBUG_SECTION(N,S,D) SectionLog N(PSTR(S),D) - #define DEBUG_ECHOPGM_P(P) SERIAL_ECHOPGM_P(P) #define DEBUG_ECHO_START SERIAL_ECHO_START #define DEBUG_ERROR_START SERIAL_ERROR_START #define DEBUG_CHAR SERIAL_CHAR diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h index 2b7eca0cce799..4e11c732268cd 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h @@ -296,3 +296,7 @@ #endif #endif // !__MARLIN_FIRMWARE__ + +#ifndef SD_SPI_SPEED + #define SD_SPI_SPEED SPI_FULL_SPEED +#endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp index 4262dd1155765..463d5ad3162a1 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp @@ -34,7 +34,6 @@ namespace FTDI { #define CHAR_WIDTH(c) use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c] #else #define CHAR_WIDTH(c) utf8_fm.get_char_width(c) - constexpr bool use_utf8 = false; #endif FontMetrics utf8_fm(font); CLCD::FontMetrics clcd_fm; @@ -46,12 +45,12 @@ namespace FTDI { // split and still allow the ellipsis to fit. int16_t lineWidth = 0; char *breakPoint = str; - char *next = str; + const char *next = str; while (*next) { const utf8_char_t c = get_utf8_char_and_inc(next); lineWidth += CHAR_WIDTH(c); if (lineWidth + ellipsisWidth < w) - breakPoint = next; + breakPoint = (char*)next; } if (lineWidth > w) { diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp index 2da5d55ff0c8a..15e613cf69248 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp @@ -66,7 +66,7 @@ * character (this is not the unicode codepoint) */ - utf8_char_t FTDI::get_utf8_char_and_inc(const char *&c) { + utf8_char_t FTDI::get_utf8_char_and_inc(char *&c) { utf8_char_t val = *(uint8_t*)c++; if ((val & 0xC0) == 0xC0) while ((*c & 0xC0) == 0x80) diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.h index 3ca6dfd563ea8..391c8bf6cf69c 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.h @@ -51,14 +51,14 @@ namespace FTDI { /* Returns the next character in a UTF8 string, without incrementing */ - inline utf8_char_t get_utf8_char(const char *c) {return get_utf8_char_and_inc(c);} + inline utf8_char_t get_utf8_char(const char *c) { return get_utf8_char_and_inc(c); } void load_utf8_data(uint32_t addr); #else typedef char utf8_char_t; - inline utf8_char_t get_utf8_char_and_inc(const char *&c) {return *c++;} - inline utf8_char_t get_utf8_char(const char *c) {return *c;} + inline utf8_char_t get_utf8_char_and_inc(const char *&c) { return *c++; } + inline utf8_char_t get_utf8_char(const char *c) { return *c; } inline void load_utf8_data(uint32_t) {} #endif diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp index 1f3640e3a14fe..ed24a9d9ed95e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp @@ -27,8 +27,10 @@ #define ROUND(val) uint16_t((val)+0.5) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wno-format" +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wno-format" +#endif /** * Formats a temperature string (e.g. "100°C") @@ -103,6 +105,8 @@ void format_position(char *str, float x, float y, float z) { sprintf_P(str, PSTR("%s; %s; %s " S_FMT), num1, num2, num3, GET_TEXT(MSG_UNITS_MM)); } -#pragma GCC diagnostic pop +#if GCC_VERSION <= 50000 + #pragma GCC diagnostic pop +#endif #endif // TOUCH_UI_FTDI_EVE