diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f2524cadb..60f7ed159 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2142,6 +2142,7 @@ // // FSMC display (MKS Robin, Alfawise U20, JGAurora A5S, REXYZ A1, etc.) +// Upscaled 128x64 Marlin UI // //#define FSMC_GRAPHICAL_TFT @@ -2149,17 +2150,11 @@ // TFT LVGL UI // // Using default MKS icons and fonts from: https://git.io/JJvzK -// Just copy the `assets` folder from the build directory to the +// Just copy the 'assets' folder from the build directory to the // root of your SD card, together with the compiled firmware. // -// Robin nano v1.2 uses FSMC -// -//#define TFT_LVGL_UI_FSMC - -// Robin nano v2.0 uses SPI -// -//#define TFT_LVGL_UI_SPI - +//#define TFT_LVGL_UI_FSMC // Robin nano v1.2 uses FSMC +//#define TFT_LVGL_UI_SPI // Robin nano v2.0 uses SPI //============================================================================= //============================ Other Controllers ============================ diff --git a/Marlin/src/HAL/STM32/HAL.cpp b/Marlin/src/HAL/STM32/HAL.cpp index 8a619bfb5..b1b727ce1 100644 --- a/Marlin/src/HAL/STM32/HAL.cpp +++ b/Marlin/src/HAL/STM32/HAL.cpp @@ -63,7 +63,7 @@ uint16_t HAL_adc_result; void HAL_init() { FastIO_init(); - #if ENABLED(SDSUPPORT) + #if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up #endif diff --git a/Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp b/Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp index bab77b55d..9d32b342e 100644 --- a/Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp +++ b/Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp @@ -41,8 +41,7 @@ } bool SDIO_Init() { - if (hsd.State == HAL_SD_STATE_READY) return 1; // return passing status - return 0; // return failing status + return hsd.State == HAL_SD_STATE_READY; // return pass/fail status } bool SDIO_ReadBlock(uint32_t block, uint8_t *src) { @@ -58,7 +57,6 @@ #else // !USBD_USE_CDC_COMPOSITE // use local drivers - #if defined(STM32F103xE) || defined(STM32F103xG) #include #include @@ -274,7 +272,6 @@ bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) { hsd.Instance = SDIO; uint8_t retryCnt = SD_RETRY_COUNT; - bool status; for (;;) { status = (bool) HAL_SD_WriteBlocks(&hsd, (uint8_t*)src, block, 1, 500); // write one 512 byte block with 500mS timeout diff --git a/Marlin/src/HAL/STM32/fastio.h b/Marlin/src/HAL/STM32/fastio.h index 38a2e28cf..d90b2fbeb 100644 --- a/Marlin/src/HAL/STM32/fastio.h +++ b/Marlin/src/HAL/STM32/fastio.h @@ -64,12 +64,14 @@ void FastIO_init(); // Must be called before using fast io macros #define _GET_MODE(IO) #define _SET_MODE(IO,M) pinMode(IO, M) #define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */ +#define _SET_OUTPUT_OD(IO) pinMode(IO, OUTPUT_OPEN_DRAIN) #define WRITE(IO,V) _WRITE(IO,V) #define READ(IO) _READ(IO) #define TOGGLE(IO) _TOGGLE(IO) #define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0) +#define OUT_WRITE_OD(IO,V) do{ _SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0) #define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */ #define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */ diff --git a/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h b/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h index 5fd916624..656fbe1ce 100644 --- a/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32F1/inc/Conditionals_post.h @@ -27,3 +27,8 @@ #elif EITHER(I2C_EEPROM, SPI_EEPROM) #define USE_SHARED_EEPROM 1 #endif + +// Allow SDSUPPORT to be disabled +#if DISABLED(SDSUPPORT) + #undef SDIO_SUPPORT +#endif diff --git a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h index 47f4f59b2..5559b3d4a 100644 --- a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h @@ -29,10 +29,6 @@ #error "EMERGENCY_PARSER is not yet implemented for STM32F1. Disable EMERGENCY_PARSER to continue." #endif -#if ENABLED(SDIO_SUPPORT) && DISABLED(SDSUPPORT) - #error "SDIO_SUPPORT requires SDSUPPORT. Enable SDSUPPORT to continue." -#endif - #if ENABLED(FAST_PWM_FAN) #error "FAST_PWM_FAN is not yet implemented for this platform." #endif diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp index dbd6f4c11..fc7a22b26 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp @@ -597,7 +597,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u case U8G_DEV_MSG_INIT: dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, &lcd_id); - switch(lcd_id & 0xFFFF) { + switch (lcd_id & 0xFFFF) { case 0x8552: // ST7789V #ifdef LCD_USE_DMA_FSMC writeEscSequence(st7789v_init); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp index dabecfb9d..7d3eab436 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp @@ -95,7 +95,7 @@ void lv_draw_advance_settings(void) { buttonPausePos = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonPausePos, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ lv_obj_set_size(buttonPausePos, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonPausePos, event_handler, ID_PAUSE_POS, NULL, 0); lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp index af16367b6..d441f2ac5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp @@ -137,7 +137,7 @@ void lv_draw_machine_para(void) { buttonMachine = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonMachine, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ lv_obj_set_size(buttonMachine, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonMachine, event_handler, ID_PARA_MACHINE, NULL, 0); lv_btn_set_style(buttonMachine, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonMachine, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ @@ -159,7 +159,7 @@ void lv_draw_machine_para(void) { buttonMotor = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonMotor, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ lv_obj_set_size(buttonMotor, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMotor, event_handler); + //lv_obj_set_event_cb(buttonMotor, event_handler); lv_obj_set_event_cb_mks(buttonMotor, event_handler, ID_PARA_MOTOR, NULL, 0); lv_btn_set_style(buttonMotor, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonMotor, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ @@ -181,7 +181,7 @@ void lv_draw_machine_para(void) { buttonAdvance = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonAdvance, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ lv_obj_set_size(buttonAdvance, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMotor, event_handler); + //lv_obj_set_event_cb(buttonMotor, event_handler); lv_obj_set_event_cb_mks(buttonAdvance, event_handler, ID_PARA_ADVANCE, NULL, 0); lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp index 982dd4408..88a66c659 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp @@ -144,7 +144,7 @@ void lv_draw_machine_settings(void) { buttonAcceleration = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ lv_obj_set_size(buttonAcceleration, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonAcceleration, event_handler, ID_MACHINE_ACCELERATION, NULL, 0); lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ @@ -166,7 +166,7 @@ void lv_draw_machine_settings(void) { buttonMaxFeedrate = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonMaxFeedrate, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ lv_obj_set_size(buttonMaxFeedrate, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonMaxFeedrate, event_handler, ID_MACHINE_FEEDRATE, NULL, 0); lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ @@ -189,7 +189,7 @@ void lv_draw_machine_settings(void) { buttonJerk = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonJerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ lv_obj_set_size(buttonJerk, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMotor, event_handler); + //lv_obj_set_event_cb(buttonMotor, event_handler); lv_obj_set_event_cb_mks(buttonJerk, event_handler, ID_MACHINE_JERK, NULL, 0); lv_btn_set_style(buttonJerk, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonJerk, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp index 1d8f80b9b..7da477bd5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp @@ -147,7 +147,7 @@ void lv_draw_motor_settings(void) { buttonSteps = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonSteps, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/ lv_obj_set_size(buttonSteps, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonSteps, event_handler, ID_MOTOR_STEPS, NULL, 0); lv_btn_set_style(buttonSteps, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonSteps, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ @@ -169,7 +169,7 @@ void lv_draw_motor_settings(void) { buttonTMCcurrent = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonTMCcurrent, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/ lv_obj_set_size(buttonTMCcurrent, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonTMCcurrent, event_handler, ID_MOTOR_TMC_CURRENT, NULL, 0); lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ @@ -192,7 +192,7 @@ void lv_draw_motor_settings(void) { buttonStepMode = lv_btn_create(scr, NULL); /*Add a button the current screen*/ lv_obj_set_pos(buttonStepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/ lv_obj_set_size(buttonStepMode, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/ - // lv_obj_set_event_cb(buttonMachine, event_handler); + //lv_obj_set_event_cb(buttonMachine, event_handler); lv_obj_set_event_cb_mks(buttonStepMode, event_handler, ID_MOTOR_STEP_MODE, NULL, 0); lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/ lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/ diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp index 555c228f0..e0d29467e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp @@ -228,7 +228,7 @@ void lv_draw_move_motor(void) { lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_label_pre); lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_label_rel); - // lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0); + //lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0); lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, &bmp_pic); lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, &bmp_pic); lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_label_pre); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp index 84853cff9..33405a905 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp @@ -72,12 +72,14 @@ uint8_t sel_id = 0; const uint16_t nr = SD_ORDER(i, fileCnt); card.getfilename_sorted(nr); - if (card.flag.filenameIsDir) + if (card.flag.filenameIsDir) { //SERIAL_ECHOLN(card.longest_filename); list_file.IsFolder[valid_name_cnt] = 1; - else + } + else { //SERIAL_ECHOLN(card.longFilename); list_file.IsFolder[valid_name_cnt] = 0; + } #if 1 // @@ -523,7 +525,7 @@ void lv_gcode_file_read(uint8_t *data_buf) { //Color = (*p_index >> 8); //*p_index = Color | ((*p_index & 0xff) << 8); i += 2; - if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // 0x18C3; // + if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // 0x18C3; } #endif // TFT_LVGL_UI_SPI memcpy(data_buf, public_buf, 200); @@ -556,7 +558,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) { #endif beginIndex = (strIndex1 != 0 - // && (strIndex2 != 0) && (strIndex1 < strIndex2) + //&& (strIndex2 != 0) && (strIndex1 < strIndex2) ) ? strIndex1 + 1 : tmpFile; if (strIndex2 == 0 || (strIndex1 > strIndex2)) { // not gcode file diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp index 5e776a1c6..b0d40fde2 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp @@ -73,7 +73,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { stepperX.refresh_stepping_mode(); lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0); lv_label_set_text(labelXState, machine_menu.disable); - // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); + //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); // gcode.process_subcommands_now_P(PSTR("M500")); } else { @@ -96,7 +96,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { stepperY.refresh_stepping_mode(); lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0); lv_label_set_text(labelYState, machine_menu.disable); - // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); + //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); } else { stepperY.stored.stealthChop_enabled = true; @@ -117,7 +117,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { stepperZ.refresh_stepping_mode(); lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0); lv_label_set_text(labelZState, machine_menu.disable); - // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); + //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); } else { stepperZ.stored.stealthChop_enabled = true; @@ -138,7 +138,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { stepperE0.refresh_stepping_mode(); lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0); lv_label_set_text(labelE0State, machine_menu.disable); - // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); + //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); } else { stepperE0.stored.stealthChop_enabled = true; @@ -160,7 +160,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { stepperE1.refresh_stepping_mode(); lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0); lv_label_set_text(labelE1State, machine_menu.disable); - // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); + //lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0); } else { stepperE1.stored.stealthChop_enabled = true; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp index 2e6d164c0..91dd2f36a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp @@ -125,7 +125,7 @@ void lv_draw_tool(void) { scr = lv_obj_create(NULL, NULL); - // static lv_style_t tool_style; + //static lv_style_t tool_style; lv_obj_set_style(scr, &tft_style_scr); lv_scr_load(scr); @@ -182,17 +182,17 @@ void lv_draw_tool(void) { lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_PR, &tft_style_label_pre); lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_REL, &tft_style_label_rel); - // lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,"bmp_Filamentchange.bin",0); - // lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic); - // lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic); - // lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre); - // lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel); + //lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,"bmp_Filamentchange.bin",0); + //lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic); + //lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic); + //lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre); + //lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel); - // lv_obj_set_event_cb_mks(buttonMore, event_handler,ID_T_MORE,"bmp_More.bin",0); - // lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_REL, &bmp_pic); - // lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_PR, &bmp_pic); - // lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_PR, &tft_style_label_pre); - // lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_REL, &tft_style_label_rel); + //lv_obj_set_event_cb_mks(buttonMore, event_handler,ID_T_MORE,"bmp_More.bin",0); + //lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_REL, &bmp_pic); + //lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_PR, &bmp_pic); + //lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_PR, &tft_style_label_pre); + //lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_REL, &tft_style_label_rel); lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_T_RETURN, "bmp_return.bin", 0); lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic); @@ -206,8 +206,8 @@ void lv_draw_tool(void) { lv_obj_set_pos(buttonMove, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight); lv_obj_set_pos(buttonHome, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight); lv_obj_set_pos(buttonLevel, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight); - // lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight); - // lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight); + //lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight); + //lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight); lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight); /*Create a label on the Image button*/ @@ -216,8 +216,8 @@ void lv_draw_tool(void) { lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF); lv_btn_set_layout(buttonHome, LV_LAYOUT_OFF); lv_btn_set_layout(buttonLevel, LV_LAYOUT_OFF); - // lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF); - // lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF); + //lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF); + //lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF); lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF); lv_obj_t * labelPreHeat = lv_label_create(buttonPreHeat, NULL); @@ -251,11 +251,11 @@ void lv_draw_tool(void) { lv_label_set_text(label_Level, tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling)); lv_obj_align(label_Level, buttonLevel, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); - // lv_label_set_text(label_Filament, tool_menu.filament); - // lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); + //lv_label_set_text(label_Filament, tool_menu.filament); + //lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); - // lv_label_set_text(label_More, tool_menu.more); - // lv_obj_align(label_More, buttonMore, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); + //lv_label_set_text(label_More, tool_menu.more); + //lv_obj_align(label_More, buttonMore, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); 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); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp index 75e9b7cdc..5fb3bf6d7 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp @@ -361,7 +361,7 @@ char *getDispText(int index) { strcpy(public_buf_l, tool_menu.title); break; case WIFI_LIST_UI: - // strcpy(public_buf_l, list_menu.title); + //strcpy(public_buf_l, list_menu.title); break; case MACHINE_PARA_UI: strcpy(public_buf_l, MachinePara_menu.title); @@ -386,7 +386,7 @@ char *creat_title_text() { ZERO(tmpCurFileStr); #if _LFN_UNICODE - // cutFileName((TCHAR *)curFileName, 16, 16, (TCHAR *)tmpCurFileStr); + //cutFileName((TCHAR *)curFileName, 16, 16, (TCHAR *)tmpCurFileStr); #else cutFileName(list_file.long_name[sel_id], 16, 16, tmpCurFileStr); #endif @@ -434,8 +434,8 @@ char *creat_title_text() { void preview_gcode_prehandle(char *path) { #if ENABLED(SDSUPPORT) - // uint8_t re; - // uint32_t read; + //uint8_t re; + //uint32_t read; uint32_t pre_read_cnt = 0; uint32_t *p1; char *cur_name; @@ -468,11 +468,11 @@ char *creat_title_text() { void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) { #if ENABLED(SDSUPPORT) - // uint8_t ress; - // uint32_t write; + //uint8_t ress; + //uint32_t write; volatile uint32_t i, j; volatile uint16_t *p_index; - // int res; + //int res; char *cur_name; cur_name = strrchr(path, '/'); @@ -493,12 +493,12 @@ char *creat_title_text() { } } - // SERIAL_ECHOLNPAIR("gPicturePreviewStart: ", gPicturePreviewStart, " PREVIEW_LITTLE_PIC_SIZE: ", PREVIEW_LITTLE_PIC_SIZE); + //SERIAL_ECHOLNPAIR("gPicturePreviewStart: ", gPicturePreviewStart, " PREVIEW_LITTLE_PIC_SIZE: ", PREVIEW_LITTLE_PIC_SIZE); card.setIndex((gPicturePreviewStart + To_pre_view) + size * row + 8); #if ENABLED(TFT_LVGL_UI_SPI) SPI_TFT.spi_init(SPI_FULL_SPEED); - // SPI_TFT.SetCursor(0,0); + //SPI_TFT.SetCursor(0,0); SPI_TFT.SetWindows(xpos_pixel, ypos_pixel + row, 200, 1); SPI_TFT.LCD_WriteRAM_Prepare(); #else @@ -534,7 +534,7 @@ char *creat_title_text() { #else for (i = 0; i < 400;) { p_index = (uint16_t *)(&bmp_public_buf[i]); - if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // gCfgItems.preview_bk_color; + if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; //gCfgItems.preview_bk_color; LCD_IO_WriteData(*p_index); i += 2; } @@ -550,7 +550,7 @@ char *creat_title_text() { row = 0; gcode_preview_over = 0; - // flash_preview_begin = 1; + //flash_preview_begin = 1; card.closefile(); @@ -586,7 +586,7 @@ char *creat_title_text() { card.openFileRead(cur_name); if (card.isFileOpen()) { feedrate_percentage = 100; - // saved_feedrate_percentage = feedrate_percentage; + //saved_feedrate_percentage = feedrate_percentage; planner.flow_percentage[0] = 100; planner.e_factor[0] = planner.flow_percentage[0] * 0.01; if (EXTRUDERS == 2) { @@ -607,11 +607,11 @@ char *creat_title_text() { void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) { #if ENABLED(SDSUPPORT) - // uint8_t ress; - // uint32_t write; + //uint8_t ress; + //uint32_t write; volatile uint32_t i, j; volatile uint16_t *p_index; - // int res; + //int res; char *cur_name; uint16_t Color; @@ -621,7 +621,7 @@ char *creat_title_text() { card.setIndex((PREVIEW_LITTLE_PIC_SIZE + To_pre_view) + size * row + 8); #if ENABLED(TFT_LVGL_UI_SPI) SPI_TFT.spi_init(SPI_FULL_SPEED); - // SPI_TFT.SetCursor(0,0); + //SPI_TFT.SetCursor(0,0); SPI_TFT.SetWindows(xpos_pixel, ypos_pixel + row, 200, 1); SPI_TFT.LCD_WriteRAM_Prepare(); #else @@ -685,7 +685,7 @@ char *creat_title_text() { row = 0; gcode_preview_over = 0; - // flash_preview_begin = 1; + //flash_preview_begin = 1; card.closefile(); @@ -721,7 +721,7 @@ char *creat_title_text() { card.openFileRead(cur_name); if (card.isFileOpen()) { feedrate_percentage = 100; - // saved_feedrate_percentage = feedrate_percentage; + //saved_feedrate_percentage = feedrate_percentage; planner.flow_percentage[0] = 100; planner.e_factor[0] = planner.flow_percentage[0] * 0.01; if (EXTRUDERS == 2) { @@ -779,9 +779,9 @@ char *creat_title_text() { i = 0; #if ENABLED(TFT_LVGL_UI_SPI) - // SPI_TFT.spi_init(SPI_FULL_SPEED); - // SPI_TFT.SetWindows(xpos_pixel, y_off * 20+ypos_pixel, 200,20); //200*200 - // SPI_TFT.LCD_WriteRAM_Prepare(); + //SPI_TFT.spi_init(SPI_FULL_SPEED); + //SPI_TFT.SetWindows(xpos_pixel, y_off * 20+ypos_pixel, 200,20); //200*200 + //SPI_TFT.LCD_WriteRAM_Prepare(); int j = 0; for (_y = y_off * 20; _y < (y_off + 1) * 20; _y++) { SPI_TFT.spi_init(SPI_FULL_SPEED); @@ -789,7 +789,7 @@ char *creat_title_text() { SPI_TFT.LCD_WriteRAM_Prepare(); j++; - // memcpy(public_buf,&bmp_public_buf[i],400); + //memcpy(public_buf,&bmp_public_buf[i],400); SPI_TFT_CS_L; SPI_TFT_DC_H; SPI.dmaSend(&bmp_public_buf[i], 400, true); @@ -814,13 +814,13 @@ char *creat_title_text() { else { p_index = (uint16_t *)(&bmp_public_buf[i]); } - if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // gCfgItems.preview_bk_color; + if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; //gCfgItems.preview_bk_color; LCD_IO_WriteData(*p_index); i += 2; } if (i >= 8000) break; } - #endif // if ENABLED(TFT_LVGL_UI_SPI) + #endif // TFT_LVGL_UI_SPI y_off++; } W25QXX.init(SPI_QUARTER_SPEED); @@ -841,7 +841,7 @@ char *creat_title_text() { } #endif } -#endif // if HAS_GCODE_PREVIEW +#endif // HAS_GCODE_PREVIEW void print_time_run() { static uint8_t lastSec = 0; @@ -866,7 +866,7 @@ void GUI_RefreshPage() { switch (disp_state) { case MAIN_UI: - // lv_draw_ready_print(); + //lv_draw_ready_print(); break; case EXTRUSION_UI: if (temperature_change_frequency == 1) { @@ -1053,7 +1053,7 @@ void clear_cur_ui() { switch (disp_state_stack._disp_state[disp_state_stack._disp_index]) { case PRINT_READY_UI: - // Get_Temperature_Flg = 0; + //Get_Temperature_Flg = 0; lv_clear_ready_print(); break; case PRINT_FILE_UI: @@ -1251,7 +1251,7 @@ void clear_cur_ui() { default: break; } - // GUI_Clear(); + //GUI_Clear(); } void draw_return_ui() { @@ -1501,14 +1501,14 @@ void print_time_count() { } void LV_TASK_HANDLER() { - // lv_tick_inc(1); + //lv_tick_inc(1); lv_task_handler(); if (mks_test_flag == 0x1e) mks_hardware_test(); #if HAS_GCODE_PREVIEW disp_pre_gcode(2, 36); #endif GUI_RefreshPage(); - // sd_detection(); + //sd_detection(); } #endif // HAS_TFT_LVGL_UI diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index efec3edcd..dd0d1e946 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -253,9 +253,8 @@ #define BEEPER_PIN PC5 #define BTN_ENC PE13 -#else - #if ENABLED(TFT_LITTLE_VGL_UI) - //FSMC LCD +#elif ENABLED(TFT_LITTLE_VGL_UI) + #define FSMC_CS_PIN PD7 // NE4 #define FSMC_RS_PIN PD11 // A0 @@ -266,9 +265,7 @@ #define LCD_BACKLIGHT_PIN PD13 - #endif // TFT_LITTLE_VGL_UI - -#endif // TFT_LVGL_UI_SPI +#endif #if HAS_SPI_LCD