浏览代码

Fixes for TFTGLCD Panel, FastIO (#19614)

Serhiy-K 4 年前
父节点
当前提交
887e2637c0

+ 4
- 4
Marlin/src/HAL/STM32/fastio.h 查看文件

@@ -63,7 +63,7 @@ void FastIO_init(); // Must be called before using fast io macros
63 63
 
64 64
 #define _GET_MODE(IO)
65 65
 #define _SET_MODE(IO,M)         pinMode(IO, M)
66
-#define _SET_OUTPUT(IO)         pinMode(IO, OUTPUT)                               /*!< Output Push Pull Mode & GPIO_NOPULL   */
66
+#define _SET_OUTPUT(IO)         pinMode(IO, OUTPUT)                               //!< Output Push Pull Mode & GPIO_NOPULL
67 67
 #define _SET_OUTPUT_OD(IO)      pinMode(IO, OUTPUT_OPEN_DRAIN)
68 68
 
69 69
 #define WRITE(IO,V)             _WRITE(IO,V)
@@ -73,9 +73,9 @@ void FastIO_init(); // Must be called before using fast io macros
73 73
 #define OUT_WRITE(IO,V)         do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
74 74
 #define OUT_WRITE_OD(IO,V)      do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
75 75
 
76
-#define SET_INPUT(IO)           _SET_MODE(IO, INPUT)                              /*!< Input Floating Mode                   */
77
-#define SET_INPUT_PULLUP(IO)    _SET_MODE(IO, INPUT_PULLUP)                       /*!< Input with Pull-up activation         */
78
-#define SET_INPUT_PULLDOWN(IO)  _SET_MODE(IO, INPUT_PULLDOWN)                     /*!< Input with Pull-down activation       */
76
+#define SET_INPUT(IO)           _SET_MODE(IO, INPUT)                              //!< Input Floating Mode
77
+#define SET_INPUT_PULLUP(IO)    _SET_MODE(IO, INPUT_PULLUP)                       //!< Input with Pull-up activation
78
+#define SET_INPUT_PULLDOWN(IO)  _SET_MODE(IO, INPUT_PULLDOWN)                     //!< Input with Pull-down activation
79 79
 #define SET_OUTPUT(IO)          OUT_WRITE(IO, LOW)
80 80
 #define SET_PWM(IO)             _SET_MODE(IO, PWM)
81 81
 

+ 1
- 1
Marlin/src/core/language.h 查看文件

@@ -303,7 +303,7 @@
303 303
 #define LCD_STR_C STR_C
304 304
 #define LCD_STR_E STR_E
305 305
 
306
-#if HAS_MARLINUI_HD44780
306
+#if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
307 307
 
308 308
   // Custom characters defined in the first 8 characters of the LCD
309 309
   #define LCD_STR_BEDTEMP     "\x00" // Print only as a char. This will have 'unexpected' results when used in a string!

+ 1
- 1
Marlin/src/core/utility.h 查看文件

@@ -71,7 +71,7 @@ public:
71 71
   inline void restore() { ref_ = val_; }
72 72
 };
73 73
 
74
-#define REMEMBER(N,X,V...) restorer<typeof(X)> restorer_##N(X, ##V)
74
+#define REMEMBER(N,X,V...) restorer<__typeof__(X)> restorer_##N(X, ##V)
75 75
 #define RESTORE(N) restorer_##N.restore()
76 76
 
77 77
 // Converts from an uint8_t in the range of 0-255 to an uint8_t

+ 1
- 1
Marlin/src/inc/Conditionals_LCD.h 查看文件

@@ -226,9 +226,9 @@
226 226
     #define LCD_PROGRESS_BAR
227 227
   #endif
228 228
   #if ENABLED(TFTGLCD_PANEL_I2C)
229
-    #define LCD_USE_I2C_BUZZER              // Enable buzzer on LCD for I2C and SPI buses (LiquidTWI2 not required)
230 229
     #define LCD_I2C_ADDRESS           0x27  // Must be equal to panel's I2C slave addres
231 230
   #endif
231
+  #define LCD_USE_I2C_BUZZER                // Enable buzzer on LCD, used for both I2C and SPI buses (LiquidTWI2 not required)
232 232
   #define STD_ENCODER_PULSES_PER_STEP 2
233 233
   #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
234 234
   #define LCD_WIDTH                   20    // 20 or 24 chars in line

+ 1
- 1
Marlin/src/inc/Conditionals_post.h 查看文件

@@ -2457,7 +2457,7 @@
2457 2457
 /**
2458 2458
  * Buzzer/Speaker
2459 2459
  */
2460
-#if PIN_EXISTS(BEEPER) || ANY(LCD_USE_I2C_BUZZER, PCA9632_BUZZER, IS_TFTGLCD_PANEL)
2460
+#if PIN_EXISTS(BEEPER) || ANY(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)
2461 2461
   #define HAS_BUZZER 1
2462 2462
   #if PIN_EXISTS(BEEPER)
2463 2463
     #define USE_BEEPER 1

+ 84
- 139
Marlin/src/lcd/TFTGLCD/ultralcd_TFTGLCD.cpp 查看文件

@@ -32,7 +32,7 @@
32 32
  * and supports color output.
33 33
  */
34 34
 
35
-#if NONE(__AVR__, MCU_LPC1768, __STM32F1__, STM32F4xx)
35
+#if NONE(__AVR__, TARGET_LPC1768, __STM32F1__, STM32F4xx)
36 36
   #warning "Selected platform not yet tested. Please contribute your good pin mappings."
37 37
 #endif
38 38
 
@@ -72,16 +72,17 @@ TFTGLCD lcd;
72 72
 #define ICON_HOT        B01000000    //when any T > 50deg
73 73
 #define PIC_MASK        0x7F
74 74
 
75
-//LEDs not used, for compatibility with Smoothieware
75
+// LEDs not used, for compatibility with Smoothieware
76 76
 #define LED_HOTEND_ON   B00000001
77 77
 #define LED_BED_ON      B00000010
78 78
 #define LED_FAN_ON      B00000100
79 79
 #define LED_HOT         B00001000
80 80
 #define LED_MASK        0x0F
81 81
 
82
-#define FBSIZE      (LCD_WIDTH * LCD_HEIGHT + 2)
82
+#define FBSIZE          (LCD_WIDTH * LCD_HEIGHT + 2)
83
+#define MIDDLE_Y        ((LCD_HEIGHT - 1) / 2)
83 84
 
84
-//markers for change line color
85
+// Markers for change line colors
85 86
 #define COLOR_EDIT      '#'
86 87
 #define COLOR_ERROR     '!'
87 88
 
@@ -114,7 +115,8 @@ enum Commands {         // based on Smoothieware commands
114 115
   GET_LCD_ROW = 0xE0,   // for detect panel
115 116
   GET_LCD_COL,          // reserved for compatibility with Smoothieware, not used
116 117
   LCD_PUT,              // write one line to LCD
117
-  INIT_SCREEN = 0xFE,   // clear panel buffer
118
+  CLR_SCREEN,
119
+  INIT_SCREEN = 0xFE    // clear panel buffer
118 120
 };
119 121
 
120 122
 static unsigned char framebuffer[FBSIZE];
@@ -123,28 +125,62 @@ static uint8_t cour_line;
123 125
 static uint8_t picBits, ledBits, hotBits;
124 126
 static uint8_t PanelDetected = 0;
125 127
 
128
+// Different platforms use different SPI methods
129
+#if ANY(__AVR__, TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
130
+  #define SPI_SEND_ONE(V) SPI.transfer(V);
131
+  #define SPI_SEND_TWO(V) SPI.transfer16(V);
132
+#elif defined(STM32F4xx)
133
+  #define SPI_SEND_ONE(V) SPI.transfer(V, SPI_CONTINUE);
134
+  #define SPI_SEND_TWO(V) SPI.transfer16(V, SPI_CONTINUE);
135
+#elif defined(ARDUINO_ARCH_ESP32)
136
+  #define SPI_SEND_ONE(V) SPI.write(V);
137
+  #define SPI_SEND_TWO(V) SPI.write16(V);
138
+#endif
139
+
140
+#if ANY(__AVR__, ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
141
+  #define SPI_SEND_SOME(V,L,Z)  SPI.transfer(&V[Z], L);
142
+#elif defined(STM32F4xx)
143
+  #define SPI_SEND_SOME(V,L,Z)  SPI.transfer(&V[Z], L, SPI_CONTINUE);
144
+#elif ANY(TARGET_LPC1768, __STM32F1__, ARDUINO_ARCH_ESP32)
145
+  #define SPI_SEND_SOME(V,L,Z)  do{ for (uint16_t i = 0; i < L; i++) SPI_SEND_ONE(V[(Z)+i]); }while(0)
146
+#endif
147
+
126 148
 // Constructor
127 149
 TFTGLCD::TFTGLCD() {}
128 150
 
129
-//clearing local buffer
151
+// Clear local buffer
130 152
 void TFTGLCD::clear_buffer() {
131 153
   memset(&framebuffer[0], ' ', FBSIZE - 2);
132 154
   framebuffer[FBSIZE - 1] = framebuffer[FBSIZE - 2] = 0;
133 155
   picBits = ledBits = 0;
134 156
 }
135 157
 
136
-//set new text cursor position
158
+// Clear panel's screen
159
+void TFTGLCD::clr_screen() {
160
+  if (!PanelDetected) return;
161
+  #if ENABLED(TFTGLCD_PANEL_SPI)
162
+    WRITE(TFTGLCD_CS, LOW);
163
+    SPI_SEND_ONE(CLR_SCREEN);
164
+    WRITE(TFTGLCD_CS, HIGH);
165
+  #else
166
+    Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS);  //set I2C device address
167
+    Wire.write(CLR_SCREEN);
168
+    Wire.endTransmission(); //transmit data
169
+  #endif
170
+}
171
+
172
+// Set new text cursor position
137 173
 void TFTGLCD::setCursor(uint8_t col, uint8_t row) {
138 174
   fb = &framebuffer[0] + col + row * LCD_WIDTH;
139 175
   cour_line = row;
140 176
 }
141 177
 
142
-//send char to buffer
178
+// Send char to buffer
143 179
 void TFTGLCD::write(char c) {
144 180
   *fb++ = c;
145 181
 }
146 182
 
147
-//send text line to buffer
183
+// Send text line to buffer
148 184
 void TFTGLCD::print(const char *line) {
149 185
   while (*line) *fb++ = *line++;
150 186
 }
@@ -154,27 +190,9 @@ void TFTGLCD::print_line() {
154 190
   if (!PanelDetected) return;
155 191
   #if ENABLED(TFTGLCD_PANEL_SPI)
156 192
     WRITE(TFTGLCD_CS, LOW);
157
-    #ifdef __AVR__
158
-      SPI.transfer(LCD_PUT);
159
-      SPI.transfer(cour_line);
160
-      SPI.transfer(&framebuffer[cour_line * LCD_WIDTH], LCD_WIDTH);
161
-    #elif EITHER(MCU_LPC1768, __STM32F1__)
162
-      SPI.transfer(LCD_PUT);
163
-      SPI.transfer(cour_line);
164
-      for (uint16_t i = 0; i < LCD_WIDTH; i++)  SPI.transfer(framebuffer[cour_line * LCD_WIDTH + i]);
165
-    #elif defined(STM32F4xx)
166
-      SPI.transfer(LCD_PUT, SPI_CONTINUE);
167
-      SPI.transfer(cour_line, SPI_CONTINUE);
168
-      SPI.transfer(&framebuffer[cour_line * LCD_WIDTH], LCD_WIDTH, SPI_CONTINUE);
169
-    #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
170
-      SPI.transfer(LCD_PUT);
171
-      SPI.transfer(cour_line);
172
-      SPI.transfer(&framebuffer[cour_line * LCD_WIDTH], LCD_WIDTH);
173
-    #elif defined(ARDUINO_ARCH_ESP32)
174
-      SPI.write(LCD_PUT);
175
-      SPI.write(cour_line);
176
-      for (uint16_t i = 0; i < LCD_WIDTH; i++) SPI.write(framebuffer[cour_line * LCD_WIDTH + i]);
177
-    #endif
193
+    SPI_SEND_ONE(LCD_PUT);
194
+    SPI_SEND_ONE(cour_line);
195
+    SPI_SEND_SOME(framebuffer, LCD_WIDTH, cour_line * LCD_WIDTH);
178 196
     WRITE(TFTGLCD_CS, HIGH);
179 197
   #else
180 198
     Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS);  //set I2C device address
@@ -193,22 +211,8 @@ void TFTGLCD::print_screen(){
193 211
   #if ENABLED(TFTGLCD_PANEL_SPI)
194 212
     // Send all framebuffer to panel
195 213
     WRITE(TFTGLCD_CS, LOW);
196
-    #ifdef __AVR__
197
-      SPI.transfer(LCD_WRITE);
198
-      SPI.transfer(&framebuffer[0], FBSIZE);
199
-    #elif EITHER(MCU_LPC1768, __STM32F1__)
200
-      SPI.transfer(LCD_WRITE);
201
-      for (uint16_t i = 0; i < FBSIZE; i++) SPI.transfer(framebuffer[i]);
202
-    #elif defined(STM32F4xx)
203
-      SPI.transfer(LCD_WRITE, SPI_CONTINUE);
204
-      SPI.transfer(&framebuffer[0], FBSIZE, SPI_CONTINUE);
205
-    #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
206
-      SPI.transfer(LCD_WRITE);
207
-      SPI.transfer(&framebuffer[0], FBSIZE);
208
-    #elif defined(ARDUINO_ARCH_ESP32)
209
-      SPI.write(LCD_WRITE);
210
-      for (uint16_t i = 0; i < FBSIZE; i++) SPI.write(framebuffer[i]);
211
-    #endif
214
+    SPI_SEND_ONE(LCD_WRITE);
215
+    SPI_SEND_SOME(framebuffer, FBSIZE, 0);
212 216
     WRITE(TFTGLCD_CS, HIGH);
213 217
   #else
214 218
     uint8_t r;
@@ -235,19 +239,8 @@ void TFTGLCD::setContrast(uint16_t contrast) {
235 239
   if (!PanelDetected) return;
236 240
   #if ENABLED(TFTGLCD_PANEL_SPI)
237 241
     WRITE(TFTGLCD_CS, LOW);
238
-    #if ANY(__AVR__, MCU_LPC1768, __STM32F1__)
239
-      SPI.transfer(CONTRAST);
240
-      SPI.transfer((uint8_t)contrast);
241
-    #elif defined(STM32F4xx)
242
-      SPI.transfer(CONTRAST, SPI_CONTINUE);
243
-      SPI.transfer((uint8_t)contrast, SPI_CONTINUE);
244
-    #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
245
-      SPI.transfer(CONTRAST);
246
-      SPI.transfer((uint8_t)contrast);
247
-    #elif defined(ARDUINO_ARCH_ESP32)
248
-      SPI.write(CONTRAST);
249
-      SPI.write((uint8_t)contrast);
250
-    #endif
242
+    SPI_SEND_ONE(CONTRAST);
243
+    SPI_SEND_ONE((uint8_t)contrast);
251 244
     WRITE(TFTGLCD_CS, HIGH);
252 245
   #else
253 246
     Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS);
@@ -257,37 +250,24 @@ void TFTGLCD::setContrast(uint16_t contrast) {
257 250
   #endif
258 251
 }
259 252
 
260
-//reading buttons and encoder states
261 253
 extern volatile int8_t encoderDiff;
262 254
 
255
+// Read buttons and encoder states
263 256
 uint8_t MarlinUI::read_slow_buttons(void) {
264 257
   if (!PanelDetected)    return 0;
265 258
   #if ENABLED(TFTGLCD_PANEL_SPI)
266 259
     uint8_t b = 0;
267 260
     WRITE(TFTGLCD_CS, LOW);
268
-    #if ANY(__AVR__, MCU_LPC1768, __STM32F1__)
269
-      SPI.transfer(READ_ENCODER);
270
-      WRITE(TFTGLCD_CS, LOW); //for delay
271
-      encoderDiff += SPI.transfer(READ_BUTTONS);
272
-      WRITE(TFTGLCD_CS, LOW); //for delay
273
-      b = SPI.transfer(GET_SPI_DATA);
274
-    #elif defined(STM32F4xx)
275
-      SPI.transfer(READ_ENCODER, SPI_CONTINUE);
276
-      encoderDiff += SPI.transfer(READ_BUTTONS, SPI_CONTINUE);
277
-      b = SPI.transfer(GET_SPI_DATA, SPI_CONTINUE);
278
-    #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
279
-      SPI.transfer(READ_ENCODER);
280
-      WRITE(TFTGLCD_CS, LOW); //for delay ????
281
-      encoderDiff += SPI.transfer(READ_BUTTONS);
282
-      WRITE(TFTGLCD_CS, LOW); //for delay ????
283
-      b = SPI.transfer(GET_SPI_DATA);
284
-    #elif defined(ARDUINO_ARCH_ESP32)
285
-      SPI.transfer(READ_ENCODER);
286
-      WRITE(TFTGLCD_CS, LOW); //for delay ????
287
-      encoderDiff += SPI.transfer(READ_BUTTONS);
288
-      WRITE(TFTGLCD_CS, LOW); //for delay ????
289
-      b = SPI.transfer(GET_SPI_DATA);
261
+    SPI_SEND_ONE(READ_ENCODER);
262
+    #ifndef STM32F4xx
263
+      WRITE(TFTGLCD_CS, LOW); // for delay
290 264
     #endif
265
+    encoderDiff += SPI_SEND_ONE(READ_BUTTONS);
266
+    #ifndef STM32F4xx
267
+      WRITE(TFTGLCD_CS, LOW); // for delay
268
+      WRITE(TFTGLCD_CS, LOW);
269
+    #endif
270
+    b = SPI_SEND_ONE(GET_SPI_DATA);
291 271
     WRITE(TFTGLCD_CS, HIGH);
292 272
     return b;
293 273
   #else
@@ -298,7 +278,7 @@ uint8_t MarlinUI::read_slow_buttons(void) {
298 278
       Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 2, 0, 0, 1);
299 279
     #elif defined(__STM32F1__)
300 280
       Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, (uint8_t)2);
301
-    #elif EITHER(STM32F4xx, MCU_LPC1768)
281
+    #elif EITHER(STM32F4xx, TARGET_LPC1768)
302 282
       Wire.requestFrom(LCD_I2C_ADDRESS, 2);
303 283
     #endif
304 284
     encoderDiff += Wire.read();
@@ -306,28 +286,14 @@ uint8_t MarlinUI::read_slow_buttons(void) {
306 286
   #endif
307 287
 }
308 288
 
309
-// duration in ms, freq in Hz
289
+// Duration in ms, freq in Hz
310 290
 void MarlinUI::buzz(const long duration, const uint16_t freq) {
311 291
   if (!PanelDetected) return;
312 292
   #if ENABLED(TFTGLCD_PANEL_SPI)
313 293
     WRITE(TFTGLCD_CS, LOW);
314
-    #if ANY(__AVR__, MCU_LPC1768, __STM32F1__)
315
-      SPI.transfer(BUZZER);
316
-      SPI.transfer16((uint16_t)duration);
317
-      SPI.transfer16(freq);
318
-    #elif defined(STM32F4xx)
319
-      SPI.transfer(BUZZER, SPI_CONTINUE);
320
-      SPI.transfer16((uint16_t)duration, SPI_CONTINUE);
321
-      SPI.transfer16(freq, SPI_CONTINUE);
322
-    #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
323
-      SPI.transfer(BUZZER);
324
-      SPI.transfer16((uint16_t)duration);
325
-      SPI.transfer16(freq);
326
-    #elif defined(ARDUINO_ARCH_ESP32)
327
-      SPI.write(BUZZER);
328
-      SPI.write16((uint16_t)duration);
329
-      SPI.write16(freq);
330
-    #endif
294
+    SPI_SEND_ONE(BUZZER);
295
+    SPI_SEND_TWO((uint16_t)duration);
296
+    SPI_SEND_TWO(freq);
331 297
     WRITE(TFTGLCD_CS, HIGH);
332 298
   #else
333 299
     Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS);
@@ -346,24 +312,14 @@ void MarlinUI::init_lcd() {
346 312
   t = 0;
347 313
   #if ENABLED(TFTGLCD_PANEL_SPI)
348 314
     // SPI speed must be less 10MHz
349
-    OUT_WRITE(TFTGLCD_CS, HIGH);
315
+    _SET_OUTPUT(TFTGLCD_CS);
316
+    WRITE(TFTGLCD_CS, HIGH);
350 317
     spiInit(TERN(__STM32F1__, SPI_QUARTER_SPEED, SPI_FULL_SPEED));
351 318
     WRITE(TFTGLCD_CS, LOW);
352
-    #if ANY(__AVR__, MCU_LPC1768, __STM32F1__)
353
-      SPI.transfer(GET_LCD_ROW);
354
-      t = SPI.transfer(GET_SPI_DATA);
355
-    #elif defined(STM32F4xx)
356
-      SPI.transfer(GET_LCD_ROW, SPI_CONTINUE);
357
-      t = SPI.transfer(GET_SPI_DATA, SPI_CONTINUE);
358
-    #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
359
-      SPI.transfer(GET_LCD_ROW);
360
-      t = SPI.transfer(GET_SPI_DATA);
361
-    #elif defined(ARDUINO_ARCH_ESP32)
362
-      SPI.write(GET_LCD_ROW);
363
-      t = SPI.transfer(GET_SPI_DATA);
364
-    #endif
319
+    SPI_SEND_ONE(GET_LCD_ROW);
320
+    t = SPI_SEND_ONE(GET_SPI_DATA);
365 321
   #else
366
-    #ifdef MCU_LPC1768
322
+    #ifdef TARGET_LPC1768
367 323
       Wire.begin();   //init twi/I2C
368 324
     #else
369 325
       Wire.begin((uint8_t)LCD_I2C_ADDRESS); //init twi/I2C
@@ -373,7 +329,7 @@ void MarlinUI::init_lcd() {
373 329
     Wire.endTransmission(); // send buffer
374 330
     #ifdef __AVR__
375 331
       Wire.requestFrom((uint8_t)LCD_I2C_ADDRESS, 1, 0, 0, 1);
376
-    #elif ANY(__STM32F1__, STM32F4xx, MCU_LPC1768)
332
+    #elif ANY(__STM32F1__, STM32F4xx, TARGET_LPC1768)
377 333
       Wire.requestFrom(LCD_I2C_ADDRESS, 1);
378 334
     #endif
379 335
     t = (uint8_t)Wire.read();
@@ -382,20 +338,8 @@ void MarlinUI::init_lcd() {
382 338
   if (t == LCD_HEIGHT) {
383 339
     PanelDetected = 1;
384 340
     #if ENABLED(TFTGLCD_PANEL_SPI)
385
-      PanelDetected = 1;
386
-      #if ANY(__AVR__, MCU_LPC1768, __STM32F1__)
387
-        SPI.transfer(INIT_SCREEN);
388
-        SPI.transfer(Marlin);
389
-      #elif defined(STM32F4xx)
390
-        SPI.transfer(INIT_SCREEN, SPI_CONTINUE);
391
-        SPI.transfer(Marlin, SPI_CONTINUE);
392
-      #elif ANY(ARDUINO_ARCH_SAM, __SAMD51__, __MK20DX256__, __MK64FX512__)
393
-        SPI.transfer(INIT_SCREEN);
394
-        SPI.transfer(Marlin);
395
-      #elif defined(ARDUINO_ARCH_ESP32)
396
-        SPI.write(INIT_SCREEN);
397
-        SPI.write(Marlin);
398
-      #endif
341
+      SPI_SEND_ONE(INIT_SCREEN);
342
+      SPI_SEND_ONE(Marlin);
399 343
       WRITE(TFTGLCD_CS, HIGH);
400 344
     #else
401 345
       Wire.beginTransmission((uint8_t)LCD_I2C_ADDRESS);
@@ -415,8 +359,8 @@ bool MarlinUI::detected() {
415 359
 
416 360
 void MarlinUI::clear_lcd() {
417 361
   if (!PanelDetected) return;
362
+  lcd.clr_screen();
418 363
   lcd.clear_buffer();
419
-  lcd.print_screen();
420 364
 }
421 365
 
422 366
 int16_t MarlinUI::contrast; // Initialized by settings.load()
@@ -583,10 +527,10 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char *p
583 527
       lcd.write('%'); lcd.write(percent);
584 528
     }
585 529
     else { // For progress bar test
586
-      lcd.setCursor(LCD_WIDTH / 2 - 2, LCD_HEIGHT / 2 - 2);
530
+      lcd.setCursor(LCD_WIDTH / 2 - 2, MIDDLE_Y);
587 531
       lcd.print(i16tostr3rj(percent));  lcd.write('%');
588 532
       lcd.print_line();
589
-      lcd.setCursor(0, LCD_HEIGHT / 2 - 1);
533
+      lcd.setCursor(0, MIDDLE_Y + 1);
590 534
       lcd.write('%'); lcd.write(percent);
591 535
       lcd.print_line();
592 536
     }
@@ -912,16 +856,17 @@ void MarlinUI::draw_status_screen() {
912 856
   }
913 857
 
914 858
   // Low-level draw_edit_screen can be used to draw an edit screen from anyplace
859
+  // This line moves to the last line of the screen for UBL plot screen on the panel side
915 860
   void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
916 861
     if (!PanelDetected) return;
917 862
     ui.encoder_direction_normal();
918
-    lcd.setCursor(0, LCD_HEIGHT - 1);  //last line is free most time
863
+    lcd.setCursor(0, MIDDLE_Y);
919 864
     lcd.write(COLOR_EDIT);
920 865
     lcd_put_u8str_P(pstr);
921 866
     if (value != nullptr) {
922 867
       lcd.write(':');
923
-      lcd.setCursor((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), LCD_HEIGHT - 1);  // Right-justified, padded by spaces
924
-      lcd.write(' ');                                                // Overwrite char if value gets shorter
868
+      lcd.setCursor((LCD_WIDTH - 1) - (utf8_strlen(value) + 1), MIDDLE_Y);  // Right-justified, padded by spaces
869
+      lcd.write(' ');     // Overwrite char if value gets shorter
925 870
       lcd.print(value);
926 871
       lcd.write(' ');
927 872
       lcd.print_line();
@@ -932,10 +877,10 @@ void MarlinUI::draw_status_screen() {
932 877
   void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) {
933 878
     if (!PanelDetected) return;
934 879
     ui.draw_select_screen_prompt(pref, string, suff);
935
-    lcd.setCursor(0, LCD_HEIGHT - 1);
880
+    lcd.setCursor(0, MIDDLE_Y);
936 881
     lcd.write(COLOR_EDIT);
937 882
     lcd.write(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd.write(yesno ? ' ' : ']');
938
-    lcd.setCursor(LCD_WIDTH - utf8_strlen_P(yes) - 3, LCD_HEIGHT - 1);
883
+    lcd.setCursor(LCD_WIDTH - utf8_strlen_P(yes) - 3, MIDDLE_Y);
939 884
     lcd.write(yesno ? '[' : ' '); lcd_put_u8str_P(yes); lcd.write(yesno ? ']' : ' ');
940 885
     lcd.print_line();
941 886
   }

+ 1
- 0
Marlin/src/lcd/TFTGLCD/ultralcd_TFTGLCD.h 查看文件

@@ -45,6 +45,7 @@ class TFTGLCD {
45 45
   public:
46 46
     TFTGLCD();
47 47
     void clear_buffer();
48
+    void clr_screen();
48 49
     void setCursor(uint8_t col, uint8_t row);
49 50
     void write(char c);
50 51
     void print(const char *line);

+ 1
- 1
Marlin/src/lcd/menu/menu_advanced.cpp 查看文件

@@ -490,7 +490,7 @@ void menu_backlash();
490 490
       #if ENABLED(PROBE_OFFSET_WIZARD)
491 491
         SUBMENU(MSG_PROBE_WIZARD, goto_probe_offset_wizard);
492 492
       #endif
493
-      
493
+
494 494
       END_MENU();
495 495
     }
496 496
   #endif

+ 8
- 8
Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h 查看文件

@@ -223,14 +223,14 @@
223 223
 #endif
224 224
 
225 225
 /**
226
- *              _____                                             _____
227
- *          NC | · · | GND                                    5V | · · | GND
228
- *       RESET | · · | 1.31(SD_DETECT)             (LCD_D7) 1.23 | · · | 1.22 (LCD_D6)
229
- *  (MOSI)0.18 | · · | 3.25(BTN_EN2)               (LCD_D5) 1.21 | · · | 1.20 (LCD_D4)
230
- * (SD_SS)0.16 | · · | 3.26(BTN_EN1)               (LCD_RS) 1.19 | · · | 1.18 (LCD_EN)
231
- *   (SCK)0.15 | · · | 0.17(MISO)                 (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
232
- *              -----                                             -----
233
- *              EXP2                                              EXP1
226
+ *               _____                                             _____
227
+ *           NC | · · | GND                                    5V | · · | GND
228
+ *        RESET | · · | 1.31 (SD_DETECT)            (LCD_D7) 1.23 | · · | 1.22 (LCD_D6)
229
+ *  (MOSI) 0.18 | · · | 3.25 (BTN_EN2)              (LCD_D5) 1.21 | · · | 1.20 (LCD_D4)
230
+ * (SD_SS) 0.16 | · · | 3.26 (BTN_EN1)              (LCD_RS) 1.19 | · · | 1.18 (LCD_EN)
231
+ *   (SCK) 0.15 | · · | 0.17 (MISO)                (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
232
+ *               -----                                             -----
233
+ *               EXP2                                              EXP1
234 234
  */
235 235
 #if HAS_WIRED_LCD
236 236
   #if ENABLED(ANET_FULL_GRAPHICS_LCD)

+ 1
- 1
Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h 查看文件

@@ -92,7 +92,7 @@
92 92
 //
93 93
 // LCD / Controller
94 94
 //
95
-#if HAS_WIRED_LCD
95
+#if HAS_WIRED_LCD && DISABLED(LCD_USE_I2C_BUZZER)
96 96
   #define BEEPER_PIN                       P1_30  // (37) not 5V tolerant
97 97
 #endif
98 98
 

+ 3
- 0
Marlin/src/pins/stm32f0/pins_MALYAN_M300.h 查看文件

@@ -33,6 +33,9 @@
33 33
 //
34 34
 #if NO_EEPROM_SELECTED
35 35
   #define FLASH_EEPROM_EMULATION
36
+  #ifndef MARLIN_EEPROM_SIZE
37
+    #define MARLIN_EEPROM_SIZE 0x800U             // 2KB
38
+  #endif
36 39
 #endif
37 40
 
38 41
 //

+ 1
- 0
Marlin/src/pins/stm32f1/pins_MORPHEUS.h 查看文件

@@ -89,3 +89,4 @@
89 89
 //
90 90
 #define LED_PIN                             PC13
91 91
 #define SDSS                                PA3
92
+#define TFTGLCD_CS                          PA4

正在加载...
取消
保存