Browse Source

📺 Fix and enhance FTDI EVE Touch UI (#22047)

Marcio T 4 years ago
parent
commit
733d5fd57d
No account linked to committer's email address

+ 1
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/constants.h View File

95
 namespace FTDI {
95
 namespace FTDI {
96
   constexpr uint8_t ARGB1555                           = 0;
96
   constexpr uint8_t ARGB1555                           = 0;
97
   constexpr uint8_t L1                                 = 1;
97
   constexpr uint8_t L1                                 = 1;
98
+  constexpr uint8_t L2                                 = 17;
98
   constexpr uint8_t L4                                 = 2;
99
   constexpr uint8_t L4                                 = 2;
99
   constexpr uint8_t L8                                 = 3;
100
   constexpr uint8_t L8                                 = 3;
100
   constexpr uint8_t RGB332                             = 4;
101
   constexpr uint8_t RGB332                             = 4;

+ 2
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/basic/display_list.h View File

64
   inline uint32_t CLEAR_COLOR_A(uint8_t alpha)                 {return DL::CLEAR_COLOR_A|(alpha&255UL);}
64
   inline uint32_t CLEAR_COLOR_A(uint8_t alpha)                 {return DL::CLEAR_COLOR_A|(alpha&255UL);}
65
   inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue)
65
   inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue)
66
                                                                {return DL::CLEAR_COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);}
66
                                                                {return DL::CLEAR_COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);}
67
-  inline uint32_t CLEAR_COLOR_RGB(uint32_t rgb)                {return DL::CLEAR_COLOR_RGB|rgb;}
67
+  inline uint32_t CLEAR_COLOR_RGB(uint32_t rgb)                {return DL::CLEAR_COLOR_RGB|(rgb&0xFFFFFF);}
68
   inline uint32_t CLEAR_STENCIL(uint8_t s)                     {return DL::CLEAR_STENCIL|(s&255UL);}
68
   inline uint32_t CLEAR_STENCIL(uint8_t s)                     {return DL::CLEAR_STENCIL|(s&255UL);}
69
   inline uint32_t CLEAR_TAG(uint8_t s)                         {return DL::CLEAR_TAG|(s&255UL);}
69
   inline uint32_t CLEAR_TAG(uint8_t s)                         {return DL::CLEAR_TAG|(s&255UL);}
70
   inline uint32_t COLOR_A(uint8_t alpha)                       {return DL::COLOR_A|(alpha&255UL);}
70
   inline uint32_t COLOR_A(uint8_t alpha)                       {return DL::COLOR_A|(alpha&255UL);}
71
   inline uint32_t COLOR_MASK(bool r, bool g, bool b, bool a)   {return DL::COLOR_MASK|((r?1UL:0UL)<<3)|((g?1UL:0UL)<<2)|((b?1UL:0UL)<<1)|(a?1UL:0UL);}
71
   inline uint32_t COLOR_MASK(bool r, bool g, bool b, bool a)   {return DL::COLOR_MASK|((r?1UL:0UL)<<3)|((g?1UL:0UL)<<2)|((b?1UL:0UL)<<1)|(a?1UL:0UL);}
72
   inline uint32_t COLOR_RGB(uint8_t red,uint8_t green,uint8_t blue)
72
   inline uint32_t COLOR_RGB(uint8_t red,uint8_t green,uint8_t blue)
73
                                                                {return DL::COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);}
73
                                                                {return DL::COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);}
74
-  inline uint32_t COLOR_RGB(uint32_t rgb)                      {return DL::COLOR_RGB|rgb;}
74
+  inline uint32_t COLOR_RGB(uint32_t rgb)                      {return DL::COLOR_RGB|(rgb&0xFFFFFF);}
75
   /* inline uint32_t DISPLAY()                                 {return (0UL<<24)) */
75
   /* inline uint32_t DISPLAY()                                 {return (0UL<<24)) */
76
   inline uint32_t END()                                        {return DL::END;}
76
   inline uint32_t END()                                        {return DL::END;}
77
   inline uint32_t JUMP(uint16_t dest)                          {return DL::JUMP|(dest&65535UL);}
77
   inline uint32_t JUMP(uint16_t dest)                          {return DL::JUMP|(dest&65535UL);}

+ 22
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h View File

195
   #define pgm_read_ptr_far pgm_read_ptr
195
   #define pgm_read_ptr_far pgm_read_ptr
196
   #endif
196
   #endif
197
 
197
 
198
+  // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
199
+  #define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
200
+  #define NUM_ARGS(V...) _NUM_ARGS(0,V,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
201
+
202
+  // SERIAL_ECHOPAIR / SERIAL_ECHOPAIR_P is used to output a key value pair. The key must be a string and the value can be anything
203
+  // Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR().
204
+  #define __SEP_N(N,V...)   _SEP_##N(V)
205
+  #define _SEP_N(N,V...)    __SEP_N(N,V)
206
+  #define _SEP_1(PRE)       SERIAL_ECHOPGM(PRE)
207
+  #define _SEP_2(PRE,V)     do{ Serial.print(F(PRE)); Serial.print(V); }while(0)
208
+  #define _SEP_3(a,b,c)     do{ _SEP_2(a,b); SERIAL_ECHOPGM(c); }while(0)
209
+  #define _SEP_4(a,b,V...)  do{ _SEP_2(a,b); _SEP_2(V); }while(0)
210
+
211
+  // Print up to 1 pairs of values followed by newline
212
+  #define __SELP_N(N,V...)            _SELP_##N(V)
213
+  #define _SELP_N(N,V...)             __SELP_N(N,V)
214
+  #define _SELP_1(PRE)                SERIAL_ECHOLNPGM(PRE)
215
+  #define _SELP_2(PRE,V)              do{ Serial.print(F(PRE)); Serial.println(V); }while(0)
216
+  #define _SELP_3(a,b,c)              do{ _SEP_2(a,b); SERIAL_ECHOLNPGM(c); }while(0)
217
+  #define _SELP_4(a,b,V...)           do{ _SEP_2(a,b); _SELP_2(V); }while(0)
198
   #define SERIAL_ECHO_START()
218
   #define SERIAL_ECHO_START()
199
   #define SERIAL_ECHOLNPGM(str)       Serial.println(F(str))
219
   #define SERIAL_ECHOLNPGM(str)       Serial.println(F(str))
200
   #define SERIAL_ECHOPGM(str)         Serial.print(F(str))
220
   #define SERIAL_ECHOPGM(str)         Serial.print(F(str))
201
-  #define SERIAL_ECHO_MSG(str)        Serial.println(str)
202
-  #define SERIAL_ECHOLNPAIR(str, val) do{ Serial.print(F(str)); Serial.println(val); }while(0)
221
+  #define SERIAL_ECHO_MSG(V...)       SERIAL_ECHOLNPAIR(V)
222
+  #define SERIAL_ECHOLNPAIR(V...)     _SELP_N(NUM_ARGS(V),V)
203
   #define SERIAL_ECHOPAIR(str, val)   do{ Serial.print(F(str)); Serial.print(val); }while(0)
223
   #define SERIAL_ECHOPAIR(str, val)   do{ Serial.print(F(str)); Serial.print(val); }while(0)
204
 
224
 
205
   #define safe_delay delay
225
   #define safe_delay delay

+ 12
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.cpp View File

26
 CommandProcessor::btn_style_func_t  *CommandProcessor::_btn_style_callback = CommandProcessor::default_button_style_func;
26
 CommandProcessor::btn_style_func_t  *CommandProcessor::_btn_style_callback = CommandProcessor::default_button_style_func;
27
 bool CommandProcessor::is_tracking = false;
27
 bool CommandProcessor::is_tracking = false;
28
 
28
 
29
+uint32_t CommandProcessor::memcrc(uint32_t ptr, uint32_t num) {
30
+  const uint16_t x = CLCD::mem_read_16(CLCD::REG::CMD_WRITE);
31
+  memcrc(ptr, num, 0);
32
+  wait();
33
+  return CLCD::mem_read_32(CLCD::MAP::RAM_CMD + x + 12);
34
+}
35
+
36
+bool CommandProcessor::wait() {
37
+  while (is_processing() && !has_fault()) { /* nada */ }
38
+  return !has_fault();
39
+}
40
+
29
 #endif // FTDI_EXTENDED
41
 #endif // FTDI_EXTENDED

+ 3
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/command_processor.h View File

146
       return *this;
146
       return *this;
147
     }
147
     }
148
 
148
 
149
+    bool wait();
150
+    uint32_t memcrc(uint32_t ptr, uint32_t num);
151
+
149
     // Wrap all the CommandFifo routines to allow method chaining
152
     // Wrap all the CommandFifo routines to allow method chaining
150
 
153
 
151
     inline CommandProcessor& cmd      (uint32_t cmd32)            {CLCD::CommandFifo::cmd(cmd32); return *this;}
154
     inline CommandProcessor& cmd      (uint32_t cmd32)            {CLCD::CommandFifo::cmd(cmd32); return *this;}

+ 8
- 6
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/grid_layout.h View File

47
   #define MARGIN_DEFAULT   3
47
   #define MARGIN_DEFAULT   3
48
 #endif
48
 #endif
49
 
49
 
50
-// EDGE_R adds some black space on the right edge of the display
51
-// This shifts some of the screens left to visually center them.
50
+// The EDGE variables adds some space on the edges of the display
52
 
51
 
52
+#define EDGE_T           0
53
+#define EDGE_B           0
54
+#define EDGE_L           0
53
 #define EDGE_R           0
55
 #define EDGE_R           0
54
 
56
 
55
 // GRID_X and GRID_Y computes the positions of the divisions on
57
 // GRID_X and GRID_Y computes the positions of the divisions on
56
 // the layout grid.
58
 // the layout grid.
57
-#define GRID_X(x)        ((x)*(FTDI::display_width-EDGE_R)/GRID_COLS)
58
-#define GRID_Y(y)        ((y)*FTDI::display_height/GRID_ROWS)
59
+#define GRID_X(x)        ((x)*(FTDI::display_width-EDGE_R-EDGE_L)/GRID_COLS+EDGE_L)
60
+#define GRID_Y(y)        ((y)*(FTDI::display_height-EDGE_B-EDGE_T)/GRID_ROWS+EDGE_T)
59
 
61
 
60
 // BTN_X, BTN_Y, BTN_W and BTN_X returns the top-left and width
62
 // BTN_X, BTN_Y, BTN_W and BTN_X returns the top-left and width
61
 // and height of a button, taking into account the button margins.
63
 // and height of a button, taking into account the button margins.
62
 
64
 
63
 #define BTN_X(x)         (GRID_X((x)-1) + MARGIN_L)
65
 #define BTN_X(x)         (GRID_X((x)-1) + MARGIN_L)
64
 #define BTN_Y(y)         (GRID_Y((y)-1) + MARGIN_T)
66
 #define BTN_Y(y)         (GRID_Y((y)-1) + MARGIN_T)
65
-#define BTN_W(w)         (GRID_X(w)   - MARGIN_L - MARGIN_R)
66
-#define BTN_H(h)         (GRID_Y(h)   - MARGIN_T - MARGIN_B)
67
+#define BTN_W(w)         (GRID_X(w) - GRID_X(0) - MARGIN_L - MARGIN_R)
68
+#define BTN_H(h)         (GRID_Y(h) - GRID_Y(0) - MARGIN_T - MARGIN_B)
67
 
69
 
68
 // Abbreviations for common phrases, to allow a button to be
70
 // Abbreviations for common phrases, to allow a button to be
69
 // defined in one line of source.
71
 // defined in one line of source.

+ 6
- 4
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.cpp View File

86
       if (font == 26) break;
86
       if (font == 26) break;
87
     }
87
     }
88
 
88
 
89
-    const uint16_t dx = (options & OPT_RIGHTX) ? w : (options & OPT_CENTERX) ? w/2 : 0;
90
-    const uint16_t dy = (options & OPT_CENTERY) ? (h - box_height)/2 : 0;
89
+    const uint16_t dx = (options & OPT_RIGHTX) ? w :
90
+                        (options & OPT_CENTERX) ? w/2 : 0;
91
+    const uint16_t dy = (options & OPT_BOTTOMY) ? (h - box_height) :
92
+                        (options & OPT_CENTERY) ? (h - box_height)/2 : 0;
91
 
93
 
92
     const char *line_start = str;
94
     const char *line_start = str;
93
     const char *line_end;
95
     const char *line_end;
105
 
107
 
106
         #if ENABLED(TOUCH_UI_USE_UTF8)
108
         #if ENABLED(TOUCH_UI_USE_UTF8)
107
           if (has_utf8_chars(line)) {
109
           if (has_utf8_chars(line)) {
108
-            draw_utf8_text(cmd, x + dx, y + dy, line, fm.fs, options & ~OPT_CENTERY);
110
+            draw_utf8_text(cmd, x + dx, y + dy, line, fm.fs, options & ~(OPT_CENTERY | OPT_BOTTOMY));
109
           } else
111
           } else
110
         #endif
112
         #endif
111
           {
113
           {
112
-            cmd.CLCD::CommandFifo::text(x + dx, y + dy, font, options & ~OPT_CENTERY);
114
+            cmd.CLCD::CommandFifo::text(x + dx, y + dy, font, options & ~(OPT_CENTERY | OPT_BOTTOMY));
113
             cmd.CLCD::CommandFifo::str(line);
115
             cmd.CLCD::CommandFifo::str(line);
114
           }
116
           }
115
       }
117
       }

+ 2
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_box.h View File

25
  * This function draws text inside a bounding box, doing word wrapping and using the largest font that will fit.
25
  * This function draws text inside a bounding box, doing word wrapping and using the largest font that will fit.
26
  */
26
  */
27
 namespace FTDI {
27
 namespace FTDI {
28
+  constexpr uint16_t OPT_BOTTOMY      = 0x1000; // Non-standard
29
+
28
   void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31);
30
   void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31);
29
   void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31);
31
   void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31);
30
 }
32
 }

+ 2
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/unicode.cpp View File

138
    */
138
    */
139
 
139
 
140
   void FTDI::load_utf8_bitmaps(CommandProcessor &cmd) {
140
   void FTDI::load_utf8_bitmaps(CommandProcessor &cmd) {
141
+    cmd.cmd(SAVE_CONTEXT());
141
     #ifdef TOUCH_UI_UTF8_CYRILLIC_CHARSET
142
     #ifdef TOUCH_UI_UTF8_CYRILLIC_CHARSET
142
       CyrillicCharSet::load_bitmaps(cmd);
143
       CyrillicCharSet::load_bitmaps(cmd);
143
     #endif
144
     #endif
145
       WesternCharSet::load_bitmaps(cmd);
146
       WesternCharSet::load_bitmaps(cmd);
146
     #endif
147
     #endif
147
     StandardCharSet::load_bitmaps(cmd);
148
     StandardCharSet::load_bitmaps(cmd);
149
+    cmd.cmd(RESTORE_CONTEXT());
148
   }
150
   }
149
 
151
 
150
    /**
152
    /**

+ 0
- 108
Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/scripts/bitmap2cpp.py View File

1
-#!/usr/bin/python
2
-
3
-# Written By Marcio Teixeira 2019 - Aleph Objects, Inc.
4
-#
5
-# This program is free software: you can redistribute it and/or modify
6
-# it under the terms of the GNU General Public License as published by
7
-# the Free Software Foundation, either version 3 of the License, or
8
-# (at your option) any later version.
9
-#
10
-# This program is distributed in the hope that it will be useful,
11
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
-# GNU General Public License for more details.
14
-#
15
-# To view a copy of the GNU General Public License, go to the following
16
-# location: <https://www.gnu.org/licenses/>.
17
-
18
-from __future__ import print_function
19
-from PIL import Image
20
-import argparse
21
-import textwrap
22
-
23
-def pack_rle(data):
24
-  """Use run-length encoding to pack the bytes"""
25
-  rle = []
26
-  value = data[0]
27
-  count = 0
28
-  for i in data:
29
-    if i != value or count == 255:
30
-      rle.append(count)
31
-      rle.append(value)
32
-      value = i
33
-      count = 1
34
-    else:
35
-      count += 1
36
-  rle.append(count)
37
-  rle.append(value)
38
-  return rle
39
-
40
-class WriteSource:
41
-  def __init__(self, lines_in_blocks):
42
-    self.blocks      = []
43
-    self.values      = []
44
-    self.block_size  = lines_in_blocks
45
-    self.rows        = 0
46
-
47
-  def add_pixel(self, value):
48
-    self.values.append(value)
49
-
50
-  def convert_to_4bpp(self, data, chunk_size = 0):
51
-    # Invert the image
52
-    data = list(map(lambda i: 255 - i, data))
53
-    # Quanitize 8-bit values into 4-bits
54
-    data = list(map(lambda i: i >> 4, data))
55
-    # Make sure there is an even number of elements
56
-    if (len(data) & 1) == 1:
57
-      data.append(0)
58
-    # Combine each two adjacent values into one
59
-    i = iter(data)
60
-    data = list(map(lambda a, b: a << 4 | b, i ,i))
61
-    # Pack the data
62
-    data = pack_rle(data)
63
-    # Convert values into hex strings
64
-    return list(map(lambda a: "0x" + format(a, '02x'), data))
65
-
66
-  def end_row(self, y):
67
-    # Pad each row into even number of values
68
-    if len(self.values) & 1:
69
-      self.values.append(0)
70
-
71
-    self.rows += 1
72
-    if self.block_size and (self.rows % self.block_size) == 0:
73
-      self.blocks.append(self.values)
74
-      self.values = []
75
-
76
-  def write(self):
77
-    if len(self.values):
78
-      self.blocks.append(self.values)
79
-
80
-    block_strs = [];
81
-    for b in self.blocks:
82
-      data = self.convert_to_4bpp(b)
83
-      data = ', '.join(data)
84
-      data = textwrap.fill(data, 75, initial_indent = '  ', subsequent_indent = '  ')
85
-      block_strs.append(data)
86
-
87
-    print("const unsigned char font[] PROGMEM = {")
88
-    for i, b in enumerate(block_strs):
89
-      if i:
90
-        print(',')
91
-      print('\n  /* {} */'.format(i))
92
-      print(b, end='')
93
-    print("\n};")
94
-
95
-if __name__ == "__main__":
96
-  parser = argparse.ArgumentParser(description='Converts a grayscale bitmap into a 16-level RLE packed C array for use as font data')
97
-  parser.add_argument("input")
98
-  parser.add_argument('--char_height', help='Adds a separator every so many lines', type=int)
99
-  args = parser.parse_args()
100
-
101
-  writer = WriteSource(args.char_height)
102
-
103
-  img = Image.open(args.input).convert('L')
104
-  for y in range(img.height):
105
-    for x in range(img.width):
106
-      writer.add_pixel(img.getpixel((x,y)))
107
-    writer.end_row(y)
108
-  writer.write()

+ 3
- 1
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp View File

51
        .cmd(COLOR_RGB(bg_text_enabled))
51
        .cmd(COLOR_RGB(bg_text_enabled))
52
        .tag(0);
52
        .tag(0);
53
   }
53
   }
54
+  else
55
+    cmd.colors(normal_btn);
54
 
56
 
55
   cmd.font(font_medium);
57
   cmd.font(font_medium);
56
   _button(cmd, 1,
58
   _button(cmd, 1,
319
   }
321
   }
320
 
322
 
321
   if (_what & FOREGROUND) {
323
   if (_what & FOREGROUND) {
322
-    _button_style(cmd, BTN_TOGGLE);
324
+    _button_style(cmd, is_enabled ? BTN_TOGGLE : BTN_DISABLED);
323
     cmd.tag(is_enabled ? tag   : 0)
325
     cmd.tag(is_enabled ? tag   : 0)
324
        .enabled(is_enabled)
326
        .enabled(is_enabled)
325
        .font(font_small)
327
        .font(font_small)

+ 12
- 7
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens/bed_mesh_base.cpp View File

141
         if (ISVAL(x,y)) {
141
         if (ISVAL(x,y)) {
142
           if (opts & USE_COLORS) {
142
           if (opts & USE_COLORS) {
143
             const float val_dev = sq(VALUE(x, y) - val_mean);
143
             const float val_dev = sq(VALUE(x, y) - val_mean);
144
-            uint8_t r = 0, b = 0;
145
-            //*(VALUE(x, y) < 0 ? &r : &b) = val_dev / sq_min * 0xFF;
146
-            if (VALUE(x, y) < 0)
147
-              r = val_dev / sq_min * 0xFF;
148
-            else
149
-              b = val_dev / sq_max * 0xFF;
150
-            cmd.cmd(COLOR_RGB(0xFF - b, 0xFF - b - r, 0xFF - r));
144
+            float r = 0, b = 0;
145
+            if (sq_min != sq_max) {
146
+              if (VALUE(x, y) < 0)
147
+                r = val_dev / sq_min;
148
+              else
149
+                b = val_dev / sq_max;
150
+            }
151
+            #ifdef BED_MESH_POINTS_GRAY
152
+              cmd.cmd(COLOR_RGB((1.0f - b + r) * 0x7F, (1.0f - b - r) * 0x7F, (1.0f - r + b) * 0x7F));
153
+            #else
154
+              cmd.cmd(COLOR_RGB((1.0f - b) * 0xFF, (1.0f - b - r) * 0xFF, (1.0f - r) * 0xFF));
155
+            #endif
151
           }
156
           }
152
           cmd.cmd(VERTEX2F(TRANSFORM(x, y, HEIGHT(x, y))));
157
           cmd.cmd(VERTEX2F(TRANSFORM(x, y, HEIGHT(x, y))));
153
         }
158
         }

+ 12
- 2
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens/bed_mesh_edit_screen.cpp View File

69
   mydata.zAdjustment = 0;
69
   mydata.zAdjustment = 0;
70
   mydata.savedMeshLevelingState = ExtUI::getLevelingActive();
70
   mydata.savedMeshLevelingState = ExtUI::getLevelingActive();
71
   mydata.savedEndstopState = ExtUI::getSoftEndstopState();
71
   mydata.savedEndstopState = ExtUI::getSoftEndstopState();
72
+  makeMeshValid();
72
   BaseScreen::onEntry();
73
   BaseScreen::onEntry();
73
 }
74
 }
74
 
75
 
76
+void BedMeshEditScreen::makeMeshValid() {
77
+  bed_mesh_t &mesh = ExtUI::getMeshArray();
78
+  GRID_LOOP(x, y) {
79
+    if (isnan(mesh[x][y])) mesh[x][y] = 0;
80
+  }
81
+}
82
+
75
 void BedMeshEditScreen::onExit() {
83
 void BedMeshEditScreen::onExit() {
76
   ExtUI::setLevelingActive(mydata.savedMeshLevelingState);
84
   ExtUI::setLevelingActive(mydata.savedMeshLevelingState);
77
   ExtUI::setSoftEndstopState(mydata.savedEndstopState);
85
   ExtUI::setSoftEndstopState(mydata.savedEndstopState);
121
 void BedMeshEditScreen::drawHighlightedPointValue() {
129
 void BedMeshEditScreen::drawHighlightedPointValue() {
122
   CommandProcessor cmd;
130
   CommandProcessor cmd;
123
   cmd.font(Theme::font_medium)
131
   cmd.font(Theme::font_medium)
124
-     .colors(normal_btn)
132
+     .cmd(COLOR_RGB(bg_text_enabled))
125
      .text(Z_LABEL_POS, GET_TEXT_F(MSG_MESH_EDIT_Z))
133
      .text(Z_LABEL_POS, GET_TEXT_F(MSG_MESH_EDIT_Z))
134
+     .colors(normal_btn)
126
      .font(font_small);
135
      .font(font_small);
127
   if (mydata.highlight.x != NONE)
136
   if (mydata.highlight.x != NONE)
128
     draw_adjuster(cmd, Z_VALUE_POS, 3, getHighlightedValue(), GET_TEXT_F(MSG_UNITS_MM), 4, 3);
137
     draw_adjuster(cmd, Z_VALUE_POS, 3, getHighlightedValue(), GET_TEXT_F(MSG_UNITS_MM), 4, 3);
187
     // After the spinner, go to this screen.
196
     // After the spinner, go to this screen.
188
     current_screen.forget();
197
     current_screen.forget();
189
     PUSH_SCREEN(BedMeshEditScreen);
198
     PUSH_SCREEN(BedMeshEditScreen);
190
-  } else {
199
+  }
200
+  else {
191
     injectCommands_P(PSTR("G29 S1"));
201
     injectCommands_P(PSTR("G29 S1"));
192
     GOTO_SCREEN(BedMeshEditScreen);
202
     GOTO_SCREEN(BedMeshEditScreen);
193
   }
203
   }

+ 1
- 0
Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens/bed_mesh_edit_screen.h View File

32
 
32
 
33
 class BedMeshEditScreen : public BedMeshBase, public CachedScreen<BED_MESH_EDIT_SCREEN_CACHE> {
33
 class BedMeshEditScreen : public BedMeshBase, public CachedScreen<BED_MESH_EDIT_SCREEN_CACHE> {
34
   private:
34
   private:
35
+    static void makeMeshValid();
35
     static float getHighlightedValue();
36
     static float getHighlightedValue();
36
     static void setHighlightedValue(float value);
37
     static void setHighlightedValue(float value);
37
     static void moveToHighlightedValue();
38
     static void moveToHighlightedValue();

Loading…
Cancel
Save