rename HAS_TOUCH_XPT2046 to HAS_TOUCH_BUTTONS

This commit is contained in:
Victor Mateus Oliveira 2020-11-05 23:18:53 -03:00
parent 776ff26f6a
commit b54eac6173
11 changed files with 31 additions and 31 deletions

View file

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h"
#include <SPI.h>

View file

@ -22,7 +22,7 @@
#include "../../../inc/MarlinConfig.h"
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
#include "xpt2046.h"
#include <SPI.h>

View file

@ -60,7 +60,7 @@
#include "sd/cardreader.h"
#include "lcd/marlinui.h"
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
#include "lcd/touch/touch_buttons.h"
#endif
@ -1101,7 +1101,7 @@ void setup() {
SETUP_RUN(ethernet.init());
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
SETUP_RUN(touch.init());
#endif

View file

@ -405,7 +405,7 @@ inline bool turn_on_heaters() {
inline bool prime_nozzle() {
const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
#if HAS_LCD_MENU && !HAS_TOUCH_XPT2046 // ui.button_pressed issue with touchscreen
#if HAS_LCD_MENU && !HAS_TOUCH_BUTTONS // ui.button_pressed issue with touchscreen
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
float Total_Prime = 0.0;
#endif

View file

@ -1003,6 +1003,6 @@
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
#undef TOUCH_SCREEN
#if !HAS_TFT_LVGL_UI
#define HAS_TOUCH_XPT2046 1
#define HAS_TOUCH_BUTTONS 1
#endif
#endif

View file

@ -360,7 +360,7 @@
// Touch Screen or "Touch Buttons" need XPT2046 pins
// but they use different components
#if EITHER(HAS_TFT_XPT2046, HAS_TOUCH_XPT2046)
#if EITHER(HAS_TFT_XPT2046, HAS_TOUCH_BUTTONS)
#define NEED_TOUCH_PINS 1
#endif

View file

@ -134,7 +134,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin,
tftio.set_window(Xmin, Ymin, Xmax, Ymax);
}
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
static const uint8_t buttonD[] = {
B01111111,B11111111,B11111111,B11111110,
@ -307,7 +307,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin,
}
}
#endif // HAS_TOUCH_XPT2046
#endif // HAS_TOUCH_BUTTONS
// Used to fill RGB565 (16bits) background
inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
@ -318,7 +318,7 @@ inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
static bool preinit = true;
static uint8_t page;
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
static bool redrawTouchButtons = true;
static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) {
if (!redrawTouchButtons) {
@ -339,7 +339,7 @@ static uint8_t page;
setWindow(u8g, dev, BUTTONC_X_LO, BUTTON_Y_LO, BUTTONC_X_HI, BUTTON_Y_HI);
drawImage(buttonC, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTOKMENU_COLOR);
}
#endif // HAS_TOUCH_XPT2046
#endif // HAS_TOUCH_BUTTONS
uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
@ -378,7 +378,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
case U8G_DEV_MSG_PAGE_FIRST:
page = 0;
TERN_(HAS_TOUCH_XPT2046, drawTouchButtons(u8g, dev));
TERN_(HAS_TOUCH_BUTTONS, drawTouchButtons(u8g, dev));
setWindow(u8g, dev, TFT_PIXEL_OFFSET_X, TFT_PIXEL_OFFSET_Y, X_HI, Y_HI);
break;
@ -516,7 +516,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
str = calibration_stage == CALIBRATION_SUCCESS ? "Calibration Completed" : "Calibration Failed";
defer_status_screen(false);
touch_calibration.calibration_end();
TERN_(HAS_TOUCH_XPT2046, redrawTouchButtons = true);
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
}
// draw current message

View file

@ -158,7 +158,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if HAS_SLOW_BUTTONS
volatile uint8_t MarlinUI::slow_buttons;
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
#include "touch/touch_buttons.h"
bool MarlinUI::on_edit_screen = false;
#endif
@ -238,7 +238,7 @@ millis_t MarlinUI::next_button_update_ms; // = 0
int8_t MarlinUI::encoderDirection = ENCODERBASE;
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
uint8_t MarlinUI::touch_buttons;
uint8_t MarlinUI::repeat_delay;
#endif
@ -855,7 +855,7 @@ void MarlinUI::update() {
quick_feedback(); // - Always make a click sound
};
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
if (touch_buttons) {
RESET_STATUS_TIMEOUT();
if (touch_buttons & (EN_A | EN_B)) { // Menu arrows, in priority
@ -876,7 +876,7 @@ void MarlinUI::update() {
}
else // keep wait_for_unclick value
#endif // HAS_TOUCH_XPT2046
#endif // HAS_TOUCH_BUTTONS
{
// Integrated LCD click handling via button_pressed
@ -898,7 +898,7 @@ void MarlinUI::update() {
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
if (on_status_screen()) next_lcd_update_ms += (LCD_UPDATE_INTERVAL) * 2;
@ -1246,7 +1246,7 @@ void MarlinUI::update() {
#if HAS_SLOW_BUTTONS
| slow_buttons
#endif
#if BOTH(HAS_TOUCH_XPT2046, HAS_ENCODER_ACTION)
#if BOTH(HAS_TOUCH_BUTTONS, HAS_ENCODER_ACTION)
| (touch_buttons & TERN(HAS_ENCODER_WHEEL, ~(EN_A | EN_B), 0xFF))
#endif
);
@ -1557,7 +1557,7 @@ void MarlinUI::update() {
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
//
// Screen Click

View file

@ -74,7 +74,7 @@
uint8_t get_ADC_keyValue();
#endif
#define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_XPT2046, 50, 100)
#define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100)
#if HAS_LCD_MENU
@ -148,7 +148,7 @@
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
#if BUTTON_EXISTS(ENC) || HAS_TOUCH_XPT2046
#if BUTTON_EXISTS(ENC) || HAS_TOUCH_BUTTONS
#define BLEN_C 2
#define EN_C _BV(BLEN_C)
#endif
@ -214,7 +214,7 @@
#endif
#if BUTTON_EXISTS(BACK) || EITHER(HAS_TOUCH_XPT2046, IS_TFTGLCD_PANEL)
#if BUTTON_EXISTS(BACK) || EITHER(HAS_TOUCH_BUTTONS, IS_TFTGLCD_PANEL)
#define BLEN_D 3
#define EN_D _BV(BLEN_D)
#define LCD_BACK_CLICKED() (buttons & EN_D)
@ -454,7 +454,7 @@ public:
static void draw_hotend_status(const uint8_t row, const uint8_t extruder);
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
static bool on_edit_screen;
static void screen_click(const uint8_t row, const uint8_t col, const uint8_t x, const uint8_t y);
#endif
@ -514,7 +514,7 @@ public:
static millis_t return_to_status_ms;
#endif
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
static uint8_t touch_buttons;
static uint8_t repeat_delay;
#endif

View file

@ -82,7 +82,7 @@ void MarlinUI::save_previous_screen() {
void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
IF_DISABLED(TURBO_BACK_MENU_ITEM, constexpr bool is_back = false);
TERN_(HAS_TOUCH_XPT2046, on_edit_screen = false);
TERN_(HAS_TOUCH_BUTTONS, on_edit_screen = false);
if (screen_history_depth > 0) {
menuPosition &sh = screen_history[--screen_history_depth];
goto_screen(sh.menu_function,
@ -123,7 +123,7 @@ void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_b
* MenuItem_int3::draw(encoderLine == _thisItemNr, _lcdLineNr, plabel, &feedrate_percentage, 10, 999)
*/
void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
TERN_(HAS_TOUCH_XPT2046, ui.repeat_delay = BUTTON_DELAY_EDIT);
TERN_(HAS_TOUCH_BUTTONS, ui.repeat_delay = BUTTON_DELAY_EDIT);
if (int32_t(ui.encoderPosition) < 0) ui.encoderPosition = 0;
if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
if (ui.should_draw())
@ -145,7 +145,7 @@ void MenuEditItemBase::goto_edit_screen(
const screenFunc_t cb, // Callback after edit
const bool le // Flag to call cb() during editing
) {
TERN_(HAS_TOUCH_XPT2046, ui.on_edit_screen = true);
TERN_(HAS_TOUCH_BUTTONS, ui.on_edit_screen = true);
ui.screen_changed = true;
ui.save_previous_screen();
ui.refresh();
@ -175,7 +175,7 @@ bool printer_busy() {
void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, const uint8_t top/*=0*/, const uint8_t items/*=0*/) {
if (currentScreen != screen) {
TERN_(HAS_TOUCH_XPT2046, repeat_delay = BUTTON_DELAY_MENU);
TERN_(HAS_TOUCH_BUTTONS, repeat_delay = BUTTON_DELAY_MENU);
TERN_(LCD_SET_PROGRESS_MANUALLY, progress_reset());

View file

@ -19,7 +19,7 @@
#include "../../inc/MarlinConfig.h"
#if HAS_TOUCH_XPT2046
#if HAS_TOUCH_BUTTONS
#include "touch_buttons.h"
#include "../scaled_tft.h"
@ -87,4 +87,4 @@ uint8_t TouchButtons::read_buttons() {
return 0;
}
#endif // HAS_TOUCH_XPT2046
#endif // HAS_TOUCH_BUTTONS