rename HAS_TOUCH_XPT2046 to HAS_TOUCH_BUTTONS
This commit is contained in:
parent
776ff26f6a
commit
b54eac6173
11 changed files with 31 additions and 31 deletions
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
|
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
|
||||||
|
|
||||||
#include "xpt2046.h"
|
#include "xpt2046.h"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfig.h"
|
#include "../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046
|
#if HAS_TFT_XPT2046 || HAS_TOUCH_BUTTONS
|
||||||
|
|
||||||
#include "xpt2046.h"
|
#include "xpt2046.h"
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
#include "sd/cardreader.h"
|
#include "sd/cardreader.h"
|
||||||
|
|
||||||
#include "lcd/marlinui.h"
|
#include "lcd/marlinui.h"
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
#include "lcd/touch/touch_buttons.h"
|
#include "lcd/touch/touch_buttons.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -1101,7 +1101,7 @@ void setup() {
|
||||||
SETUP_RUN(ethernet.init());
|
SETUP_RUN(ethernet.init());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
SETUP_RUN(touch.init());
|
SETUP_RUN(touch.init());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -405,7 +405,7 @@ inline bool turn_on_heaters() {
|
||||||
inline bool prime_nozzle() {
|
inline bool prime_nozzle() {
|
||||||
|
|
||||||
const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
|
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)
|
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||||
float Total_Prime = 0.0;
|
float Total_Prime = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1003,6 +1003,6 @@
|
||||||
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT
|
||||||
#undef TOUCH_SCREEN
|
#undef TOUCH_SCREEN
|
||||||
#if !HAS_TFT_LVGL_UI
|
#if !HAS_TFT_LVGL_UI
|
||||||
#define HAS_TOUCH_XPT2046 1
|
#define HAS_TOUCH_BUTTONS 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,7 @@
|
||||||
|
|
||||||
// Touch Screen or "Touch Buttons" need XPT2046 pins
|
// Touch Screen or "Touch Buttons" need XPT2046 pins
|
||||||
// but they use different components
|
// 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
|
#define NEED_TOUCH_PINS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
tftio.set_window(Xmin, Ymin, Xmax, Ymax);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
|
|
||||||
static const uint8_t buttonD[] = {
|
static const uint8_t buttonD[] = {
|
||||||
B01111111,B11111111,B11111111,B11111110,
|
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
|
// Used to fill RGB565 (16bits) background
|
||||||
inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
|
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 bool preinit = true;
|
||||||
static uint8_t page;
|
static uint8_t page;
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
static bool redrawTouchButtons = true;
|
static bool redrawTouchButtons = true;
|
||||||
static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) {
|
static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) {
|
||||||
if (!redrawTouchButtons) {
|
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);
|
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);
|
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) {
|
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);
|
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:
|
case U8G_DEV_MSG_PAGE_FIRST:
|
||||||
page = 0;
|
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);
|
setWindow(u8g, dev, TFT_PIXEL_OFFSET_X, TFT_PIXEL_OFFSET_Y, X_HI, Y_HI);
|
||||||
break;
|
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";
|
str = calibration_stage == CALIBRATION_SUCCESS ? "Calibration Completed" : "Calibration Failed";
|
||||||
defer_status_screen(false);
|
defer_status_screen(false);
|
||||||
touch_calibration.calibration_end();
|
touch_calibration.calibration_end();
|
||||||
TERN_(HAS_TOUCH_XPT2046, redrawTouchButtons = true);
|
TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw current message
|
// draw current message
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
||||||
#if HAS_SLOW_BUTTONS
|
#if HAS_SLOW_BUTTONS
|
||||||
volatile uint8_t MarlinUI::slow_buttons;
|
volatile uint8_t MarlinUI::slow_buttons;
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
#include "touch/touch_buttons.h"
|
#include "touch/touch_buttons.h"
|
||||||
bool MarlinUI::on_edit_screen = false;
|
bool MarlinUI::on_edit_screen = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -238,7 +238,7 @@ millis_t MarlinUI::next_button_update_ms; // = 0
|
||||||
int8_t MarlinUI::encoderDirection = ENCODERBASE;
|
int8_t MarlinUI::encoderDirection = ENCODERBASE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
uint8_t MarlinUI::touch_buttons;
|
uint8_t MarlinUI::touch_buttons;
|
||||||
uint8_t MarlinUI::repeat_delay;
|
uint8_t MarlinUI::repeat_delay;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -855,7 +855,7 @@ void MarlinUI::update() {
|
||||||
quick_feedback(); // - Always make a click sound
|
quick_feedback(); // - Always make a click sound
|
||||||
};
|
};
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
if (touch_buttons) {
|
if (touch_buttons) {
|
||||||
RESET_STATUS_TIMEOUT();
|
RESET_STATUS_TIMEOUT();
|
||||||
if (touch_buttons & (EN_A | EN_B)) { // Menu arrows, in priority
|
if (touch_buttons & (EN_A | EN_B)) { // Menu arrows, in priority
|
||||||
|
|
@ -876,7 +876,7 @@ void MarlinUI::update() {
|
||||||
}
|
}
|
||||||
else // keep wait_for_unclick value
|
else // keep wait_for_unclick value
|
||||||
|
|
||||||
#endif // HAS_TOUCH_XPT2046
|
#endif // HAS_TOUCH_BUTTONS
|
||||||
|
|
||||||
{
|
{
|
||||||
// Integrated LCD click handling via button_pressed
|
// Integrated LCD click handling via button_pressed
|
||||||
|
|
@ -898,7 +898,7 @@ void MarlinUI::update() {
|
||||||
|
|
||||||
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
|
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;
|
if (on_status_screen()) next_lcd_update_ms += (LCD_UPDATE_INTERVAL) * 2;
|
||||||
|
|
||||||
|
|
@ -1246,7 +1246,7 @@ void MarlinUI::update() {
|
||||||
#if HAS_SLOW_BUTTONS
|
#if HAS_SLOW_BUTTONS
|
||||||
| slow_buttons
|
| slow_buttons
|
||||||
#endif
|
#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))
|
| (touch_buttons & TERN(HAS_ENCODER_WHEEL, ~(EN_A | EN_B), 0xFF))
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
@ -1557,7 +1557,7 @@ void MarlinUI::update() {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
|
|
||||||
//
|
//
|
||||||
// Screen Click
|
// Screen Click
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
uint8_t get_ADC_keyValue();
|
uint8_t get_ADC_keyValue();
|
||||||
#endif
|
#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
|
#if HAS_LCD_MENU
|
||||||
|
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
|
|
||||||
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
|
#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 BLEN_C 2
|
||||||
#define EN_C _BV(BLEN_C)
|
#define EN_C _BV(BLEN_C)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
|
|
||||||
#endif
|
#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 BLEN_D 3
|
||||||
#define EN_D _BV(BLEN_D)
|
#define EN_D _BV(BLEN_D)
|
||||||
#define LCD_BACK_CLICKED() (buttons & EN_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);
|
static void draw_hotend_status(const uint8_t row, const uint8_t extruder);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
static bool on_edit_screen;
|
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);
|
static void screen_click(const uint8_t row, const uint8_t col, const uint8_t x, const uint8_t y);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -514,7 +514,7 @@ public:
|
||||||
static millis_t return_to_status_ms;
|
static millis_t return_to_status_ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
static uint8_t touch_buttons;
|
static uint8_t touch_buttons;
|
||||||
static uint8_t repeat_delay;
|
static uint8_t repeat_delay;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ void MarlinUI::save_previous_screen() {
|
||||||
|
|
||||||
void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
|
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);
|
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) {
|
if (screen_history_depth > 0) {
|
||||||
menuPosition &sh = screen_history[--screen_history_depth];
|
menuPosition &sh = screen_history[--screen_history_depth];
|
||||||
goto_screen(sh.menu_function,
|
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)
|
* MenuItem_int3::draw(encoderLine == _thisItemNr, _lcdLineNr, plabel, &feedrate_percentage, 10, 999)
|
||||||
*/
|
*/
|
||||||
void MenuEditItemBase::edit_screen(strfunc_t strfunc, loadfunc_t loadfunc) {
|
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) < 0) ui.encoderPosition = 0;
|
||||||
if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
|
if (int32_t(ui.encoderPosition) > maxEditValue) ui.encoderPosition = maxEditValue;
|
||||||
if (ui.should_draw())
|
if (ui.should_draw())
|
||||||
|
|
@ -145,7 +145,7 @@ void MenuEditItemBase::goto_edit_screen(
|
||||||
const screenFunc_t cb, // Callback after edit
|
const screenFunc_t cb, // Callback after edit
|
||||||
const bool le // Flag to call cb() during editing
|
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.screen_changed = true;
|
||||||
ui.save_previous_screen();
|
ui.save_previous_screen();
|
||||||
ui.refresh();
|
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*/) {
|
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) {
|
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());
|
TERN_(LCD_SET_PROGRESS_MANUALLY, progress_reset());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "../../inc/MarlinConfig.h"
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if HAS_TOUCH_XPT2046
|
#if HAS_TOUCH_BUTTONS
|
||||||
|
|
||||||
#include "touch_buttons.h"
|
#include "touch_buttons.h"
|
||||||
#include "../scaled_tft.h"
|
#include "../scaled_tft.h"
|
||||||
|
|
@ -87,4 +87,4 @@ uint8_t TouchButtons::read_buttons() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_TOUCH_XPT2046
|
#endif // HAS_TOUCH_BUTTONS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue