Browse Source

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

Victor Oliveira 4 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
     W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR);
126
     W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR);
127
     W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems));
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
 void gCfg_to_spiFlah() {
138
 void gCfg_to_spiFlah() {

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

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

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

590
 }
590
 }
591
 
591
 
592
 void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor) {
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
   while (*string != '\0') {
595
   while (*string != '\0') {
594
     disp_char_1624(x, y, *string, charColor, bkColor);
596
     disp_char_1624(x, y, *string, charColor, bkColor);
595
     string++;
597
     string++;
599
 
601
 
600
 //static lv_obj_t * scr_test;
602
 //static lv_obj_t * scr_test;
601
 void disp_assets_update() {
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
 void disp_assets_update_progress(const char *msg) {
608
 void disp_assets_update_progress(const char *msg) {
610
   memset(buf, ' ', COUNT(buf));
610
   memset(buf, ' ', COUNT(buf));
611
   strncpy(buf, msg, strlen(msg));
611
   strncpy(buf, msg, strlen(msg));
612
   buf[COUNT(buf)-1] = '\0';
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
 uint8_t mks_test_flag = 0;
616
 uint8_t mks_test_flag = 0;

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

249
 
249
 
250
 void spiFlashErase_PIC() {
250
 void spiFlashErase_PIC() {
251
   volatile uint32_t pic_sectorcnt = 0;
251
   volatile uint32_t pic_sectorcnt = 0;
252
+  W25QXX.init(SPI_QUARTER_SPEED);
252
   for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
253
   for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
253
     W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
254
     W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
254
 }
255
 }
256
 #if HAS_SPI_FLASH_FONT
257
 #if HAS_SPI_FLASH_FONT
257
   void spiFlashErase_FONT() {
258
   void spiFlashErase_FONT() {
258
     volatile uint32_t Font_sectorcnt = 0;
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
       W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
262
       W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
261
   }
263
   }
262
 #endif
264
 #endif
386
     }
388
     }
387
 
389
 
388
     disp_assets_update_progress(fn);
390
     disp_assets_update_progress(fn);
391
+
392
+    W25QXX.init(SPI_QUARTER_SPEED);
393
+
389
     uint16_t pbr;
394
     uint16_t pbr;
390
     uint32_t pfileSize;
395
     uint32_t pfileSize;
391
     uint32_t totalSizeLoaded = 0;
396
     uint32_t totalSizeLoaded = 0;
444
     if (dir.open(&root, assetsPath, O_RDONLY)) {
449
     if (dir.open(&root, assetsPath, O_RDONLY)) {
445
 
450
 
446
       disp_assets_update();
451
       disp_assets_update();
452
+      disp_assets_update_progress("Erasing pics...");
447
       spiFlashErase_PIC();
453
       spiFlashErase_PIC();
448
       #if HAS_SPI_FLASH_FONT
454
       #if HAS_SPI_FLASH_FONT
455
+        disp_assets_update_progress("Erasing fonts...");
449
         spiFlashErase_FONT();
456
         spiFlashErase_FONT();
450
       #endif
457
       #endif
451
 
458
 
459
+      disp_assets_update_progress("Reading files...");
452
       dir_t d;
460
       dir_t d;
453
       while (dir.readDir(&d, card.longFilename) > 0) {
461
       while (dir.readDir(&d, card.longFilename) > 0) {
454
         // if we dont get a long name, but gets a short one, try it
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
 #endif
120
 #endif
121
 
121
 
122
 // Flash flag
122
 // Flash flag
123
+#define REFLSHE_FLGA_ADD                (0X800000-32)
123
 #define FLASH_INF_VALID_FLAG            0xAA558761
124
 #define FLASH_INF_VALID_FLAG            0xAA558761
124
 // SD card information first addr
125
 // SD card information first addr
125
 #define VAR_INF_ADDR                    0x000000
126
 #define VAR_INF_ADDR                    0x000000
139
 
140
 
140
 #define BMP_WRITE_BUF_LEN 512
141
 #define BMP_WRITE_BUF_LEN 512
141
 
142
 
142
-#define PICINFOADDR   0
143
+#define PICINFOADDR   0x1000
143
 
144
 
144
 #define PIC_SIZE_xM   6
145
 #define PIC_SIZE_xM   6
145
 #define FONT_SIZE_xM  2
146
 #define FONT_SIZE_xM  2

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

507
 #elif MB(MKS_ROBIN_MINI)
507
 #elif MB(MKS_ROBIN_MINI)
508
   #include "stm32f1/pins_MKS_ROBIN_MINI.h"      // STM32F1                                env:mks_robin_mini
508
   #include "stm32f1/pins_MKS_ROBIN_MINI.h"      // STM32F1                                env:mks_robin_mini
509
 #elif MB(MKS_ROBIN_NANO)
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
 #elif MB(MKS_ROBIN_NANO_V2)
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
 #elif MB(MKS_ROBIN_LITE)
513
 #elif MB(MKS_ROBIN_LITE)
514
   #include "stm32f1/pins_MKS_ROBIN_LITE.h"      // STM32F1                                env:mks_robin_lite
514
   #include "stm32f1/pins_MKS_ROBIN_LITE.h"      // STM32F1                                env:mks_robin_lite
515
 #elif MB(BTT_SKR_MINI_V1_1)
515
 #elif MB(BTT_SKR_MINI_V1_1)

+ 9
- 16
platformio.ini View File

574
   -DMCU_STM32F103VE
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
 platform        = ${common_stm32f1.platform}
582
 platform        = ${common_stm32f1.platform}
594
-extends         = env:mks_robin_nano
583
+extends         = common_stm32f1
584
+board           = genericSTM32F103VE
585
+platform_packages = tool-stm32duino
595
 extra_scripts   = ${common.extra_scripts}
586
 extra_scripts   = ${common.extra_scripts}
596
   buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
587
   buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
597
 lib_deps        = ${common_stm32f1.lib_deps}
588
 lib_deps        = ${common_stm32f1.lib_deps}
589
+build_flags     = ${common_stm32f1.build_flags}
590
+  -DMCU_STM32F103VE -DSS_TIMER=4
598
 debug_tool      = jlink
591
 debug_tool      = jlink
599
 upload_protocol = jlink
592
 upload_protocol = jlink
600
 
593
 

Loading…
Cancel
Save