Support for TFT & Touch Screens (#18130)

This commit is contained in:
Alexander Gavrilenko
2020-07-30 09:43:19 +03:00
committed by GitHub
parent bba157e5bd
commit 117df87d19
176 changed files with 14747 additions and 303 deletions

View File

@@ -149,7 +149,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if HAS_SLOW_BUTTONS
volatile uint8_t MarlinUI::slow_buttons;
#endif
#if ENABLED(TOUCH_BUTTONS)
#if HAS_TOUCH_XPT2046
#include "../feature/touch/xpt2046.h"
bool MarlinUI::on_edit_screen = false;
#endif
@@ -229,7 +229,7 @@ millis_t MarlinUI::next_button_update_ms; // = 0
int8_t MarlinUI::encoderDirection = ENCODERBASE;
#endif
#if ENABLED(TOUCH_BUTTONS)
#if HAS_TOUCH_XPT2046
uint8_t MarlinUI::touch_buttons;
uint8_t MarlinUI::repeat_delay;
#endif
@@ -802,6 +802,9 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
LCDViewAction MarlinUI::lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
millis_t next_lcd_update_ms;
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
millis_t MarlinUI::return_to_status_ms = 0;
#endif
void MarlinUI::update() {
@@ -809,7 +812,6 @@ void MarlinUI::update() {
millis_t ms = millis();
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS > 0
static millis_t return_to_status_ms = 0;
#define RESET_STATUS_TIMEOUT() (return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS)
#else
#define RESET_STATUS_TIMEOUT() NOOP
@@ -838,7 +840,7 @@ void MarlinUI::update() {
quick_feedback(); // - Always make a click sound
};
#if ENABLED(TOUCH_BUTTONS)
#if HAS_TOUCH_XPT2046
if (touch_buttons) {
RESET_STATUS_TIMEOUT();
if (touch_buttons & (EN_A | EN_B)) { // Menu arrows, in priority
@@ -859,7 +861,7 @@ void MarlinUI::update() {
}
else // keep wait_for_unclick value
#endif // TOUCH_BUTTONS
#endif // HAS_TOUCH_XPT2046
{
// Integrated LCD click handling via button_pressed
@@ -881,7 +883,7 @@ void MarlinUI::update() {
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
#if ENABLED(TOUCH_BUTTONS)
#if HAS_TOUCH_XPT2046
if (on_status_screen()) next_lcd_update_ms += (LCD_UPDATE_INTERVAL) * 2;
@@ -1078,6 +1080,8 @@ void MarlinUI::update() {
} // switch
} // ELAPSED(ms, next_lcd_update_ms)
TERN_(HAS_GRAPHICAL_TFT, tft_idle());
}
#if HAS_ADC_BUTTONS
@@ -1224,7 +1228,7 @@ void MarlinUI::update() {
#if HAS_SLOW_BUTTONS
| slow_buttons
#endif
#if BOTH(TOUCH_BUTTONS, HAS_ENCODER_ACTION)
#if BOTH(HAS_TOUCH_XPT2046, HAS_ENCODER_ACTION)
| (touch_buttons & TERN(HAS_ENCODER_WHEEL, ~(EN_A | EN_B), 0xFF))
#endif
);
@@ -1533,7 +1537,7 @@ void MarlinUI::update() {
#endif
#if ENABLED(TOUCH_BUTTONS)
#if HAS_TOUCH_XPT2046
//
// Screen Click