🐛 Fix TFT Touch Calibration overrides (#25579)
…and other misc. display-related updates Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
dbed3f1c41
commit
7642bfbf8b
|
@ -245,7 +245,6 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
|
||||||
TERN_(TFT_SHARED_IO, while (isBusy()));
|
TERN_(TFT_SHARED_IO, while (isBusy()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
||||||
DMAtx.Init.MemInc = MemoryIncrease;
|
DMAtx.Init.MemInc = MemoryIncrease;
|
||||||
HAL_DMA_Init(&DMAtx);
|
HAL_DMA_Init(&DMAtx);
|
||||||
|
|
|
@ -94,25 +94,24 @@ uint32_t TFT_SPI::GetID() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
||||||
#if !PIN_EXISTS(TFT_MISO)
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
uint8_t d = 0;
|
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
|
|
||||||
|
#if PIN_EXISTS(TFT_MISO)
|
||||||
SPIx.setClockDivider(SPI_CLOCK_DIV16);
|
SPIx.setClockDivider(SPI_CLOCK_DIV16);
|
||||||
DataTransferBegin(DATASIZE_8BIT);
|
DataTransferBegin(DATASIZE_8BIT);
|
||||||
WriteReg(Reg);
|
WriteReg(Reg);
|
||||||
|
|
||||||
LOOP_L_N(i, 4) {
|
LOOP_L_N(i, 4) {
|
||||||
SPIx.read((uint8_t*)&d, 1);
|
uint8_t d;
|
||||||
|
SPIx.read(&d, 1);
|
||||||
data = (data << 8) | d;
|
data = (data << 8) | d;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTransferEnd();
|
DataTransferEnd();
|
||||||
SPIx.setClockDivider(SPI_CLOCK_MAX);
|
SPIx.setClockDivider(SPI_CLOCK_MAX);
|
||||||
|
#endif
|
||||||
|
|
||||||
return data >> 7;
|
return data >> 7;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TFT_SPI::isBusy() {
|
bool TFT_SPI::isBusy() {
|
||||||
|
|
|
@ -328,18 +328,15 @@
|
||||||
#define IS_ULTIPANEL 1
|
#define IS_ULTIPANEL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TFT Legacy Compatibility
|
// TFT Legacy options masquerade as TFT_GENERIC
|
||||||
#if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
|
#if ANY(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
|
||||||
#define IS_LEGACY_TFT 1
|
#define IS_LEGACY_TFT 1
|
||||||
#define TFT_GENERIC
|
#define TFT_GENERIC
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC)
|
#if ANY(FSMC_GRAPHICAL_TFT, TFT_320x240, TFT_480x320, TFT_LVGL_UI_FSMC)
|
||||||
#define TFT_INTERFACE_FSMC
|
#define TFT_INTERFACE_FSMC
|
||||||
#elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI)
|
#elif ANY(SPI_GRAPHICAL_TFT, TFT_320x240_SPI, TFT_480x320_SPI, TFT_LVGL_UI_SPI)
|
||||||
#define TFT_INTERFACE_SPI
|
#define TFT_INTERFACE_SPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT)
|
#if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT)
|
||||||
#define TFT_CLASSIC_UI
|
#define TFT_CLASSIC_UI
|
||||||
#elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI)
|
#elif ANY(TFT_320x240, TFT_480x320, TFT_320x240_SPI, TFT_480x320_SPI)
|
||||||
|
@ -347,6 +344,7 @@
|
||||||
#elif EITHER(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
|
#elif EITHER(TFT_LVGL_UI_FSMC, TFT_LVGL_UI_SPI)
|
||||||
#define TFT_LVGL_UI
|
#define TFT_LVGL_UI
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// FSMC/SPI TFT Panels (LVGL)
|
// FSMC/SPI TFT Panels (LVGL)
|
||||||
#if ENABLED(TFT_LVGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
@ -1671,7 +1669,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ANY(HAS_SPI_TFT, HAS_FSMC_TFT, HAS_LTDC_TFT)
|
#if ANY(HAS_SPI_TFT, HAS_FSMC_TFT, HAS_LTDC_TFT)
|
||||||
#include "../lcd/tft_io/tft_orientation.h"
|
#include "../lcd/tft_io/tft_orientation.h" // for TFT_COLOR_UI_PORTRAIT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TFT_RES_320x240)
|
#if ENABLED(TFT_RES_320x240)
|
||||||
|
@ -1775,17 +1773,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// XPT2046_** Compatibility
|
|
||||||
#if !(defined(TOUCH_CALIBRATION_X) || defined(TOUCH_CALIBRATION_Y) || defined(TOUCH_OFFSET_X) || defined(TOUCH_OFFSET_Y) || defined(TOUCH_ORIENTATION))
|
|
||||||
#if defined(XPT2046_X_CALIBRATION) && defined(XPT2046_Y_CALIBRATION) && defined(XPT2046_X_OFFSET) && defined(XPT2046_Y_OFFSET)
|
|
||||||
#define TOUCH_CALIBRATION_X XPT2046_X_CALIBRATION
|
|
||||||
#define TOUCH_CALIBRATION_Y XPT2046_Y_CALIBRATION
|
|
||||||
#define TOUCH_OFFSET_X XPT2046_X_OFFSET
|
|
||||||
#define TOUCH_OFFSET_Y XPT2046_Y_OFFSET
|
|
||||||
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) \
|
#if X_HOME_DIR || (HAS_Y_AXIS && Y_HOME_DIR) || (HAS_Z_AXIS && Z_HOME_DIR) \
|
||||||
|| (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR) \
|
|| (HAS_I_AXIS && I_HOME_DIR) || (HAS_J_AXIS && J_HOME_DIR) || (HAS_K_AXIS && K_HOME_DIR) \
|
||||||
|| (HAS_U_AXIS && U_HOME_DIR) || (HAS_V_AXIS && V_HOME_DIR) || (HAS_W_AXIS && W_HOME_DIR)
|
|| (HAS_U_AXIS && U_HOME_DIR) || (HAS_V_AXIS && V_HOME_DIR) || (HAS_W_AXIS && W_HOME_DIR)
|
||||||
|
|
|
@ -560,7 +560,7 @@
|
||||||
#define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion
|
#define REINIT_NOISY_LCD 1 // Have the LCD re-init on SD insertion
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif // HAS_MEDIA
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Power Supply
|
* Power Supply
|
||||||
|
@ -3153,6 +3153,25 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Touch Calibration
|
||||||
|
#if ANY(HAS_SPI_TFT, HAS_FSMC_TFT, HAS_LTDC_TFT)
|
||||||
|
#ifndef TOUCH_CALIBRATION_X
|
||||||
|
#define TOUCH_CALIBRATION_X 0
|
||||||
|
#endif
|
||||||
|
#ifndef TOUCH_CALIBRATION_Y
|
||||||
|
#define TOUCH_CALIBRATION_Y 0
|
||||||
|
#endif
|
||||||
|
#ifndef TOUCH_OFFSET_X
|
||||||
|
#define TOUCH_OFFSET_X 0
|
||||||
|
#endif
|
||||||
|
#ifndef TOUCH_OFFSET_Y
|
||||||
|
#define TOUCH_OFFSET_Y 0
|
||||||
|
#endif
|
||||||
|
#ifndef TOUCH_ORIENTATION
|
||||||
|
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Number of VFAT entries used. Each entry has 13 UTF-16 characters
|
// Number of VFAT entries used. Each entry has 13 UTF-16 characters
|
||||||
#if ANY(SCROLL_LONG_FILENAMES, HAS_DWIN_E3V2, TFT_COLOR_UI)
|
#if ANY(SCROLL_LONG_FILENAMES, HAS_DWIN_E3V2, TFT_COLOR_UI)
|
||||||
#define VFAT_ENTRIES_LIMIT 5
|
#define VFAT_ENTRIES_LIMIT 5
|
||||||
|
|
|
@ -556,4 +556,4 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
|
||||||
|
|
||||||
#endif // TOUCH_SCREEN_CALIBRATION
|
#endif // TOUCH_SCREEN_CALIBRATION
|
||||||
|
|
||||||
#endif // HAS_MARLINUI_U8GLIB && (FSMC_CS_PIN || HAS_SPI_GRAPHICAL_TFT)
|
#endif // HAS_MARLINUI_U8GLIB && (FSMC_CS_PIN || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT)
|
||||||
|
|
|
@ -120,8 +120,6 @@ bool have_pre_pic(char *path) {
|
||||||
static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
if (event != LV_EVENT_RELEASED) return;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
uint8_t i, file_count = 0;
|
uint8_t i, file_count = 0;
|
||||||
//switch (obj->mks_obj_id)
|
|
||||||
//{
|
|
||||||
if (obj->mks_obj_id == ID_P_UP) {
|
if (obj->mks_obj_id == ID_P_UP) {
|
||||||
if (dir_offset[curDirLever].curPage > 0) {
|
if (dir_offset[curDirLever].curPage > 0) {
|
||||||
// 2015.05.19
|
// 2015.05.19
|
||||||
|
@ -130,9 +128,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
if (dir_offset[curDirLever].cur_page_first_offset >= FILE_NUM)
|
if (dir_offset[curDirLever].cur_page_first_offset >= FILE_NUM)
|
||||||
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset - FILE_NUM;
|
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset - FILE_NUM;
|
||||||
|
|
||||||
#if HAS_MEDIA
|
TERN_(HAS_MEDIA, file_count = search_file());
|
||||||
file_count = search_file();
|
|
||||||
#endif
|
|
||||||
if (file_count != 0) {
|
if (file_count != 0) {
|
||||||
dir_offset[curDirLever].curPage--;
|
dir_offset[curDirLever].curPage--;
|
||||||
lv_clear_print_file();
|
lv_clear_print_file();
|
||||||
|
@ -144,9 +140,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
if (dir_offset[curDirLever].cur_page_last_offset > 0) {
|
if (dir_offset[curDirLever].cur_page_last_offset > 0) {
|
||||||
list_file.Sd_file_cnt = 0;
|
list_file.Sd_file_cnt = 0;
|
||||||
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_last_offset + 1;
|
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_last_offset + 1;
|
||||||
#if HAS_MEDIA
|
TERN_(HAS_MEDIA, file_count = search_file());
|
||||||
file_count = search_file();
|
|
||||||
#endif
|
|
||||||
if (file_count != 0) {
|
if (file_count != 0) {
|
||||||
dir_offset[curDirLever].curPage++;
|
dir_offset[curDirLever].curPage++;
|
||||||
lv_clear_print_file();
|
lv_clear_print_file();
|
||||||
|
@ -161,17 +155,13 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
int8_t *ch = (int8_t *)strrchr(list_file.curDirPath, '/');
|
int8_t *ch = (int8_t *)strrchr(list_file.curDirPath, '/');
|
||||||
if (ch) {
|
if (ch) {
|
||||||
*ch = 0;
|
*ch = 0;
|
||||||
#if HAS_MEDIA
|
TERN_(HAS_MEDIA, card.cdup());
|
||||||
card.cdup();
|
|
||||||
#endif
|
|
||||||
dir_offset[curDirLever].curPage = 0;
|
dir_offset[curDirLever].curPage = 0;
|
||||||
dir_offset[curDirLever].cur_page_first_offset = 0;
|
dir_offset[curDirLever].cur_page_first_offset = 0;
|
||||||
dir_offset[curDirLever].cur_page_last_offset = 0;
|
dir_offset[curDirLever].cur_page_last_offset = 0;
|
||||||
curDirLever--;
|
curDirLever--;
|
||||||
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
|
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
|
||||||
#if HAS_MEDIA
|
TERN_(HAS_MEDIA, file_count = search_file());
|
||||||
file_count = search_file();
|
|
||||||
#endif
|
|
||||||
lv_clear_print_file();
|
lv_clear_print_file();
|
||||||
disp_gcode_icon(file_count);
|
disp_gcode_icon(file_count);
|
||||||
}
|
}
|
||||||
|
@ -189,9 +179,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
strcpy(list_file.curDirPath, list_file.file_name[i]);
|
strcpy(list_file.curDirPath, list_file.file_name[i]);
|
||||||
curDirLever++;
|
curDirLever++;
|
||||||
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
|
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
|
||||||
#if HAS_MEDIA
|
TERN_(HAS_MEDIA, file_count = search_file());
|
||||||
file_count = search_file();
|
|
||||||
#endif
|
|
||||||
lv_clear_print_file();
|
lv_clear_print_file();
|
||||||
disp_gcode_icon(file_count);
|
disp_gcode_icon(file_count);
|
||||||
}
|
}
|
||||||
|
@ -396,8 +384,7 @@ int ascii2dec_test(char *ascii) {
|
||||||
|
|
||||||
void lv_gcode_file_read(uint8_t *data_buf) {
|
void lv_gcode_file_read(uint8_t *data_buf) {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
uint16_t i = 0, j = 0, k = 0;
|
uint16_t i = 0, j = 0, k = 0, row_1 = 0;
|
||||||
uint16_t row_1 = 0;
|
|
||||||
bool ignore_start = true;
|
bool ignore_start = true;
|
||||||
char temp_test[200];
|
char temp_test[200];
|
||||||
volatile uint16_t *p_index;
|
volatile uint16_t *p_index;
|
||||||
|
@ -435,24 +422,13 @@ void lv_gcode_file_read(uint8_t *data_buf) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if HAS_TFT_LVGL_UI_SPI
|
|
||||||
for (i = 0; i < 200;) {
|
for (i = 0; i < 200;) {
|
||||||
p_index = (uint16_t *)(&public_buf[i]);
|
p_index = (uint16_t *)(&public_buf[i]);
|
||||||
|
|
||||||
//Color = (*p_index >> 8);
|
//Color = (*p_index >> 8);
|
||||||
//*p_index = Color | ((*p_index & 0xFF) << 8);
|
//*p_index = Color | ((*p_index & 0xFF) << 8);
|
||||||
i += 2;
|
i += 2;
|
||||||
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
|
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
|
||||||
}
|
}
|
||||||
#else // !HAS_TFT_LVGL_UI_SPI
|
|
||||||
for (i = 0; i < 200;) {
|
|
||||||
p_index = (uint16_t *)(&public_buf[i]);
|
|
||||||
//Color = (*p_index >> 8);
|
|
||||||
//*p_index = Color | ((*p_index & 0xFF) << 8);
|
|
||||||
i += 2;
|
|
||||||
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // 0x18C3;
|
|
||||||
}
|
|
||||||
#endif // !HAS_TFT_LVGL_UI_SPI
|
|
||||||
memcpy(data_buf, public_buf, 200);
|
memcpy(data_buf, public_buf, 200);
|
||||||
#endif // HAS_MEDIA
|
#endif // HAS_MEDIA
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,12 +171,12 @@
|
||||||
#define QRCODE_Y 40
|
#define QRCODE_Y 40
|
||||||
#define QRCODE_WIDTH 160
|
#define QRCODE_WIDTH 160
|
||||||
|
|
||||||
#else // ifdef TFT35
|
#else // !TFT35
|
||||||
|
|
||||||
#define TFT_WIDTH 320
|
#define TFT_WIDTH 320
|
||||||
#define TFT_HEIGHT 240
|
#define TFT_HEIGHT 240
|
||||||
|
|
||||||
#endif // ifdef TFT35
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -36,10 +36,11 @@
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|
||||||
#include "../../../MarlinCore.h"
|
#include "../../../MarlinCore.h"
|
||||||
|
#include "../../marlinui.h"
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#include HAL_PATH(../../.., tft/xpt2046.h)
|
#include HAL_PATH(../../.., tft/xpt2046.h)
|
||||||
#include "../../marlinui.h"
|
|
||||||
XPT2046 touch;
|
XPT2046 touch;
|
||||||
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|
||||||
//#define TFT_ROTATION TFT_ROTATE_180
|
|
||||||
|
|
||||||
extern uint8_t bmp_public_buf[14 * 1024];
|
extern uint8_t bmp_public_buf[14 * 1024];
|
||||||
extern uint8_t public_buf[513];
|
extern uint8_t public_buf[513];
|
||||||
|
|
||||||
|
|
|
@ -1804,6 +1804,7 @@ void stopEspTransfer() {
|
||||||
|
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
|
|
||||||
|
// ?? Workaround for SPI / Servo issues ??
|
||||||
TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED));
|
TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED));
|
||||||
TERN_(HAS_SERVOS, servo_init());
|
TERN_(HAS_SERVOS, servo_init());
|
||||||
TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());
|
TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());
|
||||||
|
|
|
@ -266,19 +266,18 @@ void Touch::hold(touch_control_t *control, millis_t delay) {
|
||||||
bool Touch::get_point(int16_t *x, int16_t *y) {
|
bool Touch::get_point(int16_t *x, int16_t *y) {
|
||||||
#if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
|
#if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
|
||||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||||
bool is_touched = (touch_calibration.calibration.orientation == TOUCH_PORTRAIT ? io.getRawPoint(y, x) : io.getRawPoint(x, y));
|
const bool is_touched = (touch_calibration.calibration.orientation == TOUCH_PORTRAIT ? io.getRawPoint(y, x) : io.getRawPoint(x, y));
|
||||||
|
|
||||||
if (is_touched && touch_calibration.calibration.orientation != TOUCH_ORIENTATION_NONE) {
|
if (is_touched && touch_calibration.calibration.orientation != TOUCH_ORIENTATION_NONE) {
|
||||||
*x = int16_t((int32_t(*x) * touch_calibration.calibration.x) >> 16) + touch_calibration.calibration.offset_x;
|
*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;
|
*y = int16_t((int32_t(*y) * touch_calibration.calibration.y) >> 16) + touch_calibration.calibration.offset_y;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? io.getRawPoint(y, x) : io.getRawPoint(x, y));
|
const bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? io.getRawPoint(y, x) : io.getRawPoint(x, y));
|
||||||
*x = uint16_t((uint32_t(*x) * TOUCH_CALIBRATION_X) >> 16) + TOUCH_OFFSET_X;
|
*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;
|
*y = uint16_t((uint32_t(*y) * TOUCH_CALIBRATION_Y) >> 16) + TOUCH_OFFSET_Y;
|
||||||
#endif
|
#endif
|
||||||
#elif ENABLED(TFT_TOUCH_DEVICE_GT911)
|
#elif ENABLED(TFT_TOUCH_DEVICE_GT911)
|
||||||
bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? io.getPoint(y, x) : io.getPoint(x, y));
|
const bool is_touched = (TOUCH_ORIENTATION == TOUCH_PORTRAIT ? io.getPoint(y, x) : io.getPoint(x, y));
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TOUCH_SLEEP
|
#if HAS_TOUCH_SLEEP
|
||||||
if (is_touched)
|
if (is_touched)
|
||||||
|
|
|
@ -146,16 +146,6 @@
|
||||||
#define ILI9488_ADJCTL6 0xFC // Adjust Control 6
|
#define ILI9488_ADJCTL6 0xFC // Adjust Control 6
|
||||||
#define ILI9488_ADJCTL7 0xFF // Adjust Control 7
|
#define ILI9488_ADJCTL7 0xFF // Adjust Control 7
|
||||||
|
|
||||||
#if 0
|
|
||||||
// https://forum.mikroe.com/viewtopic.php?t=74586
|
|
||||||
#if ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488
|
|
||||||
#define TFT_DRIVER ILI9488
|
|
||||||
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
|
|
||||||
#define TFT_RES_480x320
|
|
||||||
#define TFT_INTERFACE_FSMC
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const uint16_t ili9488_init[] = {
|
static const uint16_t ili9488_init[] = {
|
||||||
DATASIZE_8BIT,
|
DATASIZE_8BIT,
|
||||||
ESC_REG(ILI9488_SWRESET), ESC_DELAY(120),
|
ESC_REG(ILI9488_SWRESET), ESC_DELAY(120),
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
#error "DMA_MAX_SIZE is not configured for this platform."
|
#error "DMA_MAX_SIZE is not configured for this platform."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "tft_orientation.h"
|
|
||||||
|
|
||||||
#ifndef TFT_DRIVER
|
#ifndef TFT_DRIVER
|
||||||
#define TFT_DRIVER AUTO
|
#define TFT_DRIVER AUTO
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,19 +66,3 @@
|
||||||
#define TOUCH_ORIENTATION_NONE 0
|
#define TOUCH_ORIENTATION_NONE 0
|
||||||
#define TOUCH_LANDSCAPE 1
|
#define TOUCH_LANDSCAPE 1
|
||||||
#define TOUCH_PORTRAIT 2
|
#define TOUCH_PORTRAIT 2
|
||||||
|
|
||||||
#ifndef TOUCH_CALIBRATION_X
|
|
||||||
#define TOUCH_CALIBRATION_X 0
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_CALIBRATION_Y
|
|
||||||
#define TOUCH_CALIBRATION_Y 0
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_OFFSET_X
|
|
||||||
#define TOUCH_OFFSET_X 0
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_OFFSET_Y
|
|
||||||
#define TOUCH_OFFSET_Y 0
|
|
||||||
#endif
|
|
||||||
#ifndef TOUCH_ORIENTATION
|
|
||||||
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -21,13 +21,11 @@
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
#include "tft_io.h"
|
|
||||||
|
|
||||||
#ifndef TOUCH_SCREEN_CALIBRATION_PRECISION
|
#ifndef TOUCH_SCREEN_CALIBRATION_PRECISION
|
||||||
#define TOUCH_SCREEN_CALIBRATION_PRECISION 80
|
#define TOUCH_SCREEN_CALIBRATION_PRECISION 80
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS
|
#ifndef TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS
|
||||||
#define TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS 2500
|
#define TOUCH_SCREEN_HOLD_TO_CALIBRATE_MS 2500
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,7 +65,7 @@ void TouchButtons::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TouchButtons::read_buttons() {
|
uint8_t TouchButtons::read_buttons() {
|
||||||
#ifdef HAS_WIRED_LCD
|
#if HAS_WIRED_LCD
|
||||||
int16_t x, y;
|
int16_t x, y;
|
||||||
|
|
||||||
#if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
|
#if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
|
||||||
|
|
|
@ -408,7 +408,7 @@
|
||||||
#ifndef TFT_DRIVER
|
#ifndef TFT_DRIVER
|
||||||
#define TFT_DRIVER ST7796
|
#define TFT_DRIVER ST7796
|
||||||
#endif
|
#endif
|
||||||
#ifndef TOUCH_SCREEN_CALIBRATION
|
#if DISABLED(TOUCH_SCREEN_CALIBRATION)
|
||||||
#if ENABLED(TFT_RES_320x240)
|
#if ENABLED(TFT_RES_320x240)
|
||||||
#ifndef TOUCH_CALIBRATION_X
|
#ifndef TOUCH_CALIBRATION_X
|
||||||
#define TOUCH_CALIBRATION_X 20525
|
#define TOUCH_CALIBRATION_X 20525
|
||||||
|
|
Loading…
Reference in a new issue