🐛 Fix MKS UI compile (#22388, #22395)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Malderin 2021-07-19 05:21:51 +03:00 committed by Scott Lahteine
parent 95f0970d85
commit f1161a9a5f
8 changed files with 92 additions and 98 deletions

View File

@ -70,7 +70,7 @@
#if HAS_TFT_LVGL_UI #if HAS_TFT_LVGL_UI
#include "lcd/extui/mks_ui/tft_lvgl_configuration.h" #include "lcd/extui/mks_ui/tft_lvgl_configuration.h"
#include "lcd/extui/mks_ui/draw_ui.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> #include <lvgl.h>
#endif #endif

View File

@ -25,15 +25,10 @@
#include "draw_ui.h" #include "draw_ui.h"
#include <lv_conf.h> #include <lv_conf.h>
#include "tft_lvgl_configuration.h" #include "tft_lvgl_configuration.h"
#include "SPI_TFT.h" #include "SPI_TFT.h"
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#include "mks_hardware.h"
#if ENABLED(MKS_TEST)
#include "mks_hardware_test.h"
#endif
static lv_obj_t *scr; static lv_obj_t *scr;

View File

@ -39,10 +39,7 @@
#include "draw_touch_calibration.h" #include "draw_touch_calibration.h"
#endif #endif
#if ENABLED(MKS_TEST) #include "mks_hardware.h"
#include "mks_hardware_test.h"
#endif
#include <stdio.h> #include <stdio.h>
#define ICON_POS_Y 38 #define ICON_POS_Y 38
@ -129,7 +126,7 @@ void lv_draw_ready_print() {
ZERO(disp_state_stack._disp_state); ZERO(disp_state_stack._disp_state);
scr = lv_screen_create(PRINT_READY_UI, ""); scr = lv_screen_create(PRINT_READY_UI, "");
if (mks_test_flag == 0x1E) { if (TERN0(SDSUPPORT, mks_test_flag == 0x1E)) {
// Create image buttons // Create image buttons
buttonTool = lv_imgbtn_create(scr, "F:/bmp_tool.bin", event_handler, ID_TOOL); buttonTool = lv_imgbtn_create(scr, "F:/bmp_tool.bin", event_handler, ID_TOOL);

View File

@ -52,7 +52,7 @@
#endif #endif
#if ENABLED(MKS_TEST) #if ENABLED(MKS_TEST)
#include "mks_hardware_test.h" #include "mks_hardware.h"
#endif #endif
CFG_ITMES gCfgItems; CFG_ITMES gCfgItems;
@ -1366,7 +1366,7 @@ void print_time_count() {
void LV_TASK_HANDLER() { void LV_TASK_HANDLER() {
lv_task_handler(); lv_task_handler();
#if ENABLED(MKS_TEST) #if BOTH(MKS_TEST, SDSUPPORT)
if (mks_test_flag == 0x1E) mks_hardware_test(); if (mks_test_flag == 0x1E) mks_hardware_test();
#endif #endif

View File

@ -37,7 +37,7 @@
#if ENABLED(MKS_TEST) #if ENABLED(MKS_TEST)
#include "mks_hardware_test.h" #include "mks_hardware.h"
bool pw_det_sta, pw_off_sta, mt_det_sta; bool pw_det_sta, pw_off_sta, mt_det_sta;
#if PIN_EXISTS(MT_DET_2) #if PIN_EXISTS(MT_DET_2)
@ -127,6 +127,8 @@
delay(100); delay(100);
} }
#if ENABLED(SDSUPPORT)
void mks_gpio_test() { void mks_gpio_test() {
init_test_gpio(); init_test_gpio();
@ -199,6 +201,8 @@
mks_disp_test(); mks_disp_test();
} }
#endif
#endif // MKS_TEST #endif // MKS_TEST
static const uint16_t ASCII_Table_16x24[] PROGMEM = { static const uint16_t ASCII_Table_16x24[] PROGMEM = {
@ -613,10 +617,9 @@ void disp_assets_update_progress(const char *msg) {
disp_string(100, 165, buf, 0xFFFF, 0x0000); disp_string(100, 165, buf, 0xFFFF, 0x0000);
} }
#if BOTH(MKS_TEST, SDSUPPORT)
uint8_t mks_test_flag = 0; uint8_t mks_test_flag = 0;
const char *MKSTestPath = "MKS_TEST"; const char *MKSTestPath = "MKS_TEST";
#if ENABLED(SDSUPPORT)
void mks_test_get() { void mks_test_get() {
SdFile dir, root = card.getroot(); SdFile dir, root = card.getroot();
if (dir.open(&root, MKSTestPath, O_RDONLY)) if (dir.open(&root, MKSTestPath, O_RDONLY))

View File

@ -21,15 +21,19 @@
*/ */
#pragma once #pragma once
#include "../../../inc/MarlinConfigPre.h"
#include <lvgl.h> #include <lvgl.h>
void mks_gpio_test(); // Functions for MKS_TEST
#if BOTH(MKS_TEST, SDSUPPORT)
void mks_hardware_test(); void mks_hardware_test();
void mks_test_get(); void mks_test_get();
void mks_gpio_test();
extern uint8_t mks_test_flag;
#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_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor);
void disp_assets_update(); void disp_assets_update();
void disp_assets_update_progress(const char *msg); void disp_assets_update_progress(const char *msg);
extern uint8_t mks_test_flag;

View File

@ -27,14 +27,9 @@
#include "draw_ui.h" #include "draw_ui.h"
#include "pic_manager.h" #include "pic_manager.h"
#include "draw_ready_print.h" #include "draw_ready_print.h"
#include "mks_hardware.h"
#if ENABLED(MKS_TEST)
#include "mks_hardware_test.h"
#endif
#include "SPIFlashStorage.h" #include "SPIFlashStorage.h"
#include "../../../libs/W25Qxx.h" #include "../../../libs/W25Qxx.h"
#include "../../../sd/cardreader.h" #include "../../../sd/cardreader.h"
#include "../../../MarlinCore.h" #include "../../../MarlinCore.h"

View File

@ -29,7 +29,7 @@
#include "draw_ready_print.h" #include "draw_ready_print.h"
#include "pic_manager.h" #include "pic_manager.h"
#include "mks_hardware_test.h" #include "mks_hardware.h"
#include "draw_ui.h" #include "draw_ui.h"
#include "SPIFlashStorage.h" #include "SPIFlashStorage.h"
#include <lvgl.h> #include <lvgl.h>
@ -139,7 +139,7 @@ void tft_lvgl_init() {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
UpdateAssets(); UpdateAssets();
watchdog_refresh(); // LVGL init takes time watchdog_refresh(); // LVGL init takes time
mks_test_get(); TERN_(MKS_TEST, mks_test_get());
#endif #endif
touch.Init(); touch.Init();
@ -231,7 +231,7 @@ void tft_lvgl_init() {
if (ready) lv_draw_ready_print(); if (ready) lv_draw_ready_print();
#if ENABLED(MKS_TEST) #if BOTH(MKS_TEST, SDSUPPORT)
if (mks_test_flag == 0x1E) mks_gpio_test(); if (mks_test_flag == 0x1E) mks_gpio_test();
#endif #endif
} }