ソースを参照

Fix MKS Nano v1.2 FSMC display (#18901)

Victor Oliveira 3年前
コミット
04c10eda92
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 1
- 1
Marlin/src/inc/SanityCheck.h ファイルの表示

@@ -819,7 +819,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
819 819
  */
820 820
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
821 821
   #if !HAS_RESUME_CONTINUE
822
-    #error "ADVANCED_PAUSE_FEATURE currently requires an LCD controller or EMERGENCY_PARSER."
822
+    #error "ADVANCED_PAUSE_FEATURE requires a supported LCD controller (or EMERGENCY_PARSER)."
823 823
   #elif DISABLED(NOZZLE_PARK_FEATURE)
824 824
     #error "ADVANCED_PAUSE_FEATURE requires NOZZLE_PARK_FEATURE."
825 825
   #elif !defined(FILAMENT_UNLOAD_PURGE_FEEDRATE)

+ 40
- 14
Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp ファイルの表示

@@ -242,6 +242,7 @@ void (*setWindow)(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint
242 242
     }
243 243
   }
244 244
   #define WRITE_ESC_SEQUENCE(V) writeEscSequence(V)
245
+  #define WRITE_ESC_SEQUENCE16(V) writeEscSequence(V)
245 246
 #else
246 247
   void writeEscSequence8(u8g_t *u8g, u8g_dev_t *dev, const uint16_t *sequence) {
247 248
     uint16_t data;
@@ -289,6 +290,8 @@ void (*setWindow)(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint
289 290
     }
290 291
     u8g_SetAddress(u8g, dev, 1);
291 292
   }
293
+
294
+  #define WRITE_ESC_SEQUENCE16(V) writeEscSequence16(u8g, dev, V)
292 295
 #endif
293 296
 
294 297
 static const uint16_t st7789v_init[] = {
@@ -378,7 +381,28 @@ static const uint16_t ili9341_init[] = {
378 381
   ESC_END
379 382
 };
380 383
 
381
-static const uint16_t st9677_init[] = {
384
+static const uint16_t ili9488_init[] = {
385
+  ESC_REG(0x00E0), 0x0000, 0x0007, 0x000F, 0x000D, 0x001B, 0x000A, 0x003C, 0x0078, 0x004A, 0x0007, 0x000E, 0x0009, 0x001B, 0x001E, 0x000F,
386
+  ESC_REG(0x00E1), 0x0000, 0x0022, 0x0024, 0x0006, 0x0012, 0x0007, 0x0036, 0x0047, 0x0047, 0x0006, 0x000A, 0x0007, 0x0030, 0x0037, 0x000F,
387
+  ESC_REG(0x00C0), 0x0010, 0x0010,
388
+  ESC_REG(0x00C1), 0x0041,
389
+  ESC_REG(0x00C5), 0x0000, 0x0022, 0x0080,
390
+  ESC_REG(0x0036), TERN(GRAPHICAL_TFT_ROTATE_180, 0x00A8, 0x0068),
391
+  ESC_REG(0x003A), 0x0055,
392
+  ESC_REG(0x00B0), 0x0000,
393
+  ESC_REG(0x00B1), 0x00B0, 0x0011,
394
+  ESC_REG(0x00B4), 0x0002,
395
+  ESC_REG(0x00B6), 0x0002, 0x0042,
396
+  ESC_REG(0x00B7), 0x00C6,
397
+  ESC_REG(0x00E9), 0x0000,
398
+  ESC_REG(0x00F0), 0x00A9, 0x0051, 0x002C, 0x0082,
399
+  ESC_REG(0x0029),
400
+  ESC_REG(0x0011),
401
+  ESC_DELAY(100),
402
+  ESC_END
403
+};
404
+
405
+static const uint16_t st7796_init[] = {
382 406
   ESC_REG(0x0010), ESC_DELAY(120),
383 407
   ESC_REG(0x0001), ESC_DELAY(120),
384 408
   ESC_REG(0x0011), ESC_DELAY(120),
@@ -588,8 +612,8 @@ static const uint16_t st9677_init[] = {
588 612
 
589 613
         LCD_IO_WriteSequence(buffer, length * sq(FSMC_UPSCALE));
590 614
       #else
591
-        u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
592
-        u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
615
+        for (uint8_t i = FSMC_UPSCALE; i--;)
616
+          u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
593 617
       #endif
594 618
     }
595 619
   }
@@ -617,7 +641,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
617 641
     uint16_t* buffer = &bufferA[0];
618 642
     bool allow_async = DISABLED(SPI_GRAPHICAL_TFT);
619 643
   #else
620
-    uint16_t buffer[WIDTH*2]; // 16-bit RGB 565 pixel line buffer
644
+    uint16_t buffer[WIDTH * FSMC_UPSCALE]; // 16-bit RGB 565 pixel line buffer
621 645
   #endif
622 646
 
623 647
   switch (msg) {
@@ -630,18 +654,21 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
630 654
           setWindow = setWindow_st7789v;
631 655
           break;
632 656
         case 0x9328:  // ILI9328
633
-          WRITE_ESC_SEQUENCE(ili9328_init);
657
+          WRITE_ESC_SEQUENCE16(ili9328_init);
634 658
           setWindow = setWindow_ili9328;
635 659
           break;
636 660
         case 0x9341:   // ILI9341
637 661
         case 0x8066:   // Anycubic / TronXY TFTs (480x320)
638
-          WRITE_ESC_SEQUENCE(ili9341_init);
662
+          WRITE_ESC_SEQUENCE(ili9488_init);
639 663
           setWindow = setWindow_st7789v;
640 664
           break;
641 665
         case 0x7796:
642
-          WRITE_ESC_SEQUENCE(TERN(HAS_LCD_IO, st9677_init, ili9341_init));
666
+          WRITE_ESC_SEQUENCE(st7796_init);
643 667
           setWindow = setWindow_st7789v;
644 668
           break;
669
+        case 0x9488:
670
+          WRITE_ESC_SEQUENCE(ili9488_init);
671
+          setWindow = setWindow_st7789v;
645 672
         case 0x0404:  // No connected display on FSMC
646 673
           lcd_id = 0;
647 674
           return 0;
@@ -664,8 +691,8 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
664 691
         LCD_IO_WriteMultiple(TFT_MARLINBG_COLOR, (LCD_FULL_PIXEL_WIDTH) * (LCD_FULL_PIXEL_HEIGHT));
665 692
       #else
666 693
         memset2(buffer, TFT_MARLINBG_COLOR, (LCD_FULL_PIXEL_WIDTH) / 2);
667
-        for (uint16_t i = 0; i < (LCD_FULL_PIXEL_WIDTH) * 3; i++)
668
-          u8g_WriteSequence(u8g, dev, (LCD_FULL_PIXEL_WIDTH) / 2, (uint8_t *)buffer);
694
+        for (uint16_t i = 0; i < (LCD_FULL_PIXEL_HEIGHT) * sq(FSMC_UPSCALE); i++)
695
+          u8g_WriteSequence(u8g, dev, LCD_FULL_PIXEL_WIDTH / 2, (uint8_t *)buffer);
669 696
       #endif
670 697
 
671 698
       // Bottom buttons
@@ -721,11 +748,10 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
721 748
             LCD_IO_WriteSequence(buffer, COUNT(bufferA));
722 749
         #else
723 750
           uint8_t* bufptr = (uint8_t*) buffer;
724
-          for (uint8_t i = 2; i--;) {
725
-            u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[0]);
726
-            u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH]);
727
-            u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH*2]);
728
-            u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH*3]);
751
+          for (uint8_t i = FSMC_UPSCALE; i--;) {
752
+            LOOP_S_L_N(n, 0, FSMC_UPSCALE * 2) {
753
+              u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH * n]);
754
+            }
729 755
           }
730 756
         #endif
731 757
       }

+ 25
- 72
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h ファイルの表示

@@ -165,28 +165,7 @@
165 165
  * to let the bootloader init the screen.
166 166
  */
167 167
 
168
-#if ENABLED(TFT_LVGL_UI_SPI)
169
-
170
-  #define SPI_TFT_CS_PIN                    PD11
171
-  #define SPI_TFT_SCK_PIN                   PA5
172
-  #define SPI_TFT_MISO_PIN                  PA6
173
-  #define SPI_TFT_MOSI_PIN                  PA7
174
-  #define SPI_TFT_DC_PIN                    PD10
175
-  #define SPI_TFT_RST_PIN                   PC6
176
-
177
-  #define LCD_BACKLIGHT_PIN                 PD13
178
-
179
-  #define TOUCH_CS_PIN                      PE14  // SPI1_NSS
180
-  #define TOUCH_SCK_PIN                     PA5   // SPI1_SCK
181
-  #define TOUCH_MISO_PIN                    PA6   // SPI1_MISO
182
-  #define TOUCH_MOSI_PIN                    PA7   // SPI1_MOSI
183
-
184
-  #define BTN_EN1                           PE8
185
-  #define BTN_EN2                           PE11
186
-  #define BEEPER_PIN                        PC5
187
-  #define BTN_ENC                           PE13
188
-
189
-#elif ENABLED(TFT_LVGL_UI_FSMC)
168
+#if ENABLED(TFT_LVGL_UI_FSMC)
190 169
 
191 170
   #define FSMC_CS_PIN                       PD7   // NE4
192 171
   #define FSMC_RS_PIN                       PD11  // A0
@@ -198,15 +177,34 @@
198 177
 
199 178
   #define LCD_BACKLIGHT_PIN                 PD13
200 179
 
201
-#endif
180
+#elif ENABLED(FSMC_GRAPHICAL_TFT)
181
+
182
+  #define DOGLCD_MOSI                       -1    // prevent redefine Conditionals_post.h
183
+  #define DOGLCD_SCK                        -1
202 184
 
203
-#if ENABLED(FSMC_GRAPHICAL_TFT)
204
-  //#define DOGLCD_MOSI                     -1    // prevent redefine Conditionals_post.h
205
-  //#define DOGLCD_SCK                      -1
185
+  #ifndef FSMC_UPSCALE
186
+    #define FSMC_UPSCALE                    3
187
+  #endif
188
+  #ifndef LCD_FULL_PIXEL_WIDTH
189
+    #define LCD_FULL_PIXEL_WIDTH            480
190
+  #endif
191
+  #ifndef LCD_PIXEL_OFFSET_X
192
+    #define LCD_PIXEL_OFFSET_X              48
193
+  #endif
194
+  #ifndef LCD_FULL_PIXEL_HEIGHT
195
+    #define LCD_FULL_PIXEL_HEIGHT           320
196
+  #endif
197
+  #ifndef LCD_PIXEL_OFFSET_Y
198
+    #define LCD_PIXEL_OFFSET_Y              32
199
+  #endif
206 200
 
207 201
   #define FSMC_CS_PIN                       PD7   // NE4
208 202
   #define FSMC_RS_PIN                       PD11  // A0
209 203
 
204
+  #define LCD_USE_DMA_FSMC                  // Use DMA transfers to send data to the TFT
205
+  #define FSMC_DMA_DEV                      DMA2
206
+  #define FSMC_DMA_CHANNEL                  DMA_CH5
207
+
210 208
   #define LCD_RESET_PIN                     PC6   // FSMC_RST
211 209
   #define LCD_BACKLIGHT_PIN                 PD13
212 210
 
@@ -216,53 +214,8 @@
216 214
     #define TOUCH_MISO_PIN                  PB14  // SPI2_MISO
217 215
     #define TOUCH_MOSI_PIN                  PB15  // SPI2_MOSI
218 216
   #endif
219
-#endif
220 217
 
221
-#if HAS_SPI_LCD
222
-
223
-  #define BEEPER_PIN                        PC5
224
-  #define BTN_ENC                           PE13
225
-  #define LCD_PINS_ENABLE                   PD13
226
-  #define LCD_PINS_RS                       PC6
227
-  #define BTN_EN1                           PE8
228
-  #define BTN_EN2                           PE11
229
-  #define LCD_BACKLIGHT_PIN                 -1
230
-
231
-  // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
232
-  #if ENABLED(MKS_MINI_12864)
233
-    #define LCD_BACKLIGHT_PIN               -1
234
-    #define LCD_RESET_PIN                   -1
235
-    #define DOGLCD_A0                       PD11
236
-    #define DOGLCD_CS                       PE15
237
-    #define DOGLCD_SCK                      PA5
238
-    #define DOGLCD_MOSI                     PA7
239
-
240
-    // Required for MKS_MINI_12864 with this board
241
-    #define MKS_LCD12864B
242
-    #undef SHOW_BOOTSCREEN
243
-
244
-  #else                                           // !MKS_MINI_12864
245
-
246
-    #define LCD_PINS_D4                     PE14
247
-    #if ENABLED(ULTIPANEL)
248
-      #define LCD_PINS_D5                   PE15
249
-      #define LCD_PINS_D6                   PD11
250
-      #define LCD_PINS_D7                   PD10
251
-    #endif
252
-
253
-    #ifndef BOARD_ST7920_DELAY_1
254
-      #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
255
-    #endif
256
-    #ifndef BOARD_ST7920_DELAY_2
257
-      #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
258
-    #endif
259
-    #ifndef BOARD_ST7920_DELAY_3
260
-      #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
261
-    #endif
262
-
263
-  #endif // !MKS_MINI_12864
264
-
265
-#endif // HAS_SPI_LCD
218
+#endif
266 219
 
267 220
 #define SPI_FLASH
268 221
 #if ENABLED(SPI_FLASH)

読み込み中…
キャンセル
保存