Skip to content

Commit

Permalink
🩹 Fix TOUCH_UI_FTDI_EVE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and mh-dm committed May 15, 2022
1 parent fe74fc3 commit cf8edcc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
1 change: 0 additions & 1 deletion Marlin/src/core/debug_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,7 @@
#endif

#endif // !__MARLIN_FIRMWARE__

#ifndef SD_SPI_SPEED
#define SD_SPI_SPEED SPI_FULL_SPEED
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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

0 comments on commit cf8edcc

Please sign in to comment.