Browse Source

MarlinUI for SPI/I2C TFT-GLCD character-based display bridge (#19375)

Serhiy-K 3 years ago
parent
commit
27bdf4b24e
No account linked to committer's email address
31 changed files with 2519 additions and 56 deletions
  1. 8
    0
      Marlin/Configuration.h
  2. 2
    2
      Marlin/Configuration_adv.h
  3. 4
    0
      Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
  4. 24
    0
      Marlin/src/inc/Conditionals_LCD.h
  5. 5
    1
      Marlin/src/inc/Conditionals_post.h
  6. 5
    3
      Marlin/src/inc/SanityCheck.h
  7. 1142
    0
      Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp
  8. 1018
    0
      Marlin/src/lcd/TFTGLCD/ultralcd_TFTGLCD.cpp
  9. 74
    0
      Marlin/src/lcd/TFTGLCD/ultralcd_TFTGLCD.h
  10. 6
    2
      Marlin/src/lcd/menu/menu_ubl.cpp
  11. 10
    4
      Marlin/src/lcd/ultralcd.cpp
  12. 3
    3
      Marlin/src/lcd/ultralcd.h
  13. 13
    3
      Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h
  14. 8
    0
      Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h
  15. 8
    0
      Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
  16. 13
    2
      Marlin/src/pins/lpc1768/pins_MKS_SBASE.h
  17. 9
    0
      Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h
  18. 9
    0
      Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
  19. 10
    1
      Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h
  20. 33
    26
      Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h
  21. 3
    0
      Marlin/src/pins/pinsDebug_list.h
  22. 8
    0
      Marlin/src/pins/ramps/pins_RAMPS.h
  23. 1
    3
      Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h
  24. 42
    4
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h
  25. 11
    0
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
  26. 6
    0
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h
  27. 13
    0
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
  28. 7
    0
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h
  29. 8
    1
      Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h
  30. 14
    0
      buildroot/tests/LPC1769-tests
  31. 2
    1
      platformio.ini

+ 8
- 0
Marlin/Configuration.h View File

@@ -1957,6 +1957,14 @@
1957 1957
 //
1958 1958
 //#define FF_INTERFACEBOARD
1959 1959
 
1960
+//
1961
+// TFT GLCD Panel with Marlin UI
1962
+// Panel connected to main board by SPI or I2C interface.
1963
+// See https://github.com/Serhiy-K/TFTGLCDAdapter
1964
+//
1965
+//#define TFTGLCD_PANEL_SPI
1966
+//#define TFTGLCD_PANEL_I2C
1967
+
1960 1968
 //=============================================================================
1961 1969
 //=======================   LCD / Controller Selection  =======================
1962 1970
 //=========================      (Graphical LCDs)      ========================

+ 2
- 2
Marlin/Configuration_adv.h View File

@@ -1106,7 +1106,7 @@
1106 1106
   #define BOOTSCREEN_TIMEOUT 4000        // (ms) Total Duration to display the boot screen(s)
1107 1107
 #endif
1108 1108
 
1109
-#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && (HAS_MARLINUI_U8GLIB || HAS_MARLINUI_HD44780)
1109
+#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
1110 1110
   //#define SHOW_REMAINING_TIME       // Display estimated time to completion
1111 1111
   #if ENABLED(SHOW_REMAINING_TIME)
1112 1112
     //#define USE_M73_REMAINING_TIME  // Use remaining time from M73 command instead of estimation
@@ -1117,7 +1117,7 @@
1117 1117
     //#define PRINT_PROGRESS_SHOW_DECIMALS // Show progress with decimal digits
1118 1118
   #endif
1119 1119
 
1120
-  #if HAS_MARLINUI_HD44780
1120
+  #if EITHER(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
1121 1121
     //#define LCD_PROGRESS_BAR            // Show a progress bar on HD44780 LCDs for SD printing
1122 1122
     #if ENABLED(LCD_PROGRESS_BAR)
1123 1123
       #define PROGRESS_BAR_BAR_TIME 2000  // (ms) Amount of time to show the bar

+ 4
- 0
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -997,6 +997,10 @@
997 997
 
998 998
         if (do_ubl_mesh_map) display_map(g29_map_type);     // Display the current point
999 999
 
1000
+        #if IS_TFTGLCD_PANEL
1001
+          ui.ubl_plot(lpos.x, lpos.y);   // update plot screen
1002
+        #endif
1003
+
1000 1004
         ui.refresh();
1001 1005
 
1002 1006
         float new_z = z_values[lpos.x][lpos.y];

+ 24
- 0
Marlin/src/inc/Conditionals_LCD.h View File

@@ -217,6 +217,28 @@
217 217
   #define LCD_WIDTH 16
218 218
   #define LCD_HEIGHT 2
219 219
 
220
+#elif EITHER(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C)
221
+
222
+  #define IS_TFTGLCD_PANEL 1
223
+  #define IS_ULTIPANEL                      // Note that IS_ULTIPANEL leads to HAS_WIRED_LCD
224
+
225
+  #if ENABLED(SDSUPPORT) && DISABLED(LCD_PROGRESS_BAR)
226
+    #define LCD_PROGRESS_BAR
227
+  #endif
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
+    #define LCD_I2C_ADDRESS           0x27  // Must be equal to panel's I2C slave addres
231
+  #endif
232
+  #define STD_ENCODER_PULSES_PER_STEP 2
233
+  #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
234
+  #define LCD_WIDTH                   20    // 20 or 24 chars in line
235
+  #define LCD_HEIGHT                  10    // Character lines
236
+  #define LCD_CONTRAST_MIN            127
237
+  #define LCD_CONTRAST_MAX            255
238
+  #define DEFAULT_LCD_CONTRAST        250
239
+  #define CONVERT_TO_EXT_ASCII        // Use extended 128-255 symbols from ASCII table.
240
+                                      // At this time present conversion only for cyrillic - bg, ru and uk languages.
241
+                                      // First 7 ASCII symbols in panel font must be replaced with Marlin's special symbols.
220 242
 #endif
221 243
 
222 244
 #if ENABLED(IS_RRD_FG_SC)
@@ -459,6 +481,8 @@
459 481
   #define HAS_WIRED_LCD 1
460 482
   #if ENABLED(DOGLCD)
461 483
     #define HAS_MARLINUI_U8GLIB 1
484
+  #elif IS_TFTGLCD_PANEL
485
+    // Neither DOGM nor HD44780. Fully customized interface.
462 486
   #elif DISABLED(HAS_GRAPHICAL_TFT)
463 487
     #define HAS_MARLINUI_HD44780 1
464 488
   #endif

+ 5
- 1
Marlin/src/inc/Conditionals_post.h View File

@@ -318,6 +318,10 @@
318 318
   #define _LCD_CONTRAST_MIN   64
319 319
   #define _LCD_CONTRAST_INIT 128
320 320
   #define _LCD_CONTRAST_MAX  255
321
+#elif IS_TFTGLCD_PANEL
322
+  #define _LCD_CONTRAST_MIN    0
323
+  #define _LCD_CONTRAST_INIT 250
324
+  #define _LCD_CONTRAST_MAX  255
321 325
 #endif
322 326
 
323 327
 #ifdef _LCD_CONTRAST_INIT
@@ -2453,7 +2457,7 @@
2453 2457
 /**
2454 2458
  * Buzzer/Speaker
2455 2459
  */
2456
-#if PIN_EXISTS(BEEPER) || EITHER(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)
2460
+#if PIN_EXISTS(BEEPER) || ANY(LCD_USE_I2C_BUZZER, PCA9632_BUZZER, IS_TFTGLCD_PANEL)
2457 2461
   #define HAS_BUZZER 1
2458 2462
   #if PIN_EXISTS(BEEPER)
2459 2463
     #define USE_BEEPER 1

+ 5
- 3
Marlin/src/inc/SanityCheck.h View File

@@ -693,8 +693,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
693 693
 #if ENABLED(LCD_PROGRESS_BAR)
694 694
   #if NONE(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
695 695
     #error "LCD_PROGRESS_BAR requires SDSUPPORT or LCD_SET_PROGRESS_MANUALLY."
696
-  #elif !HAS_MARLINUI_HD44780
697
-    #error "LCD_PROGRESS_BAR requires a character LCD."
696
+  #elif NONE(HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
697
+    #error "LCD_PROGRESS_BAR only applies to HD44780 character LCD and TFTGLCD_PANEL_(SPI|I2C)."
698 698
   #elif HAS_MARLINUI_U8GLIB
699 699
     #error "LCD_PROGRESS_BAR does not apply to graphical displays."
700 700
   #elif ENABLED(FILAMENT_LCD_DISPLAY)
@@ -2274,7 +2274,9 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2274 2274
   + ENABLED(TFT_LVGL_UI_FSMC) \
2275 2275
   + ENABLED(TFT_LVGL_UI_SPI) \
2276 2276
   + ENABLED(ANYCUBIC_LCD_I3MEGA) \
2277
-  + ENABLED(ANYCUBIC_LCD_CHIRON)
2277
+  + ENABLED(ANYCUBIC_LCD_CHIRON) \
2278
+  + ENABLED(TFTGLCD_PANEL_SPI) \
2279
+  + ENABLED(TFTGLCD_PANEL_I2C)
2278 2280
   #error "Please select only one LCD controller option."
2279 2281
 #endif
2280 2282
 

+ 1142
- 0
Marlin/src/lcd/TFTGLCD/lcdprint_TFTGLCD.cpp
File diff suppressed because it is too large
View File


+ 1018
- 0
Marlin/src/lcd/TFTGLCD/ultralcd_TFTGLCD.cpp
File diff suppressed because it is too large
View File


+ 74
- 0
Marlin/src/lcd/TFTGLCD/ultralcd_TFTGLCD.h View File

@@ -0,0 +1,74 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+/**
25
+ * Implementation of the LCD display routines for a TFT GLCD displays with external controller.
26
+ */
27
+
28
+#include "../../inc/MarlinConfig.h"
29
+
30
+#if IS_TFTGLCD_PANEL
31
+
32
+#include "../../libs/duration_t.h"
33
+
34
+////////////////////////////////////
35
+// Set up button and encode mappings for each panel (into 'buttons' variable)
36
+//
37
+// This is just to map common functions (across different panels) onto the same
38
+// macro name. The mapping is independent of whether the button is directly connected or
39
+// via a shift/i2c register.
40
+
41
+////////////////////////////////////
42
+// Create LCD class instance and chipset-specific information
43
+class TFTGLCD {
44
+  private:
45
+  public:
46
+    TFTGLCD();
47
+    void clear_buffer();
48
+    void setCursor(uint8_t col, uint8_t row);
49
+    void write(char c);
50
+    void print(const char *line);
51
+    void print_line();
52
+    void print_screen();
53
+    void redraw_screen();
54
+    void setContrast(uint16_t contrast);
55
+};
56
+
57
+extern TFTGLCD lcd;
58
+
59
+#include "../fontutils.h"
60
+#include "../lcdprint.h"
61
+
62
+// Use panel encoder - free old encoder pins
63
+#undef  BTN_EN1
64
+#undef  BTN_EN2
65
+#undef  BTN_ENC
66
+#define BTN_EN1     -1
67
+#define BTN_EN2     -1
68
+#define BTN_ENC     -1
69
+
70
+#ifndef EN_C
71
+  #define EN_C       4 //for click
72
+#endif
73
+
74
+#endif // IS_TFTGLCD_PANEL

+ 6
- 2
Marlin/src/lcd/menu/menu_ubl.cpp View File

@@ -59,10 +59,14 @@ inline float rounded_mesh_value() {
59 59
 static void _lcd_mesh_fine_tune(PGM_P const msg) {
60 60
   ui.defer_status_screen();
61 61
   if (ubl.encoder_diff) {
62
-    mesh_edit_accumulator += ubl.encoder_diff > 0 ? 0.005f : -0.005f;
62
+    mesh_edit_accumulator += TERN(IS_TFTGLCD_PANEL,
63
+      ubl.encoder_diff * 0.005f / ENCODER_PULSES_PER_STEP,
64
+      ubl.encoder_diff > 0 ? 0.005f : -0.005f
65
+    );
63 66
     ubl.encoder_diff = 0;
64
-    ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);
67
+    TERN(IS_TFTGLCD_PANEL,,ui.refresh(LCDVIEW_CALL_REDRAW_NEXT));
65 68
   }
69
+  TERN_(IS_TFTGLCD_PANEL, ui.refresh(LCDVIEW_CALL_REDRAW_NEXT));
66 70
 
67 71
   if (ui.should_draw()) {
68 72
     const float rounded_f = rounded_mesh_value();

+ 10
- 4
Marlin/src/lcd/ultralcd.cpp View File

@@ -506,7 +506,7 @@ bool MarlinUI::get_blink() {
506 506
  * This is very display-dependent, so the lcd implementation draws this.
507 507
  */
508 508
 
509
-#if ENABLED(LCD_PROGRESS_BAR)
509
+#if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
510 510
   millis_t MarlinUI::progress_bar_ms; // = 0
511 511
   #if PROGRESS_MSG_EXPIRE > 0
512 512
     millis_t MarlinUI::expire_status_ms; // = 0
@@ -517,7 +517,7 @@ void MarlinUI::status_screen() {
517 517
 
518 518
   TERN_(HAS_LCD_MENU, ENCODER_RATE_MULTIPLY(false));
519 519
 
520
-  #if ENABLED(LCD_PROGRESS_BAR)
520
+  #if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
521 521
 
522 522
     //
523 523
     // HD44780 implements the following message blinking and
@@ -915,7 +915,7 @@ void MarlinUI::update() {
915 915
 
916 916
       const bool encoderPastThreshold = (abs_diff >= epps);
917 917
       if (encoderPastThreshold || lcd_clicked) {
918
-        if (encoderPastThreshold) {
918
+        if (encoderPastThreshold && TERN1(IS_TFTGLCD_PANEL, !external_control)) {
919 919
 
920 920
           #if BOTH(HAS_LCD_MENU, ENCODER_RATE_MULTIPLIER)
921 921
 
@@ -1260,6 +1260,12 @@ void MarlinUI::update() {
1260 1260
         TERN(REPRAPWORLD_KEYPAD, keypad_buttons, buttons) = ~val;
1261 1261
       #endif
1262 1262
 
1263
+      #if IS_TFTGLCD_PANEL
1264
+        next_button_update_ms = now + (LCD_UPDATE_INTERVAL / 2);
1265
+        buttons = slow_buttons;
1266
+        TERN_(AUTO_BED_LEVELING_UBL, external_encoder());
1267
+      #endif
1268
+
1263 1269
     } // next_button_update_ms
1264 1270
 
1265 1271
     #if HAS_ENCODER_WHEEL
@@ -1331,7 +1337,7 @@ void MarlinUI::update() {
1331 1337
       const millis_t ms = millis();
1332 1338
     #endif
1333 1339
 
1334
-    #if ENABLED(LCD_PROGRESS_BAR)
1340
+    #if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
1335 1341
       progress_bar_ms = ms;
1336 1342
       #if PROGRESS_MSG_EXPIRE > 0
1337 1343
         expire_status_ms = persist ? 0 : ms + PROGRESS_MSG_EXPIRE;

+ 3
- 3
Marlin/src/lcd/ultralcd.h View File

@@ -34,7 +34,7 @@
34 34
 #if EITHER(HAS_LCD_MENU, ULTIPANEL_FEEDMULTIPLY)
35 35
   #define HAS_ENCODER_ACTION 1
36 36
 #endif
37
-#if (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTONS_EXIST(EN1, EN2)
37
+#if ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTONS_EXIST(EN1, EN2)) && !IS_TFTGLCD_PANEL
38 38
   #define HAS_ENCODER_WHEEL 1
39 39
 #endif
40 40
 #if HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)
@@ -45,7 +45,7 @@
45 45
 #endif
46 46
 
47 47
 // I2C buttons must be read in the main thread
48
-#if EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2)
48
+#if ANY(LCD_I2C_VIKI, LCD_I2C_PANELOLU2, IS_TFTGLCD_PANEL)
49 49
   #define HAS_SLOW_BUTTONS 1
50 50
 #endif
51 51
 
@@ -215,7 +215,7 @@
215 215
 
216 216
 #endif
217 217
 
218
-#if BUTTON_EXISTS(BACK) || HAS_TOUCH_XPT2046
218
+#if BUTTON_EXISTS(BACK) || EITHER(HAS_TOUCH_XPT2046, IS_TFTGLCD_PANEL)
219 219
   #define BLEN_D 3
220 220
   #define EN_D _BV(BLEN_D)
221 221
   #define LCD_BACK_CLICKED() (buttons & EN_D)

+ 13
- 3
Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h View File

@@ -65,7 +65,16 @@
65 65
  * by redrawing the screen after SD card accesses.
66 66
  */
67 67
 
68
-#if HAS_WIRED_LCD
68
+#if IS_TFTGLCD_PANEL
69
+
70
+  #if ENABLED(TFTGLCD_PANEL_SPI)
71
+    #define TFTGLCD_CS                     P3_26
72
+  #endif
73
+
74
+  #define SD_DETECT_PIN                    P1_31
75
+
76
+#elif HAS_WIRED_LCD
77
+
69 78
   #define BTN_EN1                          P3_26
70 79
   #define BTN_EN2                          P3_25
71 80
   #define BTN_ENC                          P2_11
@@ -80,7 +89,8 @@
80 89
     #define DOGLCD_CS                      P2_06
81 90
     #define DOGLCD_A0                      P0_16
82 91
   #endif
83
-#endif
92
+
93
+#endif // HAS_WIRED_LCD
84 94
 
85 95
 //
86 96
 // SD Support
@@ -89,7 +99,7 @@
89 99
 // requires jumpers on the SKR V1.1 board as documented here:
90 100
 // https://www.facebook.com/groups/505736576548648/permalink/630639874058317/
91 101
 #ifndef SDCARD_CONNECTION
92
-  #if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
102
+  #if ANY(MKS_MINI_12864, ENDER2_STOCKDISPLAY, IS_TFTGLCD_PANEL)
93 103
     #define SDCARD_CONNECTION                LCD
94 104
   #else
95 105
     #define SDCARD_CONNECTION            ONBOARD

+ 8
- 0
Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h View File

@@ -265,6 +265,14 @@
265 265
 
266 266
     #error "ADC BUTTONS do not work unmodifed on SKR 1.3, The ADC ports cannot take more than 3.3v."
267 267
 
268
+  #elif IS_TFTGLCD_PANEL
269
+
270
+    #if ENABLED(TFTGLCD_PANEL_SPI)
271
+      #define TFTGLCD_CS            EXPA2_08_PIN
272
+    #endif
273
+
274
+    #define SD_DETECT_PIN           EXPA2_04_PIN
275
+
268 276
   #else                                           // !CR10_STOCKDISPLAY
269 277
 
270 278
     #define LCD_PINS_RS             EXPA1_07_PIN

+ 8
- 0
Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h View File

@@ -309,6 +309,14 @@
309 309
       #define XPT2046_Y_OFFSET             -285
310 310
     #endif
311 311
 
312
+  #elif IS_TFTGLCD_PANEL
313
+
314
+    #if ENABLED(TFTGLCD_PANEL_SPI)
315
+      #define TFTGLCD_CS                   P3_26
316
+    #endif
317
+
318
+    #define SD_DETECT_PIN                  P1_31
319
+
312 320
   #else
313 321
 
314 322
     #define BTN_ENC                        P0_28  // (58) open-drain

+ 13
- 2
Marlin/src/pins/lpc1768/pins_MKS_SBASE.h View File

@@ -217,7 +217,18 @@
217 217
  * that the garbage/lines are erased immediately after the SD card accesses are completed.
218 218
  */
219 219
 
220
-#if HAS_WIRED_LCD
220
+#if IS_TFTGLCD_PANEL
221
+
222
+  #if ENABLED(TFTGLCD_PANEL_SPI)
223
+    #define   TFTGLCD_CS                   P3_25  // EXP2.3
224
+  #endif
225
+
226
+  #if SD_CONNECTION_IS(LCD)
227
+    #define SD_DETECT_PIN                  P0_28  // EXP2.4
228
+  #endif
229
+
230
+#elif HAS_WIRED_LCD
231
+
221 232
   #define BEEPER_PIN                       P1_31  // EXP1.1
222 233
   #define BTN_ENC                          P1_30  // EXP1.2
223 234
   #define BTN_EN1                          P3_26  // EXP2.5
@@ -273,7 +284,7 @@
273 284
     //#define LCD_SCREEN_ROT_270
274 285
   #endif
275 286
 
276
-#endif
287
+#endif // HAS_WIRED_LCD
277 288
 
278 289
 /**
279 290
  * Example for trinamic drivers using the J8 connector on MKs Sbase.

+ 9
- 0
Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h View File

@@ -249,6 +249,15 @@
249 249
     #define LCD_PINS_ENABLE                P1_22
250 250
     #define LCD_PINS_D4                    P0_17
251 251
 
252
+  #elif IS_TFTGLCD_PANEL
253
+
254
+    #undef BEEPER_PIN
255
+    #undef BTN_ENC
256
+
257
+    #if ENABLED(TFTGLCD_PANEL_SPI)
258
+      #define TFTGLCD_CS                   P3_25
259
+    #endif
260
+
252 261
   #else
253 262
 
254 263
     #define BTN_EN1                        P3_25

+ 9
- 0
Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h View File

@@ -326,6 +326,15 @@
326 326
   #define LCD_PINS_ENABLE                  P0_18  // J3-10 & AUX-3 (SID, MOSI)
327 327
   #define LCD_PINS_D4                      P2_06  // J3-8 & AUX-3 (SCK, CLK)
328 328
 
329
+#elif IS_TFTGLCD_PANEL
330
+
331
+  #if ENABLED(TFTGLCD_PANEL_SPI)
332
+    #define TFTGLCD_CS                     P3_26  // (31) J3-2 & AUX-4
333
+  #endif
334
+
335
+  #define SD_DETECT_PIN                    P1_31  // (49) J3-1 & AUX-3 (NOT 5V tolerant)
336
+  #define KILL_PIN                         P1_22  // (41) J5-4 & AUX-4
337
+
329 338
 #elif HAS_WIRED_LCD
330 339
 
331 340
   //#define SCK_PIN                        P0_15  // (52)  system defined J3-9 & AUX-3

+ 10
- 1
Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h View File

@@ -241,7 +241,16 @@
241 241
  *                -----                                            -----
242 242
  *                EXP1                                             EXP2
243 243
  */
244
-#if HAS_WIRED_LCD
244
+#if IS_TFTGLCD_PANEL
245
+
246
+  #if ENABLED(TFTGLCD_PANEL_SPI)
247
+    #define TFTGLCD_CS                     P3_25
248
+  #endif
249
+
250
+  #define SD_DETECT_PIN                    P0_27
251
+
252
+#elif HAS_WIRED_LCD
253
+
245 254
   #define BEEPER_PIN                       P1_31
246 255
   #define BTN_ENC                          P1_30
247 256
 

+ 33
- 26
Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h View File

@@ -111,16 +111,33 @@
111 111
 
112 112
 #elif HAS_WIRED_LCD
113 113
 
114
-  /*
115
-    The Smoothieboard supports the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER with either
116
-    a custom cable with breakouts to the pins indicated below or the RRD GLCD Adapter board
117
-    found at http://smoothieware.org/rrdglcdadapter
118
-
119
-    Other links to information about setting up a display panel with Smoothieboard
120
-    http://chibidibidiwah.wdfiles.com/local--files/panel/smoothieboard2sd.jpg
121
-    http://smoothieware.org/panel
122
-  */
123
-
114
+  /**
115
+   * SD Support
116
+   *
117
+   * For the RRD GLCD it CANNOT share the same SPI as the LCD so it must be
118
+   * hooked up to the onboard SDCard SPI and use a spare pin for the SDCS.
119
+   * Also note that an external SDCard sharing the SPI port with the
120
+   * onboard/internal SDCard must be ejected before rebooting as the bootloader
121
+   * does not like the external card. NOTE Smoothie will not boot if the external
122
+   * sdcard is inserted in the RRD LCD sdcard slot at boot time, it must be
123
+   * inserted after it has booted.
124
+   */
125
+  #define SD_DETECT_PIN                    P0_27  // EXP2 Pin 7 (SD_CD, SD_DET)
126
+
127
+  #define MISO_PIN                         P0_08  // EXP2 Pin 1 (PB3, SD_MISO)
128
+  #define SCK_PIN                          P0_07  // EXP2 Pin 2 (SD_SCK)
129
+  #define SS_PIN                           P0_28  // EXP2 Pin 4 (SD_CSEL, SD_CS)
130
+  #define MOSI_PIN                         P0_09  // EXP2 Pin 6 (PB2, SD_MOSI)
131
+
132
+  /**
133
+   * The Smoothieboard supports the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER with either
134
+   * a custom cable with breakouts to the pins indicated below or the RRD GLCD Adapter board
135
+   * found at http://smoothieware.org/rrdglcdadapter
136
+   *
137
+   * Other links to information about setting up a display panel with Smoothieboard
138
+   * http://chibidibidiwah.wdfiles.com/local--files/panel/smoothieboard2sd.jpg
139
+   * http://smoothieware.org/panel
140
+   */
124 141
   #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
125 142
     //  EXP1 Pins
126 143
     #define BEEPER_PIN                     P1_31  // EXP1 Pin 1
@@ -132,24 +149,14 @@
132 149
     #define BTN_EN2                        P3_26  // EXP2 Pin 3
133 150
     #define BTN_EN1                        P3_25  // EXP2 Pin 5
134 151
 
135
-    /*
136
-      SD Support
137
-
138
-      For the RRD GLCD it CANNOT share the same SPI as the LCD so it must be
139
-      hooked up to the onboard SDCard SPI and use a spare pin for the SDCS.
140
-      Also note that an external SDCard sharing the SPI port with the
141
-      onboard/internal SDCard must be ejected before rebooting as the bootloader
142
-      does not like the external card. NOTE Smoothie will not boot if the external
143
-      sdcard is inserted in the RRD LCD sdcard slot at boot time, it must be
144
-      inserted after it has booted.
145
-    */
146
-
147
-    #define MISO_PIN                       P0_08  // EXP2 Pin 1 (PB3, SD_MISO)
148
-    #define SCK_PIN                        P0_07  // EXP2 Pin 2 (SD_SCK)
149
-    #define SS_PIN                         P0_28  // EXP2 Pin 4 (SD_CSEL, SD_CS)
150
-    #define MOSI_PIN                       P0_09  // EXP2 Pin 6 (PB2, SD_MOSI)
152
+  #elif IS_TFTGLCD_PANEL
153
+
151 154
     #define SD_DETECT_PIN                  P0_27  // EXP2 Pin 7 (SD_CD, SD_DET)
152 155
 
156
+    #if ENABLED(TFTGLCD_PANEL_SPI)
157
+      #define TFTGLCD_CS                   P3_26  // EXP2 Pin 3
158
+    #endif
159
+
153 160
   #else
154 161
     #error "Marlin's Smoothieboard support cannot drive your LCD."
155 162
   #endif

+ 3
- 0
Marlin/src/pins/pinsDebug_list.h View File

@@ -261,6 +261,9 @@
261 261
 #if defined(TMC_SW_SCK) && TMC_SW_SCK >= 0
262 262
   REPORT_NAME_DIGITAL(__LINE__, TMC_SW_SCK)
263 263
 #endif
264
+#if defined(TFTGLCD_CS) && TFTGLCD_CS >= 0
265
+  REPORT_NAME_DIGITAL(__LINE__, TFTGLCD_CS)
266
+#endif
264 267
 #if PIN_EXISTS(E_MUX0)
265 268
   REPORT_NAME_DIGITAL(__LINE__, E_MUX0_PIN)
266 269
 #endif

+ 8
- 0
Marlin/src/pins/ramps/pins_RAMPS.h View File

@@ -450,6 +450,10 @@
450 450
     #define LCD_PINS_D6                       44
451 451
     #define LCD_PINS_D7                       64
452 452
 
453
+  #elif ENABLED(TFTGLCD_PANEL_SPI)
454
+
455
+    #define TFTGLCD_CS                        33
456
+
453 457
   #else
454 458
 
455 459
     #if ENABLED(CR10_STOCKDISPLAY)
@@ -682,6 +686,10 @@
682 686
 
683 687
       // Pins only defined for RAMPS_SMART currently
684 688
 
689
+    #elif IS_TFTGLCD_PANEL
690
+
691
+      #define SD_DETECT_PIN                   49
692
+
685 693
     #else
686 694
 
687 695
       // Beeper on AUX-4

+ 1
- 3
Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h View File

@@ -279,9 +279,7 @@
279 279
 
280 280
 #if SD_CONNECTION_IS(ONBOARD)
281 281
   #define SD_DETECT_PIN                     PC4
282
-#endif
283
-
284
-#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) && SD_CONNECTION_IS(LCD)
282
+#elif SD_CONNECTION_IS(LCD) && BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050)
285 283
   #define SD_DETECT_PIN                     PA15
286 284
   #define SS_PIN                            PA10
287 285
 #elif SD_CONNECTION_IS(CUSTOM_CABLE)

+ 42
- 4
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h View File

@@ -169,8 +169,48 @@
169 169
     #define FORCE_SOFT_SPI
170 170
     #define LCD_BACKLIGHT_PIN               -1
171 171
 
172
+  #elif IS_TFTGLCD_PANEL
173
+
174
+    #if ENABLED(TFTGLCD_PANEL_SPI)
175
+
176
+      #error "CAUTION! TFTGLCD_PANEL_SPI requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue."
177
+
178
+      /**
179
+       * TFTGLCD_PANEL_SPI display pinout
180
+       *
181
+       *               Board                                      Display
182
+       *               _____                                       _____
183
+       *           5V | 1 2 | GND                (SPI1-MISO) MISO | 1 2 | SCK   (SPI1-SCK)
184
+       * (FREE)   PB7 | 3 4 | PB8  (LCD_CS)      (PA9)    GLCD_CS | 3 4 | SD_CS (PA10)
185
+       * (FREE)   PB9 | 5 6 | PA10 (SD_CS)                 (FREE) | 5 6 | MOSI  (SPI1-MOSI)
186
+       *        RESET | 7 8 | PA9  (MOD_RESET)   (PB5)     SD_DET | 7 8 | (FREE)
187
+       * (BEEPER) PB6 | 9 10| PB5  (SD_DET)                   GND | 9 10| 5V
188
+       *               -----                                       -----
189
+       *                EXP1                                        EXP1
190
+       *
191
+       * Needs custom cable:
192
+       *
193
+       *    Board   Adapter   Display
194
+       *           _________
195
+       *   EXP1-1 ----------- EXP1-10
196
+       *   EXP1-2 ----------- EXP1-9
197
+       *   SPI1-4 ----------- EXP1-6
198
+       *   EXP1-4 ----------- FREE
199
+       *   SPI1-3 ----------- EXP1-2
200
+       *   EXP1-6 ----------- EXP1-4
201
+       *   EXP1-7 ----------- FREE
202
+       *   EXP1-8 ----------- EXP1-3
203
+       *   SPI1-1 ----------- EXP1-1
204
+       *  EXP1-10 ----------- EXP1-7
205
+       *
206
+       */
207
+
208
+      #define TFTGLCD_CS                    PA9
209
+
210
+    #endif
211
+
172 212
   #else
173
-    #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, and MKS_MINI_12864 are currently supported on the BIGTREE_SKR_MINI_E3."
213
+    #error "Only CR10_STOCKDISPLAY, ZONESTAR_LCD, ENDER2_STOCKDISPLAY, MKS_MINI_12864, and TFTGLCD_PANEL_(SPI|I2C) are currently supported on the BIGTREE_SKR_MINI_E3."
174 214
   #endif
175 215
 
176 216
 #endif // HAS_WIRED_LCD
@@ -227,9 +267,7 @@
227 267
 
228 268
 #if SD_CONNECTION_IS(ONBOARD)
229 269
   #define SD_DETECT_PIN                     PC4
230
-#endif
231
-
232
-#if BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) && SD_CONNECTION_IS(LCD)
270
+#elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL)
233 271
   #define SD_DETECT_PIN                     PB5
234 272
   #define SS_PIN                            PA10
235 273
 #elif SD_CONNECTION_IS(CUSTOM_CABLE)

+ 11
- 0
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h View File

@@ -123,6 +123,17 @@
123 123
     #define LCD_PINS_ENABLE                 PC14
124 124
     #define LCD_PINS_D4                     PB7
125 125
 
126
+  #elif IS_TFTGLCD_PANEL
127
+
128
+    #undef BEEPER_PIN
129
+    #undef BTN_ENC
130
+
131
+    #if ENABLED(TFTGLCD_PANEL_SPI)
132
+      #define TFTGLCD_CS                    PD2
133
+    #endif
134
+
135
+    #define SD_DETECT_PIN                   PB9
136
+
126 137
   #else
127 138
 
128 139
     #define LCD_PINS_RS                     PC12

+ 6
- 0
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h View File

@@ -115,6 +115,12 @@
115 115
     #define DOGLCD_SCK                      PB13
116 116
     #define DOGLCD_MOSI                     PB15
117 117
 
118
+  #elif IS_TFTGLCD_PANEL
119
+
120
+    #if ENABLED(TFTGLCD_PANEL_SPI)
121
+      #define TFTGLCD_CS                    PB11
122
+    #endif
123
+
118 124
   #else                                           // !MKS_MINI_12864
119 125
 
120 126
     #define LCD_PINS_D4                     PA6

+ 13
- 0
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

@@ -356,6 +356,19 @@
356 356
     #define DOGLCD_SCK                      PA5
357 357
     #define DOGLCD_MOSI                     PA7
358 358
 
359
+  #elif IS_TFTGLCD_PANEL
360
+
361
+    #if ENABLED(TFTGLCD_PANEL_SPI)
362
+      #define PIN_SPI_SCK                   PA5
363
+      #define PIN_TFT_MISO                  PA6
364
+      #define PIN_TFT_MOSI                  PA7
365
+      #define TFTGLCD_CS                    PE8
366
+    #endif
367
+
368
+    #ifndef BEEPER_PIN
369
+      #define BEEPER_PIN                    -1
370
+    #endif
371
+
359 372
   #else                                           // !MKS_MINI_12864
360 373
 
361 374
     #define LCD_PINS_D4                     PE14

+ 7
- 0
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h View File

@@ -225,6 +225,12 @@
225 225
     #define BTN_EN2                         PG4
226 226
   #endif
227 227
 
228
+#elif IS_TFTGLCD_PANEL
229
+
230
+  #if ENABLED(TFTGLCD_PANEL_SPI)
231
+    #define TFTGLCD_CS                      PG5
232
+  #endif
233
+
228 234
 #elif HAS_WIRED_LCD
229 235
 
230 236
   #define BEEPER_PIN                        PC5
@@ -254,6 +260,7 @@
254 260
     #endif
255 261
 
256 262
   #endif // !MKS_MINI_12864 && !ENDER2_STOCKDISPLAY
263
+
257 264
 #endif
258 265
 
259 266
 #ifndef BOARD_ST7920_DELAY_1

+ 8
- 1
Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h View File

@@ -286,7 +286,14 @@
286 286
 //
287 287
 // LCDs and Controllers
288 288
 //
289
-#if HAS_WIRED_LCD
289
+#if IS_TFTGLCD_PANEL
290
+
291
+  #if ENABLED(TFTGLCD_PANEL_SPI)
292
+    #define TFTGLCD_CS                      PG10
293
+  #endif
294
+
295
+#elif HAS_WIRED_LCD
296
+
290 297
   #define BEEPER_PIN                        PG4
291 298
   #define BTN_ENC                           PA8
292 299
 

+ 14
- 0
buildroot/tests/LPC1769-tests View File

@@ -26,6 +26,20 @@ opt_enable VIKI2 SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
26 26
 opt_set GRID_MAX_POINTS_X 16
27 27
 exec_test $1 $2 "Smoothieboard with many features"
28 28
 
29
+restore_configs
30
+opt_set MOTHERBOARD BOARD_SMOOTHIEBOARD
31
+opt_set EXTRUDERS 2
32
+opt_set TEMP_SENSOR_1 -1
33
+opt_set TEMP_SENSOR_BED 5
34
+opt_enable TFTGLCD_PANEL_SPI SDSUPPORT ADAPTIVE_FAN_SLOWING NO_FAN_SLOWING_IN_PID_TUNING \
35
+           FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR G29_RETRY_AND_RECOVER Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
36
+           BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET \
37
+           PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
38
+           Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \
39
+           LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA EMERGENCY_PARSER
40
+opt_set GRID_MAX_POINTS_X 16
41
+exec_test $1 $2 "Smoothieboard with TFTGLCD_PANEL_SPI"
42
+
29 43
 #restore_configs
30 44
 #opt_set MOTHERBOARD BOARD_AZTEEG_X5_MINI_WIFI
31 45
 #opt_enable COREYX USE_XMAX_PLUG DAC_MOTOR_CURRENT_DEFAULT \

+ 2
- 1
platformio.ini View File

@@ -26,7 +26,7 @@ include_dir  = Marlin
26 26
 #
27 27
 [common]
28 28
 default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
29
-  -<src/lcd/HD44780> -<src/lcd/dwin> -<src/lcd/dogm> -<src/lcd/tft>
29
+  -<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dwin> -<src/lcd/dogm> -<src/lcd/tft>
30 30
   -<src/lcd/menu>
31 31
   -<src/lcd/menu/game/game.cpp> -<src/lcd/menu/game/brickout.cpp> -<src/lcd/menu/game/invaders.cpp>
32 32
   -<src/lcd/menu/game/maze.cpp> -<src/lcd/menu/game/snake.cpp>
@@ -216,6 +216,7 @@ HAS_MARLINUI_U8GLIB     = U8glib-HAL@~0.4.1
216 216
                           src_filter=+<src/lcd/dogm>
217 217
 HAS_GRAPHICAL_TFT       = src_filter=+<src/lcd/tft>
218 218
 DWIN_CREALITY_LCD       = src_filter=+<src/lcd/dwin>
219
+IS_TFTGLCD_PANEL        = src_filter=+<src/lcd/TFTGLCD>
219 220
 HAS_LCD_MENU            = src_filter=+<src/lcd/menu>
220 221
 HAS_GAMES               = src_filter=+<src/lcd/menu/game/game.cpp>
221 222
 MARLIN_BRICKOUT         = src_filter=+<src/lcd/menu/game/brickout.cpp>

Loading…
Cancel
Save