Fix MKS Robin Nano V2 build / upload (#18784)
This commit is contained in:
		| @@ -126,6 +126,13 @@ void gCfgItems_init() { | ||||
|     W25QXX.SPI_FLASH_SectorErase(VAR_INF_ADDR); | ||||
|     W25QXX.SPI_FLASH_BufferWrite((uint8_t *)&gCfgItems, VAR_INF_ADDR, sizeof(gCfgItems)); | ||||
|   } | ||||
|  | ||||
|   uiCfg.F[0] = 'N'; | ||||
|   uiCfg.F[1] = 'A'; | ||||
|   uiCfg.F[2] = 'N'; | ||||
|   uiCfg.F[3] = 'O'; | ||||
|   W25QXX.SPI_FLASH_BlockErase(REFLSHE_FLGA_ADD + 32 - 64*1024); | ||||
|   W25QXX.SPI_FLASH_BufferWrite(uiCfg.F,REFLSHE_FLGA_ADD,4); | ||||
| } | ||||
|  | ||||
| void gCfg_to_spiFlah() { | ||||
|   | ||||
| @@ -161,6 +161,7 @@ typedef struct { | ||||
|   uint8_t waitEndMoves; | ||||
|   uint16_t moveSpeed; | ||||
|   float move_dist; | ||||
|   uint8_t	F[4]; | ||||
| } UI_CFG; | ||||
|  | ||||
| typedef enum { | ||||
|   | ||||
| @@ -590,6 +590,8 @@ void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint1 | ||||
| } | ||||
|  | ||||
| void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor) { | ||||
|   // Select TFT SPI so it can receive data | ||||
|   TERN_(TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED)); | ||||
|   while (*string != '\0') { | ||||
|     disp_char_1624(x, y, *string, charColor, bkColor); | ||||
|     string++; | ||||
| @@ -599,10 +601,8 @@ void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor | ||||
|  | ||||
| //static lv_obj_t * scr_test; | ||||
| void disp_assets_update() { | ||||
|   #if DISABLED(TFT_LVGL_UI_SPI) | ||||
|     LCD_Clear(0x0000); | ||||
|   #endif | ||||
|   disp_string(100, 150, "Assets Updating...", 0xFFFF, 0x0000); | ||||
|   TERN(TFT_LVGL_UI_SPI,, LCD_Clear(0x0000)); | ||||
|   disp_string(100, 140, "Assets Updating...", 0xFFFF, 0x0000); | ||||
| } | ||||
|  | ||||
| void disp_assets_update_progress(const char *msg) { | ||||
| @@ -610,7 +610,7 @@ void disp_assets_update_progress(const char *msg) { | ||||
|   memset(buf, ' ', COUNT(buf)); | ||||
|   strncpy(buf, msg, strlen(msg)); | ||||
|   buf[COUNT(buf)-1] = '\0'; | ||||
|   disp_string(100, 200, buf, 0xFFFF, 0x0000); | ||||
|   disp_string(100, 165, buf, 0xFFFF, 0x0000); | ||||
| } | ||||
|  | ||||
| uint8_t mks_test_flag = 0; | ||||
|   | ||||
| @@ -249,6 +249,7 @@ const char *bakPath = "_assets"; | ||||
|  | ||||
| void spiFlashErase_PIC() { | ||||
|   volatile uint32_t pic_sectorcnt = 0; | ||||
|   W25QXX.init(SPI_QUARTER_SPEED); | ||||
|   for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++) | ||||
|     W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024); | ||||
| } | ||||
| @@ -256,7 +257,8 @@ void spiFlashErase_PIC() { | ||||
| #if HAS_SPI_FLASH_FONT | ||||
|   void spiFlashErase_FONT() { | ||||
|     volatile uint32_t Font_sectorcnt = 0; | ||||
|     for (Font_sectorcnt = 0; Font_sectorcnt < FONT_SIZE_xM * 1024 / 64; Font_sectorcnt++) | ||||
|     W25QXX.init(SPI_QUARTER_SPEED); | ||||
|     for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++) | ||||
|       W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024); | ||||
|   } | ||||
| #endif | ||||
| @@ -386,6 +388,9 @@ uint8_t public_buf[512]; | ||||
|     } | ||||
|  | ||||
|     disp_assets_update_progress(fn); | ||||
|  | ||||
|     W25QXX.init(SPI_QUARTER_SPEED); | ||||
|  | ||||
|     uint16_t pbr; | ||||
|     uint32_t pfileSize; | ||||
|     uint32_t totalSizeLoaded = 0; | ||||
| @@ -444,11 +449,14 @@ uint8_t public_buf[512]; | ||||
|     if (dir.open(&root, assetsPath, O_RDONLY)) { | ||||
|  | ||||
|       disp_assets_update(); | ||||
|       disp_assets_update_progress("Erasing pics..."); | ||||
|       spiFlashErase_PIC(); | ||||
|       #if HAS_SPI_FLASH_FONT | ||||
|         disp_assets_update_progress("Erasing fonts..."); | ||||
|         spiFlashErase_FONT(); | ||||
|       #endif | ||||
|  | ||||
|       disp_assets_update_progress("Reading files..."); | ||||
|       dir_t d; | ||||
|       while (dir.readDir(&d, card.longFilename) > 0) { | ||||
|         // if we dont get a long name, but gets a short one, try it | ||||
|   | ||||
| @@ -120,6 +120,7 @@ extern "C" { /* C-declarations for C++ */ | ||||
| #endif | ||||
|  | ||||
| // Flash flag | ||||
| #define REFLSHE_FLGA_ADD                (0X800000-32) | ||||
| #define FLASH_INF_VALID_FLAG            0xAA558761 | ||||
| // SD card information first addr | ||||
| #define VAR_INF_ADDR                    0x000000 | ||||
| @@ -139,7 +140,7 @@ typedef struct pic_msg PIC_MSG; | ||||
|  | ||||
| #define BMP_WRITE_BUF_LEN 512 | ||||
|  | ||||
| #define PICINFOADDR   0 | ||||
| #define PICINFOADDR   0x1000 | ||||
|  | ||||
| #define PIC_SIZE_xM   6 | ||||
| #define FONT_SIZE_xM  2 | ||||
|   | ||||
| @@ -507,9 +507,9 @@ | ||||
| #elif MB(MKS_ROBIN_MINI) | ||||
|   #include "stm32f1/pins_MKS_ROBIN_MINI.h"      // STM32F1                                env:mks_robin_mini | ||||
| #elif MB(MKS_ROBIN_NANO) | ||||
|   #include "stm32f1/pins_MKS_ROBIN_NANO.h"      // STM32F1                                env:mks_robin_nano env:mks_robin_nano35 | ||||
|   #include "stm32f1/pins_MKS_ROBIN_NANO.h"      // STM32F1                                env:mks_robin_nano35 | ||||
| #elif MB(MKS_ROBIN_NANO_V2) | ||||
|   #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h"   // STM32F1                                env:mks_robin_nano env:mks_robin_nano35 | ||||
|   #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h"   // STM32F1                                env:mks_robin_nano35 | ||||
| #elif MB(MKS_ROBIN_LITE) | ||||
|   #include "stm32f1/pins_MKS_ROBIN_LITE.h"      // STM32F1                                env:mks_robin_lite | ||||
| #elif MB(BTT_SKR_MINI_V1_1) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user