Skip to content

Commit

Permalink
Support 4.3" (480x272) Color UI display (#20334)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and thinkyhead committed Apr 29, 2021
1 parent 79672d5 commit cf99694
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 52 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,7 @@
//#define TOUCH_CALIBRATION_Y -8981
//#define TOUCH_OFFSET_X -43
//#define TOUCH_OFFSET_Y 257
//#define TOUCH_ORIENTATION TOUCH_LANDSCAPE

#if ENABLED(TFT_COLOR_UI)
//#define SINGLE_TOUCH_NAVIGATION
Expand Down
9 changes: 9 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,12 @@
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_480x320
#endif
#elif ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 272
#if ENABLED(TFT_INTERFACE_SPI)
#define TFT_480x272_SPI
#elif ENABLED(TFT_INTERFACE_FSMC)
#define TFT_480x272
#endif
#endif

// Fewer lines with touch buttons on-screen
Expand All @@ -1178,6 +1184,9 @@
#elif EITHER(TFT_480x320, TFT_480x320_SPI)
#define HAS_UI_480x320 1
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#elif EITHER(TFT_480x272, TFT_480x272_SPI)
#define HAS_UI_480x272 1
#define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7)
#endif

// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/lcd/tft/tft.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#elif HAS_UI_480x320
#define TFT_WIDTH 480
#define TFT_HEIGHT 320
#elif HAS_UI_480x272
#define TFT_WIDTH 480
#define TFT_HEIGHT 272
#else
#error "Unsupported display resolution!"
#endif
Expand Down
67 changes: 36 additions & 31 deletions Marlin/src/lcd/tft/ui_480x320.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../../inc/MarlinConfigPre.h"

#if HAS_UI_480x320
#if HAS_UI_480x320 || HAS_UI_480x272

#include "ui_480x320.h"

Expand Down Expand Up @@ -56,9 +56,9 @@
void MarlinUI::tft_idle() {
#if ENABLED(TOUCH_SCREEN)
if (draw_menu_navigation) {
add_control(104, 286, PAGE_UP, imgPageUp, encoderTopLine > 0);
add_control(344, 286, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
add_control(224, 286, BACK, imgBack);
add_control(104, TFT_HEIGHT - 34, PAGE_UP, imgPageUp, encoderTopLine > 0);
add_control(344, TFT_HEIGHT - 34, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
add_control(224, TFT_HEIGHT - 34, BACK, imgBack);
draw_menu_navigation = false;
}
#endif
Expand Down Expand Up @@ -259,10 +259,12 @@ void MarlinUI::draw_status_screen() {
}
}

y += TERN(HAS_UI_480x272, 118, 128);

// coordinates
tft.canvas(4, 132, TFT_WIDTH - 8, 34);
tft.canvas(4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT);
tft.set_background(COLOR_BACKGROUND);
tft.add_rectangle(0, 0, TFT_WIDTH - 8, 34, COLOR_AXIS_HOMED);
tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);

tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
Expand Down Expand Up @@ -290,10 +292,11 @@ void MarlinUI::draw_status_screen() {
offset -= tft_string.width();
}
tft.add_text(455 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, 132, TFT_WIDTH - 8, 34));
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));

y += TERN(HAS_UI_480x272, 38, 48);
// feed rate
tft.canvas(96, 180, 100, 32);
tft.canvas(96, y, 100, 32);
tft.set_background(COLOR_BACKGROUND);
uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
tft.add_image(0, 0, imgFeedRate, color);
Expand All @@ -303,7 +306,7 @@ void MarlinUI::draw_status_screen() {
TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 96, 176, 100, 32));

// flow rate
tft.canvas(284, 180, 100, 32);
tft.canvas(284, y, 100, 32);
tft.set_background(COLOR_BACKGROUND);
color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
tft.add_image(0, 0, imgFlowRate, color);
Expand All @@ -312,36 +315,38 @@ void MarlinUI::draw_status_screen() {
tft.add_text(36, 1, color , tft_string);
TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 284, 176, 100, 32, active_extruder));

#if ENABLED(TOUCH_SCREEN)
add_control(404, y, menu_main, imgSettings);
TERN_(SDSUPPORT, add_control(12, y, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
#endif

y += TERN(HAS_UI_480x272, 36, 44);
// print duration
char buffer[14];
duration_t elapsed = print_job_timer.duration();
elapsed.toDigital(buffer);

tft.canvas((TFT_WIDTH - 128) / 2, 224, 128, 29);
tft.canvas((TFT_WIDTH - 128) / 2, y, 128, 29);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(buffer);
tft.add_text(tft_string.center(128), 0, COLOR_PRINT_TIME, tft_string);

y += TERN(HAS_UI_480x272, 28, 36);
// progress bar
const uint8_t progress = ui.get_progress_percent();
tft.canvas(4, 260, TFT_WIDTH - 8, 9);
tft.canvas(4, y, TFT_WIDTH - 8, 9);
tft.set_background(COLOR_PROGRESS_BG);
tft.add_rectangle(0, 0, TFT_WIDTH - 8, 9, COLOR_PROGRESS_FRAME);
if (progress)
tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR);

y += 20;
// status message
tft.canvas(0, 280, TFT_WIDTH, 29);
tft.canvas(0, y, TFT_WIDTH, FONT_LINE_HEIGHT - 5);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(status_message);
tft_string.trim();
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_STATUS_MESSAGE, tft_string);


#if ENABLED(TOUCH_SCREEN)
add_control(404, 180, menu_main, imgSettings);
TERN_(SDSUPPORT, add_control(12, 180, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
#endif
}

// Draw a static item with no left-right margin required. Centered by default.
Expand Down Expand Up @@ -450,9 +455,9 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu

void TFT::draw_edit_screen_buttons() {
#if ENABLED(TOUCH_SCREEN)
add_control(64, 256, DECREASE, imgDecrease);
add_control(352, 256, INCREASE, imgIncrease);
add_control(208, 256, CLICK, imgConfirm);
add_control(64, TFT_HEIGHT - 64, DECREASE, imgDecrease);
add_control(352, TFT_HEIGHT - 64, INCREASE, imgIncrease);
add_control(208, TFT_HEIGHT - 64, CLICK, imgConfirm);
#endif
}

Expand Down Expand Up @@ -481,8 +486,8 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
}
#if ENABLED(TOUCH_SCREEN)
add_control(88, 256, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
add_control(328, 256, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
add_control(88, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
#endif
}

Expand Down Expand Up @@ -541,23 +546,23 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
lpos = pos.asLogical();

tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2 - 43, 120, 43);
tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(X_LBL);
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
tft_string.set(ftostr52(lpos.x));
tft_string.trim();
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);

tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2, 120, 43);
tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 120, MENU_ITEM_HEIGHT);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(Y_LBL);
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
tft_string.set(ftostr52(lpos.y));
tft_string.trim();
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);

tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2 + 43, 120, 43);
tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 + MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(Z_LBL);
tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
Expand All @@ -566,13 +571,13 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);


tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - 48) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 5, 48, 43);
tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - 48) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 5, 48, MENU_ITEM_HEIGHT);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(ui8tostr3rj(x_plot));
tft_string.trim();
tft.add_text(tft_string.center(48), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);

tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET + 16 - 24, GRID_OFFSET_Y + (GRID_HEIGHT - 43) / 2, 48, 43);
tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET + 16 - 24, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 48, MENU_ITEM_HEIGHT);
tft.set_background(COLOR_BACKGROUND);
tft_string.set(ui8tostr3rj(y_plot));
tft_string.trim();
Expand All @@ -586,7 +591,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
add_control(GRID_OFFSET_X + CONTROL_OFFSET, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, UBL, - ENCODER_STEPS_PER_MENU_ITEM, imgLeft);
add_control(GRID_OFFSET_X + GRID_WIDTH - CONTROL_OFFSET - 32, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, UBL, ENCODER_STEPS_PER_MENU_ITEM, imgRight);
add_control(320, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, CLICK, imgLeveling);
add_control(224, 286, BACK, imgBack);
add_control(224, TFT_HEIGHT - 34, BACK, imgBack);
#endif
}
#endif // AUTO_BED_LEVELING_UBL
Expand Down Expand Up @@ -644,7 +649,7 @@ void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const
#endif // TOUCH_SCREEN_CALIBRATION

void menu_line(const uint8_t row, uint16_t color) {
tft.canvas(0, 4 + 45 * row, TFT_WIDTH, 43);
tft.canvas(0, 4 + (MENU_ITEM_HEIGHT + 2) * row, TFT_WIDTH, MENU_ITEM_HEIGHT);
tft.set_background(color);
}

Expand All @@ -661,7 +666,7 @@ void menu_item(const uint8_t row, bool sel ) {
menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
#if ENABLED(TOUCH_SCREEN)
const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? MENU_CLICK : MENU_ITEM;
touch.add_control(tct, 0, 4 + 45 * row, TFT_WIDTH, 43, encoderTopLine + row);
touch.add_control(tct, 0, 4 + (MENU_ITEM_HEIGHT + 2) * row, TFT_WIDTH, MENU_ITEM_HEIGHT, encoderTopLine + row);
#endif
}

Expand Down
13 changes: 11 additions & 2 deletions Marlin/src/lcd/tft/ui_480x320.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink);
void menu_line(const uint8_t row, uint16_t color = COLOR_BACKGROUND);
void menu_item(const uint8_t row, bool sel = false);

#define MENU_FONT_NAME Helvetica18
#define SYMBOLS_FONT_NAME Helvetica18_symbols
#if HAS_UI_480x320
#define MENU_FONT_NAME Helvetica18
#define SYMBOLS_FONT_NAME Helvetica18_symbols
#define MENU_ITEM_HEIGHT 43
#define FONT_LINE_HEIGHT 34
#elif HAS_UI_480x272
#define MENU_FONT_NAME Helvetica14
#define SYMBOLS_FONT_NAME Helvetica14_symbols
#define MENU_ITEM_HEIGHT 36
#define FONT_LINE_HEIGHT 24
#endif

#define ABSOLUTE_ZERO -273.15

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/tft_io/ssd1963.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
IF_0((TFT_ORIENTATION) & TFT_INVERT_X, SSD1963_MADCTL_FH) | \
IF_0((TFT_ORIENTATION) & TFT_INVERT_Y, SSD1963_MADCTL_FV)

#if !defined(TFT_COLOR) || TFT_COLOR == TFT_COLOR_BGR
#define SSD1963_COLOR SSD1963_MADCTL_BGR
#elif TFT_COLOR == TFT_COLOR_RGB
#if !defined(TFT_COLOR) || TFT_COLOR == TFT_COLOR_RGB
#define SSD1963_COLOR SSD1963_MADCTL_RGB
#elif TFT_COLOR == TFT_COLOR_BGR
#define SSD1963_COLOR SSD1963_MADCTL_BGR
#endif

#define SSD1963_MADCTL_DATA (SSD1963_ORIENTATION) | (SSD1963_COLOR)
Expand Down
45 changes: 34 additions & 11 deletions Marlin/src/lcd/tft_io/touch_calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@

#include "touch_calibration.h"

#define TOUCH_CALIBRATION_MAX_RETRIES 5

#define DEBUG_OUT ENABLED(DEBUG_TOUCH_CALIBRATION)
#include "../../core/debug_out.h"

TouchCalibration touch_calibration;

touch_calibration_t TouchCalibration::calibration;
Expand All @@ -31,31 +36,48 @@ touch_calibration_point_t TouchCalibration::calibration_points[4];
uint8_t TouchCalibration::failed_count;

void TouchCalibration::validate_calibration() {
const bool landscape = validate_precision_x(0, 1) && validate_precision_x(2, 3) && validate_precision_y(0, 2) && validate_precision_y(1, 3);
const bool portrait = validate_precision_y(0, 1) && validate_precision_y(2, 3) && validate_precision_x(0, 2) && validate_precision_x(1, 3);
#define VALIDATE_PRECISION(XY, A, B) validate_precision_##XY(CALIBRATION_##A, CALIBRATION_##B)
const bool landscape = VALIDATE_PRECISION(x, TOP_LEFT, BOTTOM_LEFT)
&& VALIDATE_PRECISION(x, TOP_RIGHT, BOTTOM_RIGHT)
&& VALIDATE_PRECISION(y, TOP_LEFT, TOP_RIGHT)
&& VALIDATE_PRECISION(y, BOTTOM_LEFT, BOTTOM_RIGHT);
const bool portrait = VALIDATE_PRECISION(y, TOP_LEFT, BOTTOM_LEFT)
&& VALIDATE_PRECISION(y, TOP_RIGHT, BOTTOM_RIGHT)
&& VALIDATE_PRECISION(x, TOP_LEFT, TOP_RIGHT)
&& VALIDATE_PRECISION(x, BOTTOM_LEFT, BOTTOM_RIGHT);
#undef VALIDATE_PRECISION

if (landscape || portrait) {
#define CAL_PTS(N) calibration_points[CALIBRATION_##N]
if (landscape) {
calibration_state = CALIBRATION_SUCCESS;
calibration.x = ((CAL_PTS(TOP_RIGHT).x - CAL_PTS(TOP_LEFT).x) << 17) / (CAL_PTS(BOTTOM_RIGHT).raw_x + CAL_PTS(TOP_RIGHT).raw_x - CAL_PTS(BOTTOM_LEFT).raw_x - CAL_PTS(TOP_LEFT).raw_x);
calibration.y = ((CAL_PTS(BOTTOM_LEFT).y - CAL_PTS(TOP_LEFT).y) << 17) / (CAL_PTS(BOTTOM_RIGHT).raw_y - CAL_PTS(TOP_RIGHT).raw_y + CAL_PTS(BOTTOM_LEFT).raw_y - CAL_PTS(TOP_LEFT).raw_y);
calibration.offset_x = CAL_PTS(TOP_LEFT).x - int16_t(((CAL_PTS(TOP_LEFT).raw_x + CAL_PTS(BOTTOM_LEFT).raw_x) * calibration.x) >> 17);
calibration.offset_y = CAL_PTS(TOP_LEFT).y - int16_t(((CAL_PTS(TOP_LEFT).raw_y + CAL_PTS(TOP_RIGHT).raw_y) * calibration.y) >> 17);
calibration.orientation = TOUCH_LANDSCAPE;
}
else if (portrait) {
calibration_state = CALIBRATION_SUCCESS;
calibration.x = ((calibration_points[2].x - calibration_points[0].x) << 17) / (calibration_points[3].raw_x + calibration_points[2].raw_x - calibration_points[1].raw_x - calibration_points[0].raw_x);
calibration.y = ((calibration_points[1].y - calibration_points[0].y) << 17) / (calibration_points[3].raw_y - calibration_points[2].raw_y + calibration_points[1].raw_y - calibration_points[0].raw_y);
calibration.offset_x = calibration_points[0].x - int16_t(((calibration_points[0].raw_x + calibration_points[1].raw_x) * calibration.x) >> 17);
calibration.offset_y = calibration_points[0].y - int16_t(((calibration_points[0].raw_y + calibration_points[2].raw_y) * calibration.y) >> 17);
calibration.orientation = landscape ? TOUCH_LANDSCAPE : TOUCH_PORTRAIT;
calibration.x = ((CAL_PTS(TOP_RIGHT).x - CAL_PTS(TOP_LEFT).x) << 17) / (CAL_PTS(BOTTOM_RIGHT).raw_y + CAL_PTS(TOP_RIGHT).raw_y - CAL_PTS(BOTTOM_LEFT).raw_y - CAL_PTS(TOP_LEFT).raw_y);
calibration.y = ((CAL_PTS(BOTTOM_LEFT).y - CAL_PTS(TOP_LEFT).y) << 17) / (CAL_PTS(BOTTOM_RIGHT).raw_x - CAL_PTS(TOP_RIGHT).raw_x + CAL_PTS(BOTTOM_LEFT).raw_x - CAL_PTS(TOP_LEFT).raw_x);
calibration.offset_x = CAL_PTS(TOP_LEFT).x - int16_t(((CAL_PTS(TOP_LEFT).raw_y + CAL_PTS(BOTTOM_LEFT).raw_y) * calibration.x) >> 17);
calibration.offset_y = CAL_PTS(TOP_LEFT).y - int16_t(((CAL_PTS(TOP_LEFT).raw_x + CAL_PTS(TOP_RIGHT).raw_x) * calibration.y) >> 17);
calibration.orientation = TOUCH_PORTRAIT;
}
else {
calibration_state = CALIBRATION_FAIL;
calibration_reset();
// Retry up to 5 times before reporting the failure
if (need_calibration() && failed_count++ < 5) calibration_state = CALIBRATION_TOP_LEFT;
if (need_calibration() && failed_count++ < TOUCH_CALIBRATION_MAX_RETRIES) calibration_state = CALIBRATION_TOP_LEFT;
}
#undef CAL_PTS

if (calibration_state == CALIBRATION_SUCCESS) {
SERIAL_ECHOLNPGM("Touch screen calibration completed");
SERIAL_ECHOLNPAIR("TOUCH_CALIBRATION_X ", calibration.x);
SERIAL_ECHOLNPAIR("TOUCH_CALIBRATION_Y ", calibration.y);
SERIAL_ECHOLNPAIR("TOUCH_OFFSET_X ", calibration.offset_x);
SERIAL_ECHOLNPAIR("TOUCH_OFFSET_Y ", calibration.offset_y);
SERIAL_ECHOPGM("TOUCH_ORIENTATION "); if (calibration.orientation == TOUCH_LANDSCAPE) SERIAL_ECHOLNPGM("TOUCH_LANDSCAPE"); else SERIAL_ECHOLNPGM("TOUCH_PORTRAIT");
SERIAL_ECHO_TERNARY(calibration.orientation == TOUCH_LANDSCAPE, "TOUCH_ORIENTATION ", "TOUCH_LANDSCAPE", "TOUCH_PORTRAIT", "\n");
}
}

Expand All @@ -68,6 +90,7 @@ bool TouchCalibration::handleTouch(uint16_t x, uint16_t y) {
if (calibration_state < CALIBRATION_SUCCESS) {
calibration_points[calibration_state].raw_x = x;
calibration_points[calibration_state].raw_y = y;
DEBUG_ECHOLNPAIR("TouchCalibration - State: ", calibration_state, ", x: ", calibration_points[calibration_state].x, ", raw_x: ", x, ", y: ", calibration_points[calibration_state].y, ", raw_y: ", y);
}

switch (calibration_state) {
Expand Down
5 changes: 0 additions & 5 deletions Marlin/src/pins/stm32f4/pins_ANET_ET4.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@
#define TOUCH_INT_PIN PB1
#endif

// Touchscreen calibration does not work correctly with ANET_ET5_TFT35 or ANET_ET4_TFT28
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#undef TOUCH_SCREEN_CALIBRATION
#endif

#if ENABLED(ANET_ET5_TFT35)
#ifndef TOUCH_CALIBRATION_X
#define TOUCH_CALIBRATION_X 17125
Expand Down

0 comments on commit cf99694

Please sign in to comment.