Skip to content

Commit

Permalink
✨ Classic UI BIQU BX (MarlinFirmware#24387)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and LCh-77 committed Jul 19, 2022
1 parent 8055215 commit 46eb671
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 26 deletions.
3 changes: 2 additions & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2923,8 +2923,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#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)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/HAL_LCD_com_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 25 additions & 20 deletions Marlin/src/lcd/touch/touch_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 46eb671

Please sign in to comment.