Skip to content

Commit

Permalink
Update ultralcd.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 12, 2020
1 parent abb7579 commit 2ea5dc6
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions Marlin/src/lcd/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,23 +1554,22 @@ void MarlinUI::update() {
//
void MarlinUI::screen_click(const uint8_t row, const uint8_t col, const uint8_t, const uint8_t) {
const millis_t now = millis();
if (ELAPSED(now, next_button_update_ms)) {
next_button_update_ms = now + repeat_delay; // Assume the repeat delay
const int8_t xdir = col < (LCD_WIDTH ) / 2 ? -1 : 1,
ydir = row < (LCD_HEIGHT) / 2 ? -1 : 1;
if (on_edit_screen)
encoderDiff = epps * ydir * 2;
else if (screen_items > 0) {
// Last 5 cols act as a scroll :-)
if (col > (LCD_WIDTH) - 5)
// 2 * LCD_HEIGHT to scroll to bottom of next page. (LCD_HEIGHT would only go 1 item down.)
encoderDiff = epps * (encoderLine - encoderTopLine + 2 * (LCD_HEIGHT)) * ydir;
else
encoderDiff = epps * (row - encoderPosition + encoderTopLine);
}
else if (!on_status_screen())
encoderDiff = epps * xdir * 2;
if (PENDING(now, next_button_update_ms)) return;
next_button_update_ms = now + repeat_delay; // Assume the repeat delay
const int8_t xdir = col < (LCD_WIDTH ) / 2 ? -1 : 1,
ydir = row < (LCD_HEIGHT) / 2 ? -1 : 1;
if (on_edit_screen)
encoderDiff = epps * ydir;
else if (screen_items > 0) {
// Last 5 cols act as a scroll :-)
if (col > (LCD_WIDTH) - 5)
// 2 * LCD_HEIGHT to scroll to bottom of next page. (LCD_HEIGHT would only go 1 item down.)
encoderDiff = epps * (encoderLine - encoderTopLine + 2 * (LCD_HEIGHT)) * ydir;
else
encoderDiff = epps * (row - encoderPosition + encoderTopLine);
}
else if (!on_status_screen())
encoderDiff = epps * xdir * 2;
}

#endif
Expand Down

0 comments on commit 2ea5dc6

Please sign in to comment.