Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow TOUCH_BUTTONS to be swapped #15100

Merged
6 changes: 5 additions & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,11 @@
#endif

#ifndef STD_ENCODER_PULSES_PER_STEP
#define STD_ENCODER_PULSES_PER_STEP 5
#if ENABLED(TOUCH_BUTTONS)
#define STD_ENCODER_PULSES_PER_STEP 1
#else
#define STD_ENCODER_PULSES_PER_STEP 5
#endif
#endif
#ifndef STD_ENCODER_STEPS_PER_MENU_ITEM
#define STD_ENCODER_STEPS_PER_MENU_ITEM 1
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ bool MarlinUI::detected() {
#if HAS_SLOW_BUTTONS
uint8_t MarlinUI::read_slow_buttons() {
#if ENABLED(LCD_I2C_TYPE_MCP23017)
// Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update
// Reading these buttons is too slow for interrupt context
// so they are read during LCD update in the main loop.
uint8_t slow_bits = lcd.readButtons()
#if !BUTTON_EXISTS(ENC)
<< B_I2C_BTN_OFFSET
Expand All @@ -381,7 +381,7 @@ bool MarlinUI::detected() {
#if ENABLED(LCD_I2C_VIKI)
if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
#endif // LCD_I2C_VIKI
#endif
return slow_bits;
#endif // LCD_I2C_TYPE_MCP23017
}
Expand Down
146 changes: 97 additions & 49 deletions Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,51 +251,102 @@ static const uint8_t ili9341_init_sequence[] = { // 0x9341 - ILI9341
B01111111,B11111111,B11111111,B11111110,
};

static const uint8_t buttonA[] = {
B01111111,B11111111,B11111111,B11111110,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B01000000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000001,B11110000,B00000000,B00000001,
B10000011,B11111000,B00000000,B00000001,
B10000111,B11111100,B00111111,B11100001,
B10000000,B11100000,B00111111,B11100001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B01111111,B11111111,B11111111,B11111110,
};
#if ENABLED(REVERSE_MENU_DIRECTION)

static const uint8_t buttonA[] = {
B01111111,B11111111,B11111111,B11111110,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00111111,B11100001,
B10000111,B11111100,B00111111,B11100001,
B10000011,B11111000,B00000000,B00000001,
B10000001,B11110000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B01000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B01111111,B11111111,B11111111,B11111110,
};
static const uint8_t buttonB[] = {
B01111111,B11111111,B11111111,B11111110,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B01100000,B00000010,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00001111,B10000001,
B10000000,B01100000,B00011111,B11000001,
B10000111,B11111110,B00111111,B11100001,
B10000111,B11111110,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B01111111,B11111111,B11111111,B11111110,
};

static const uint8_t buttonB[] = {
B01111111,B11111111,B11111111,B11111110,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000111,B11111110,B00000111,B00000001,
B10000111,B11111110,B00111111,B11100001,
B10000000,B01100000,B00011111,B11000001,
B10000000,B01100000,B00001111,B10000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000010,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B01111111,B11111111,B11111111,B11111110,
};
#else

static const uint8_t buttonA[] = {
B01111111,B11111111,B11111111,B11111110,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B01000000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000001,B11110000,B00000000,B00000001,
B10000011,B11111000,B00000000,B00000001,
B10000111,B11111100,B00111111,B11100001,
B10000000,B11100000,B00111111,B11100001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B11100000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B01111111,B11111111,B11111111,B11111110,
};

static const uint8_t buttonB[] = {
B01111111,B11111111,B11111111,B11111110,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000111,B00000001,
B10000111,B11111110,B00000111,B00000001,
B10000111,B11111110,B00111111,B11100001,
B10000000,B01100000,B00011111,B11000001,
B10000000,B01100000,B00001111,B10000001,
B10000000,B01100000,B00000111,B00000001,
B10000000,B01100000,B00000010,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B10000000,B00000000,B00000000,B00000001,
B01111111,B11111111,B11111111,B11111110,
};

#endif

static const uint8_t buttonC[] = {
B01111111,B11111111,B11111111,B11111110,
Expand Down Expand Up @@ -353,11 +404,8 @@ static const uint8_t ili9341_init_sequence[] = { // 0x9341 - ILI9341

// Used to fill RGB565 (16bits) background
inline void memset2(const void *ptr, uint16_t fill, size_t cnt) {
uint16_t* wptr = (uint16_t*) ptr;
for (size_t i = 0; i < cnt; i += 2) {
*wptr = fill;
wptr++;
}
uint16_t* wptr = (uint16_t*)ptr;
for (size_t i = 0; i < cnt; i += 2) { *wptr = fill; wptr++; }
}

static bool preinit = true;
Expand Down
Loading