Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lvgl ui and add support for MKS Robin E3P motherboard #19442

Merged
merged 35 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
aa595f5
Merge pull request #1 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 11, 2020
d5d325c
Merge pull request #2 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 13, 2020
d8d5c0f
Merge pull request #4 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 14, 2020
a1055dd
Merge pull request #6 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 18, 2020
8b349b1
Merge pull request #7 from MarlinFirmware/bugfix-2.0.x
makerbase-mks May 22, 2020
8c42e50
Merge pull request #14 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jun 27, 2020
626ed70
Merge pull request #15 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Jul 1, 2020
80a2552
Merge pull request #16 from MarlinFirmware/bugfix-2.0.x
MKS-Sean Jul 2, 2020
bff1642
Merge pull request #24 from MarlinFirmware/bugfix-2.0.x
makerbase-mks Sep 18, 2020
ef001fa
update lvgl
MKS-Sean Sep 19, 2020
804a0f5
Change to the default configuration
MKS-Sean Sep 19, 2020
7b80a40
Update MarlinCore.cpp
thinkyhead Sep 19, 2020
b83d3ef
Don't mess with power-loss code
thinkyhead Sep 19, 2020
f8f6772
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19442
thinkyhead Sep 19, 2020
a2c9eec
Run pins formatting script
thinkyhead Sep 19, 2020
aeb1612
Remove tabs, fix formatting, code style
thinkyhead Sep 19, 2020
3f4b6f8
Fix Firmware name
thinkyhead Sep 20, 2020
95a75c4
update comments
thinkyhead Sep 20, 2020
29ffcf1
Update boards.h
thinkyhead Sep 20, 2020
28bba41
Reorder M3 boards
thinkyhead Sep 20, 2020
09907b7
Clean up tabs
thinkyhead Sep 20, 2020
fe1dba3
Add multi-extruder condition
thinkyhead Sep 20, 2020
c403231
Add multi-extruder condition
thinkyhead Sep 20, 2020
ba6fc54
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19442
thinkyhead Sep 20, 2020
da1d3bc
More multi-extruder patches
thinkyhead Sep 21, 2020
bc7bf8a
Cleanup before MKS changes
thinkyhead Sep 21, 2020
921c825
Add HAS_ROTARY_ENCODER
thinkyhead Sep 21, 2020
c7070b0
Fix include
thinkyhead Sep 21, 2020
3b36a4b
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19442
thinkyhead Sep 21, 2020
8d1cb1a
[cron] Bump distribution date (2020-09-21)
thinkyhead Sep 21, 2020
7cc6f01
Update wifi_module.cpp
thinkyhead Sep 21, 2020
95c1cb4
Update stepper.h
thinkyhead Sep 21, 2020
f4c451a
Fix NTSH issue
thinkyhead Sep 21, 2020
f2f07f0
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19442
thinkyhead Sep 21, 2020
bee7059
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into pr/19442
thinkyhead Sep 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Marlin/src/HAL/STM32F1/tft/tft_fsmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ uint32_t TFT_FSMC::GetID() {
id = ReadID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = ReadID(LCD_READ_ID4);
if ((id & 0xFF00) == 0 && (id & 0xFF) != 0)
id = ReadID(LCD_READ_ID4);
return id;
}

Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,10 @@ void kill(PGM_P const lcd_error/*=nullptr*/, PGM_P const lcd_component/*=nullptr
UNUSED(lcd_component);
#endif

#if HAS_TFT_LVGL_UI
lv_draw_error_message(lcd_error);
#endif

#ifdef ACTION_ON_KILL
host_action_kill();
#endif
Expand Down Expand Up @@ -920,6 +924,13 @@ void setup() {
SERIAL_ECHO_MSG("start");
#endif

#if BOTH(HAS_TFT_LVGL_UI, USE_WIFI_FUNCTION)
mks_esp_wifi_init();
WIFISERIAL.begin(WIFI_BAUDRATE);
serial_connect_timeout = millis() + 1000UL;
while (/*!WIFISERIAL && */PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
#endif

SETUP_RUN(HAL_init());

#if HAS_L64XX
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
#define BOARD_CREALITY_V4 4033 // Creality v4.x (STM32F103RE)
#define BOARD_CREALITY_V427 4034 // Creality v4.2.7 (STM32F103RE)
#define BOARD_TRIGORILLA_PRO 4035 // Trigorilla Pro (STM32F103ZET6)
#define BOARD_MKS_ROBIN_E3P 4036 // MKS Robin E3p (STM32F103VET6)

//
// ARM Cortex-M4F
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,10 @@
#endif
#endif

#if BUTTONS_EXIST(EN1, EN2, ENC)
#define HAS_ROTARY_ENCODER 1
#endif

#if !NUM_SERIAL
#undef BAUD_RATE_GCODE
#elif NUM_SERIAL > 1
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "../../../../inc/MarlinConfig.h"
#include "SPIFlashStorage.h"

extern W25QXXFlash W25QXX;

uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize];
uint32_t SPIFlashStorage::m_currentPage;
uint16_t SPIFlashStorage::m_pageDataUsed;
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "SPI_TFT.h"
#include "pic_manager.h"
#include "tft_lvgl_configuration.h"

#include "../../../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -74,6 +75,7 @@ void TFT::SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
}

void TFT::LCD_init() {
TFT_BLK_L;
TFT_RST_H;
delay(150);
TFT_RST_L;
Expand All @@ -92,8 +94,7 @@ void TFT::LCD_init() {
LCD_WR_DATA(0x96);

LCD_WR_REG(0x36);
LCD_WR_DATA(0x28);

LCD_WR_DATA(0x28 + TERN0(GRAPHICAL_TFT_ROTATE_180, 0x80));
LCD_WR_REG(0x3A);
LCD_WR_DATA(0x55);

Expand Down
40 changes: 25 additions & 15 deletions Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
#include "../../../../MarlinCore.h"
#include "../../../../module/temperature.h"

extern lv_group_t * g;
static lv_obj_t * scr;
static lv_obj_t * fw_type, *board, *fw_version;
static lv_obj_t * fw_type, *board; //*fw_version;

#define ID_A_RETURN 1

Expand Down Expand Up @@ -73,42 +74,46 @@ void lv_draw_about(void) {

lv_refr_now(lv_refr_get_disp_refreshing());

LV_IMG_DECLARE(bmp_pic);

/*Create an Image button*/
// Create an Image button
buttonBack = lv_imgbtn_create(scr, NULL);

#if 1
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, NULL, 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, "F:/bmp_return.bin");
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, "F:/bmp_return.bin");
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_add_obj(g, buttonBack);
#endif
#endif

lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
/*Create a label on the Image button*/

// Create a label on the Image button
label_Back = lv_label_create(buttonBack, NULL);

if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}

fw_version = lv_label_create(scr, NULL);
lv_obj_set_style(fw_version, &tft_style_label_rel);
lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
//fw_version = lv_label_create(scr, NULL);
//lv_obj_set_style(fw_version, &tft_style_label_rel);
//lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
//lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);

fw_type = lv_label_create(scr, NULL);
lv_obj_set_style(fw_type, &tft_style_label_rel);
lv_label_set_text(fw_type,
#if MB(MKS_ROBIN_PRO)
"Firmware: Robin_Pro35"
"Firmware: Marlin-bugfix2.0.x-MKS-2.1.0"
thinkyhead marked this conversation as resolved.
Show resolved Hide resolved
#elif MB(MKS_ROBIN_NANO, MKS_ROBIN_NANO_V2)
"Firmware: Robin_Nano35"
"Firmware: Marlin-bugfix2.0.x-MKS-2.1.0"
#elif MB(MKS_ROBIN_E3P)
"Firmware: Marlin-bugfix2.0.x-MKS-2.1.0"
#else
CUSTOM_MACHINE_NAME
#endif
Expand All @@ -118,9 +123,14 @@ void lv_draw_about(void) {
board = lv_label_create(scr, NULL);
lv_obj_set_style(board, &tft_style_label_rel);
lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, -60);
}

void lv_clear_about() { lv_obj_del(scr); }
void lv_clear_about() {
#if HAS_ROTARY_ENCODER
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
#endif
lv_obj_del(scr);
}

#endif // HAS_TFT_LVGL_UI
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/lib/mks_ui/draw_about.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
#pragma once

#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
extern "C" { /* C-declarations for C++ */
#endif

extern void lv_draw_about(void);
extern void lv_clear_about();

//extern void disp_temp_ready_print();
#ifdef __cplusplus
} /* C-declarations for C++ */
} /* C-declarations for C++ */
#endif
Loading