🩹 Fix TOUCH_UI_FTDI_EVE warnings

This commit is contained in:
Scott Lahteine 2021-09-10 19:47:03 -05:00
parent b661795ae5
commit ee1c1034e5
6 changed files with 17 additions and 11 deletions

View File

@ -56,7 +56,6 @@
#include "debug_section.h" #include "debug_section.h"
#define DEBUG_SECTION(N,S,D) SectionLog N(PSTR(S),D) #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_ECHO_START SERIAL_ECHO_START
#define DEBUG_ERROR_START SERIAL_ERROR_START #define DEBUG_ERROR_START SERIAL_ERROR_START
#define DEBUG_CHAR SERIAL_CHAR #define DEBUG_CHAR SERIAL_CHAR

View File

@ -296,3 +296,7 @@
#endif #endif
#endif // !__MARLIN_FIRMWARE__ #endif // !__MARLIN_FIRMWARE__
#ifndef SD_SPI_SPEED
#define SD_SPI_SPEED SPI_FULL_SPEED
#endif

View File

@ -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] #define CHAR_WIDTH(c) use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c]
#else #else
#define CHAR_WIDTH(c) utf8_fm.get_char_width(c) #define CHAR_WIDTH(c) utf8_fm.get_char_width(c)
constexpr bool use_utf8 = false;
#endif #endif
FontMetrics utf8_fm(font); FontMetrics utf8_fm(font);
CLCD::FontMetrics clcd_fm; CLCD::FontMetrics clcd_fm;
@ -46,12 +45,12 @@ namespace FTDI {
// split and still allow the ellipsis to fit. // split and still allow the ellipsis to fit.
int16_t lineWidth = 0; int16_t lineWidth = 0;
char *breakPoint = str; char *breakPoint = str;
char *next = str; const char *next = str;
while (*next) { while (*next) {
const utf8_char_t c = get_utf8_char_and_inc(next); const utf8_char_t c = get_utf8_char_and_inc(next);
lineWidth += CHAR_WIDTH(c); lineWidth += CHAR_WIDTH(c);
if (lineWidth + ellipsisWidth < w) if (lineWidth + ellipsisWidth < w)
breakPoint = next; breakPoint = (char*)next;
} }
if (lineWidth > w) { if (lineWidth > w) {

View File

@ -66,7 +66,7 @@
* character (this is not the unicode codepoint) * 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++; utf8_char_t val = *(uint8_t*)c++;
if ((val & 0xC0) == 0xC0) if ((val & 0xC0) == 0xC0)
while ((*c & 0xC0) == 0x80) while ((*c & 0xC0) == 0x80)

View File

@ -51,14 +51,14 @@ namespace FTDI {
/* Returns the next character in a UTF8 string, without incrementing */ /* 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); void load_utf8_data(uint32_t addr);
#else #else
typedef char utf8_char_t; 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_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(const char *c) { return *c; }
inline void load_utf8_data(uint32_t) {} inline void load_utf8_data(uint32_t) {}
#endif #endif

View File

@ -27,8 +27,10 @@
#define ROUND(val) uint16_t((val)+0.5) #define ROUND(val) uint16_t((val)+0.5)
#pragma GCC diagnostic push #if GCC_VERSION <= 50000
#pragma GCC diagnostic ignored "-Wno-format" #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wno-format"
#endif
/** /**
* Formats a temperature string (e.g. "100°C") * 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)); 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 #endif // TOUCH_UI_FTDI_EVE