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

This commit is contained in:
Victor Oliveira 2020-07-26 01:08:30 -03:00 committed by GitHub
parent d0222e5c76
commit 3eef000e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 25 deletions

View File

@ -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() {

View File

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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -574,27 +574,20 @@ build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE
#
# MKS Robin Nano (STM32F103VET6) - Emulated Graphical 128x64 (DOGM) UI and LVGL UI
# MKS Robin Nano (STM32F103VET6)
# v1.2 - Emulated Graphical 128x64 (DOGM) UI and LVGL UI
# v2.0 - LVGL UI
#
[env:mks_robin_nano]
platform = ${common_stm32f1.platform}
extends = common_stm32f1
board = genericSTM32F103VE
platform_packages = tool-stm32duino
extra_scripts = ${common.extra_scripts}
buildroot/share/PlatformIO/scripts/mks_robin_nano.py
build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE -DSS_TIMER=4
#
# MKS Robin Nano v2.0 (STM32F103VET6) - LVGL UI
#
[env:mks_robin_nano35_v2]
[env:mks_robin_nano35]
platform = ${common_stm32f1.platform}
extends = env:mks_robin_nano
extends = common_stm32f1
board = genericSTM32F103VE
platform_packages = tool-stm32duino
extra_scripts = ${common.extra_scripts}
buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
lib_deps = ${common_stm32f1.lib_deps}
build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE -DSS_TIMER=4
debug_tool = jlink
upload_protocol = jlink