Skip to content

Commit

Permalink
Fix MKS UI compile (MarlinFirmware#22388)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
2 people authored and ptoal committed Dec 16, 2021
1 parent 16bb542 commit b4272f3
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#if HAS_TFT_LVGL_UI
#include "lcd/extui/mks_ui/tft_lvgl_configuration.h"
#include "lcd/extui/mks_ui/draw_ui.h"
#include "lcd/extui/mks_ui/mks_hardware_test.h"
#include "lcd/extui/mks_ui/mks_hardware.h"
#include <lvgl.h>
#endif

Expand Down
7 changes: 1 addition & 6 deletions Marlin/src/lcd/extui/mks_ui/draw_error_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@

#include "draw_ui.h"
#include <lv_conf.h>

#include "tft_lvgl_configuration.h"

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

#if ENABLED(MKS_TEST)
#include "mks_hardware_test.h"
#endif
#include "mks_hardware.h"

static lv_obj_t *scr;

Expand Down
7 changes: 2 additions & 5 deletions Marlin/src/lcd/extui/mks_ui/draw_ready_print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
#include "draw_touch_calibration.h"
#endif

#if ENABLED(MKS_TEST)
#include "mks_hardware_test.h"
#endif

#include "mks_hardware.h"
#include <stdio.h>

#define ICON_POS_Y 38
Expand Down Expand Up @@ -129,7 +126,7 @@ void lv_draw_ready_print() {
ZERO(disp_state_stack._disp_state);
scr = lv_screen_create(PRINT_READY_UI, "");

if (mks_test_flag == 0x1E) {
if (TERN0(SDSUPPORT, mks_test_flag == 0x1E)) {
// Create image buttons
buttonTool = lv_imgbtn_create(scr, "F:/bmp_tool.bin", event_handler, ID_TOOL);

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/mks_ui/draw_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#endif

#if ENABLED(MKS_TEST)
#include "mks_hardware_test.h"
#include "mks_hardware.h"
#endif

CFG_ITMES gCfgItems;
Expand Down Expand Up @@ -1366,7 +1366,7 @@ void print_time_count() {
void LV_TASK_HANDLER() {
lv_task_handler();

#if ENABLED(MKS_TEST)
#if BOTH(MKS_TEST, SDSUPPORT)
if (mks_test_flag == 0x1E) mks_hardware_test();
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#if ENABLED(MKS_TEST)

#include "mks_hardware_test.h"
#include "mks_hardware.h"

bool pw_det_sta, pw_off_sta, mt_det_sta;
#if PIN_EXISTS(MT_DET_2)
Expand Down Expand Up @@ -613,10 +613,9 @@ void disp_assets_update_progress(const char *msg) {
disp_string(100, 165, buf, 0xFFFF, 0x0000);
}

uint8_t mks_test_flag = 0;
const char *MKSTestPath = "MKS_TEST";

#if ENABLED(SDSUPPORT)
uint8_t mks_test_flag = 0;
const char *MKSTestPath = "MKS_TEST";
void mks_test_get() {
SdFile dir, root = card.getroot();
if (dir.open(&root, MKSTestPath, O_RDONLY))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@
*/
#pragma once

#include "../../../inc/MarlinConfigPre.h"

#include <lvgl.h>

void mks_gpio_test();
void mks_hardware_test();
void mks_test_get();
// Functions for MKS_TEST
#if ENABLED(MKS_TEST)
void mks_gpio_test();
void mks_hardware_test();
void mks_test_get();
#endif

void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor);
// String display and assets
void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor);
void disp_assets_update();
void disp_assets_update_progress(const char *msg);

extern uint8_t mks_test_flag;
#if ENABLED(SDSUPPORT)
extern uint8_t mks_test_flag;
#endif
7 changes: 1 addition & 6 deletions Marlin/src/lcd/extui/mks_ui/pic_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,9 @@
#include "draw_ui.h"
#include "pic_manager.h"
#include "draw_ready_print.h"

#if ENABLED(MKS_TEST)
#include "mks_hardware_test.h"
#endif

#include "mks_hardware.h"
#include "SPIFlashStorage.h"
#include "../../../libs/W25Qxx.h"

#include "../../../sd/cardreader.h"
#include "../../../MarlinCore.h"

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "draw_ready_print.h"

#include "pic_manager.h"
#include "mks_hardware_test.h"
#include "mks_hardware.h"
#include "draw_ui.h"
#include "SPIFlashStorage.h"
#include <lvgl.h>
Expand Down Expand Up @@ -231,7 +231,7 @@ void tft_lvgl_init() {

if (ready) lv_draw_ready_print();

#if ENABLED(MKS_TEST)
#if BOTH(MKS_TEST, SDSUPPORT)
if (mks_test_flag == 0x1E) mks_gpio_test();
#endif
}
Expand Down

0 comments on commit b4272f3

Please sign in to comment.