From 42fd14cc309f7b0a4bb3cd84faf8782d23ec63d4 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Thu, 23 Jun 2022 06:18:36 -0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Classic=20UI=20BIQU=20BX=20(#24387)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/Conditionals_LCD.h | 3 +- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 2 +- Marlin/src/lcd/touch/touch_buttons.cpp | 45 +++++++++++--------- Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h | 7 ++- 5 files changed, 35 insertions(+), 26 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 01f9c0237419..e41bc0d48977 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1463,7 +1463,8 @@ #elif ENABLED(TFT_RES_1024x600) #define TFT_WIDTH 1024 #define TFT_HEIGHT 600 - #define GRAPHICAL_TFT_UPSCALE 4 + #define GRAPHICAL_TFT_UPSCALE 6 + #define TFT_PIXEL_OFFSET_X 120 #endif // FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi|ltdc).h diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index adfd3d97a3d4..0f5cd5e6192d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2927,8 +2927,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L #endif #endif -#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 4) - #error "GRAPHICAL_TFT_UPSCALE must be 2, 3, or 4." +#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 6) + #error "GRAPHICAL_TFT_UPSCALE must be between 2 and 6." #endif #if BOTH(CHIRON_TFT_STANDARD, CHIRON_TFT_NEW) diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index e5c6524a9ec4..f38c9d76e3ba 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -124,7 +124,7 @@ #ifndef U8G_COM_SSD_I2C_HAL #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn #endif -#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT +#if HAS_FSMC_GRAPHICAL_TFT || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_TFT_FN u8g_com_hal_tft_fn #else diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index dcdc7def8667..604f366ed4f2 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -68,26 +68,31 @@ uint8_t TouchButtons::read_buttons() { #ifdef HAS_WIRED_LCD int16_t x, y; - const bool is_touched = (TERN(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration.orientation, TOUCH_ORIENTATION) == TOUCH_PORTRAIT ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y)); - #if HAS_TOUCH_SLEEP - if (is_touched) - wakeUp(); - else if (!isSleeping() && ELAPSED(millis(), next_sleep_ms) && ui.on_status_screen()) - sleepTimeout(); - #endif - if (!is_touched) return 0; - - #if ENABLED(TOUCH_SCREEN_CALIBRATION) - const calibrationState state = touch_calibration.get_calibration_state(); - if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) { - if (touch_calibration.handleTouch(x, y)) ui.refresh(); - return 0; - } - x = int16_t((int32_t(x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x; - y = int16_t((int32_t(y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y; - #else - x = uint16_t((uint32_t(x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X; - y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y; + #if ENABLED(TFT_TOUCH_DEVICE_XPT2046) + const bool is_touched = (TERN(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration.orientation, TOUCH_ORIENTATION) == TOUCH_PORTRAIT ? touchIO.getRawPoint(&y, &x) : touchIO.getRawPoint(&x, &y)); + #if HAS_TOUCH_SLEEP + if (is_touched) + wakeUp(); + else if (!isSleeping() && ELAPSED(millis(), next_sleep_ms) && ui.on_status_screen()) + sleepTimeout(); + #endif + if (!is_touched) return 0; + + #if ENABLED(TOUCH_SCREEN_CALIBRATION) + const calibrationState state = touch_calibration.get_calibration_state(); + if (WITHIN(state, CALIBRATION_TOP_LEFT, CALIBRATION_BOTTOM_RIGHT)) { + if (touch_calibration.handleTouch(x, y)) ui.refresh(); + return 0; + } + x = int16_t((int32_t(x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x; + y = int16_t((int32_t(y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y; + #else + x = uint16_t((uint32_t(x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X; + y = uint16_t((uint32_t(y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y; + #endif + #elif ENABLED(TFT_TOUCH_DEVICE_GT911) + bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? touchIO.getPoint(&y, &x) : touchIO.getPoint(&x, &y)); + if (!is_touched) return 0; #endif // Touch within the button area simulates an encoder button diff --git a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h index 5a772eb21b09..ddc0a202ea30 100644 --- a/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h +++ b/Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h @@ -33,6 +33,7 @@ #define MARLIN_EEPROM_SIZE 0x1000 // 4K (24C32) #define HAS_OTG_USB_HOST_SUPPORT // USB Flash Drive support +//#define SWD_DEBUG // Use pins PA13 and PA14 on STM32H7 for the SWD debugger // // Limit Switches @@ -47,8 +48,10 @@ #define FIL_RUNOUT_PIN PD13 #define FIL_RUNOUT2_PIN PB13 -#define LED_PIN PA13 -#define BEEPER_PIN PA14 +#ifndef SWD_DEBUG + #define LED_PIN PA13 + #define BEEPER_PIN PA14 +#endif #define POWER_MONITOR_PIN PB0 #define RPI_POWER_PIN PE5