Browse Source

🩹 Fix TOUCH_UI_FTDI_EVE warnings

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
parent
commit
ee1c1034e5
  1. 1
      Marlin/src/core/debug_out.h
  2. 4
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h
  3. 5
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp
  4. 2
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp
  5. 6
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.h
  6. 10
      Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp

1
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

4
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

5
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) {

2
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)

6
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

10
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

Loading…
Cancel
Save