Browse Source

Fix MKS Robin Nano V2 build / upload (#18784)

Victor Oliveira 3 years ago
parent
commit
3eef000e2a
No account linked to committer's email address

+ 7
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp View File

@@ -126,6 +126,13 @@ void gCfgItems_init() {
126 126
     W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR);
127 127
     W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems));
128 128
   }
129
+
130
+  uiCfg.F[0] = 'N';
131
+  uiCfg.F[1] = 'A';
132
+  uiCfg.F[2] = 'N';
133
+  uiCfg.F[3] = 'O';
134
+  W25QXX.SPI_FLASH_BlockErase(REFLSHE_FLGA_ADD + 32 - 64*1024);
135
+  W25QXX.SPI_FLASH_BufferWrite(uiCfg.F,REFLSHE_FLGA_ADD,4);
129 136
 }
130 137
 
131 138
 void gCfg_to_spiFlah() {

+ 1
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h View File

@@ -161,6 +161,7 @@ typedef struct {
161 161
   uint8_t waitEndMoves;
162 162
   uint16_t moveSpeed;
163 163
   float move_dist;
164
+  uint8_t	F[4];
164 165
 } UI_CFG;
165 166
 
166 167
 typedef enum {

+ 5
- 5
Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.cpp View File

@@ -590,6 +590,8 @@ void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint1
590 590
 }
591 591
 
592 592
 void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor) {
593
+  // Select TFT SPI so it can receive data
594
+  TERN_(TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED));
593 595
   while (*string != '\0') {
594 596
     disp_char_1624(x, y, *string, charColor, bkColor);
595 597
     string++;
@@ -599,10 +601,8 @@ void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor
599 601
 
600 602
 //static lv_obj_t * scr_test;
601 603
 void disp_assets_update() {
602
-  #if DISABLED(TFT_LVGL_UI_SPI)
603
-    LCD_Clear(0x0000);
604
-  #endif
605
-  disp_string(100, 150, "Assets Updating...", 0xFFFF, 0x0000);
604
+  TERN(TFT_LVGL_UI_SPI,, LCD_Clear(0x0000));
605
+  disp_string(100, 140, "Assets Updating...", 0xFFFF, 0x0000);
606 606
 }
607 607
 
608 608
 void disp_assets_update_progress(const char *msg) {
@@ -610,7 +610,7 @@ void disp_assets_update_progress(const char *msg) {
610 610
   memset(buf, ' ', COUNT(buf));
611 611
   strncpy(buf, msg, strlen(msg));
612 612
   buf[COUNT(buf)-1] = '\0';
613
-  disp_string(100, 200, buf, 0xFFFF, 0x0000);
613
+  disp_string(100, 165, buf, 0xFFFF, 0x0000);
614 614
 }
615 615
 
616 616
 uint8_t mks_test_flag = 0;

+ 9
- 1
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp View File

@@ -249,6 +249,7 @@ const char *bakPath = "_assets";
249 249
 
250 250
 void spiFlashErase_PIC() {
251 251
   volatile uint32_t pic_sectorcnt = 0;
252
+  W25QXX.init(SPI_QUARTER_SPEED);
252 253
   for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
253 254
     W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
254 255
 }
@@ -256,7 +257,8 @@ void spiFlashErase_PIC() {
256 257
 #if HAS_SPI_FLASH_FONT
257 258
   void spiFlashErase_FONT() {
258 259
     volatile uint32_t Font_sectorcnt = 0;
259
-    for (Font_sectorcnt = 0; Font_sectorcnt < FONT_SIZE_xM * 1024 / 64; Font_sectorcnt++)
260
+    W25QXX.init(SPI_QUARTER_SPEED);
261
+    for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++)
260 262
       W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
261 263
   }
262 264
 #endif
@@ -386,6 +388,9 @@ uint8_t public_buf[512];
386 388
     }
387 389
 
388 390
     disp_assets_update_progress(fn);
391
+
392
+    W25QXX.init(SPI_QUARTER_SPEED);
393
+
389 394
     uint16_t pbr;
390 395
     uint32_t pfileSize;
391 396
     uint32_t totalSizeLoaded = 0;
@@ -444,11 +449,14 @@ uint8_t public_buf[512];
444 449
     if (dir.open(&root, assetsPath, O_RDONLY)) {
445 450
 
446 451
       disp_assets_update();
452
+      disp_assets_update_progress("Erasing pics...");
447 453
       spiFlashErase_PIC();
448 454
       #if HAS_SPI_FLASH_FONT
455
+        disp_assets_update_progress("Erasing fonts...");
449 456
         spiFlashErase_FONT();
450 457
       #endif
451 458
 
459
+      disp_assets_update_progress("Reading files...");
452 460
       dir_t d;
453 461
       while (dir.readDir(&d, card.longFilename) > 0) {
454 462
         // if we dont get a long name, but gets a short one, try it

+ 2
- 1
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h View File

@@ -120,6 +120,7 @@ extern "C" { /* C-declarations for C++ */
120 120
 #endif
121 121
 
122 122
 // Flash flag
123
+#define REFLSHE_FLGA_ADD                (0X800000-32)
123 124
 #define FLASH_INF_VALID_FLAG            0xAA558761
124 125
 // SD card information first addr
125 126
 #define VAR_INF_ADDR                    0x000000
@@ -139,7 +140,7 @@ typedef struct pic_msg PIC_MSG;
139 140
 
140 141
 #define BMP_WRITE_BUF_LEN 512
141 142
 
142
-#define PICINFOADDR   0
143
+#define PICINFOADDR   0x1000
143 144
 
144 145
 #define PIC_SIZE_xM   6
145 146
 #define FONT_SIZE_xM  2

+ 2
- 2
Marlin/src/pins/pins.h View File

@@ -507,9 +507,9 @@
507 507
 #elif MB(MKS_ROBIN_MINI)
508 508
   #include "stm32f1/pins_MKS_ROBIN_MINI.h"      // STM32F1                                env:mks_robin_mini
509 509
 #elif MB(MKS_ROBIN_NANO)
510
-  #include "stm32f1/pins_MKS_ROBIN_NANO.h"      // STM32F1                                env:mks_robin_nano env:mks_robin_nano35
510
+  #include "stm32f1/pins_MKS_ROBIN_NANO.h"      // STM32F1                                env:mks_robin_nano35
511 511
 #elif MB(MKS_ROBIN_NANO_V2)
512
-  #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h"   // STM32F1                                env:mks_robin_nano env:mks_robin_nano35
512
+  #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h"   // STM32F1                                env:mks_robin_nano35
513 513
 #elif MB(MKS_ROBIN_LITE)
514 514
   #include "stm32f1/pins_MKS_ROBIN_LITE.h"      // STM32F1                                env:mks_robin_lite
515 515
 #elif MB(BTT_SKR_MINI_V1_1)

+ 9
- 16
platformio.ini View File

@@ -574,27 +574,20 @@ build_flags   = ${common_stm32f1.build_flags}
574 574
   -DMCU_STM32F103VE
575 575
 
576 576
 #
577
-# MKS Robin Nano (STM32F103VET6) - Emulated Graphical 128x64 (DOGM) UI and LVGL UI
577
+# MKS Robin Nano (STM32F103VET6)
578
+# v1.2 - Emulated Graphical 128x64 (DOGM) UI and LVGL UI
579
+# v2.0 - LVGL UI
578 580
 #
579
-[env:mks_robin_nano]
580
-platform      = ${common_stm32f1.platform}
581
-extends       = common_stm32f1
582
-board         = genericSTM32F103VE
583
-platform_packages = tool-stm32duino
584
-extra_scripts = ${common.extra_scripts}
585
-  buildroot/share/PlatformIO/scripts/mks_robin_nano.py
586
-build_flags   = ${common_stm32f1.build_flags}
587
-  -DMCU_STM32F103VE -DSS_TIMER=4
588
-
589
-#
590
-# MKS Robin Nano v2.0 (STM32F103VET6) - LVGL UI
591
-#
592
-[env:mks_robin_nano35_v2]
581
+[env:mks_robin_nano35]
593 582
 platform        = ${common_stm32f1.platform}
594
-extends         = env:mks_robin_nano
583
+extends         = common_stm32f1
584
+board           = genericSTM32F103VE
585
+platform_packages = tool-stm32duino
595 586
 extra_scripts   = ${common.extra_scripts}
596 587
   buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
597 588
 lib_deps        = ${common_stm32f1.lib_deps}
589
+build_flags     = ${common_stm32f1.build_flags}
590
+  -DMCU_STM32F103VE -DSS_TIMER=4
598 591
 debug_tool      = jlink
599 592
 upload_protocol = jlink
600 593
 

Loading…
Cancel
Save