|
|
|
@ -79,13 +79,13 @@
|
|
|
|
|
#include "../feature/bedlevel/bedlevel.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if DISABLED(LCD_USE_I2C_BUZZER)
|
|
|
|
|
#if HAS_BUZZER
|
|
|
|
|
#include "../libs/buzzer.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if HAS_ENCODER_ACTION
|
|
|
|
|
volatile uint8_t MarlinUI::buttons;
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
#if HAS_SLOW_BUTTONS
|
|
|
|
|
volatile uint8_t MarlinUI::slow_buttons;
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
@ -248,7 +248,7 @@ void MarlinUI::init() {
|
|
|
|
|
lcd_sd_status = 2; // UNKNOWN
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if HAS_ENCODER_ACTION && ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
#if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS
|
|
|
|
|
slow_buttons = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -307,16 +307,16 @@ bool MarlinUI::get_blink() {
|
|
|
|
|
refresh(LCDVIEW_REDRAW_NOW);
|
|
|
|
|
if (encoderDirection == -1) { // side effect which signals we are inside a menu
|
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); }
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); }
|
|
|
|
|
if (RRK(EN_KEYPAD_DOWN)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
|
|
else if (RRK(EN_KEYPAD_UP)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
|
|
else if (RRK(EN_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); }
|
|
|
|
|
else if (RRK(EN_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); }
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition -= ENCODER_PULSES_PER_STEP;
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition += ENCODER_PULSES_PER_STEP;
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); }
|
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) encoderPosition = 0;
|
|
|
|
|
else if (RRK(EN_KEYPAD_DOWN)) encoderPosition -= ENCODER_PULSES_PER_STEP;
|
|
|
|
|
else if (RRK(EN_KEYPAD_UP)) encoderPosition += ENCODER_PULSES_PER_STEP;
|
|
|
|
|
else if (RRK(EN_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); }
|
|
|
|
|
else if (RRK(EN_KEYPAD_RIGHT)) encoderPosition = 0;
|
|
|
|
|
#endif
|
|
|
|
|
next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
|
|
|
|
|
return true;
|
|
|
|
@ -326,10 +326,10 @@ bool MarlinUI::get_blink() {
|
|
|
|
|
|
|
|
|
|
static uint8_t keypad_debounce = 0;
|
|
|
|
|
|
|
|
|
|
if (!RRK( EN_REPRAPWORLD_KEYPAD_F1 | EN_REPRAPWORLD_KEYPAD_F2
|
|
|
|
|
| EN_REPRAPWORLD_KEYPAD_F3 | EN_REPRAPWORLD_KEYPAD_DOWN
|
|
|
|
|
| EN_REPRAPWORLD_KEYPAD_RIGHT | EN_REPRAPWORLD_KEYPAD_MIDDLE
|
|
|
|
|
| EN_REPRAPWORLD_KEYPAD_UP | EN_REPRAPWORLD_KEYPAD_LEFT )
|
|
|
|
|
if (!RRK( EN_KEYPAD_F1 | EN_KEYPAD_F2
|
|
|
|
|
| EN_KEYPAD_F3 | EN_KEYPAD_DOWN
|
|
|
|
|
| EN_KEYPAD_RIGHT | EN_KEYPAD_MIDDLE
|
|
|
|
|
| EN_KEYPAD_UP | EN_KEYPAD_LEFT )
|
|
|
|
|
) {
|
|
|
|
|
if (keypad_debounce > 0) keypad_debounce--;
|
|
|
|
|
}
|
|
|
|
@ -340,26 +340,26 @@ bool MarlinUI::get_blink() {
|
|
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE)) goto_screen(menu_move);
|
|
|
|
|
if (RRK(EN_KEYPAD_MIDDLE)) goto_screen(menu_move);
|
|
|
|
|
|
|
|
|
|
#if DISABLED(DELTA) && Z_HOME_DIR == -1
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
|
|
|
|
if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (homed) {
|
|
|
|
|
#if ENABLED(DELTA) || Z_HOME_DIR != -1
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
|
|
|
|
if (RRK(EN_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
|
|
|
|
#endif
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1);
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) _reprapworld_keypad_move(X_AXIS, -1);
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS, 1);
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) _reprapworld_keypad_move(Y_AXIS, 1);
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) _reprapworld_keypad_move(Y_AXIS, -1);
|
|
|
|
|
if (RRK(EN_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1);
|
|
|
|
|
if (RRK(EN_KEYPAD_LEFT)) _reprapworld_keypad_move(X_AXIS, -1);
|
|
|
|
|
if (RRK(EN_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS, 1);
|
|
|
|
|
if (RRK(EN_KEYPAD_DOWN)) _reprapworld_keypad_move(Y_AXIS, 1);
|
|
|
|
|
if (RRK(EN_KEYPAD_UP)) _reprapworld_keypad_move(Y_AXIS, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
|
if (!homed && RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
|
|
if (!homed && RRK(EN_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -666,7 +666,7 @@ void MarlinUI::update() {
|
|
|
|
|
}
|
|
|
|
|
else wait_for_unclick = false;
|
|
|
|
|
|
|
|
|
|
#if BUTTON_EXISTS(BACK)
|
|
|
|
|
#if HAS_DIGITAL_BUTTONS && BUTTON_EXISTS(BACK)
|
|
|
|
|
if (LCD_BACK_CLICKED()) {
|
|
|
|
|
quick_feedback();
|
|
|
|
|
goto_previous_screen();
|
|
|
|
@ -717,7 +717,7 @@ void MarlinUI::update() {
|
|
|
|
|
|
|
|
|
|
#if HAS_ENCODER_ACTION
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
#if HAS_SLOW_BUTTONS
|
|
|
|
|
slow_buttons = read_slow_buttons(); // Buttons that take too long to read in interrupt context
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -905,14 +905,14 @@ void MarlinUI::update() {
|
|
|
|
|
|
|
|
|
|
static const _stADCKeypadTable_ stADCKeyTable[] PROGMEM = {
|
|
|
|
|
// VALUE_MIN, VALUE_MAX, KEY
|
|
|
|
|
{ 4000, 4096, 1 + BLEN_REPRAPWORLD_KEYPAD_F1 }, // F1
|
|
|
|
|
{ 4000, 4096, 1 + BLEN_REPRAPWORLD_KEYPAD_F2 }, // F2
|
|
|
|
|
{ 4000, 4096, 1 + BLEN_REPRAPWORLD_KEYPAD_F3 }, // F3
|
|
|
|
|
{ 300, 500, 1 + BLEN_REPRAPWORLD_KEYPAD_LEFT }, // LEFT
|
|
|
|
|
{ 1900, 2200, 1 + BLEN_REPRAPWORLD_KEYPAD_RIGHT }, // RIGHT
|
|
|
|
|
{ 570, 870, 1 + BLEN_REPRAPWORLD_KEYPAD_UP }, // UP
|
|
|
|
|
{ 2670, 2870, 1 + BLEN_REPRAPWORLD_KEYPAD_DOWN }, // DOWN
|
|
|
|
|
{ 1150, 1450, 1 + BLEN_REPRAPWORLD_KEYPAD_MIDDLE }, // ENTER
|
|
|
|
|
{ 4000, 4096, 1 + BLEN_KEYPAD_F1 }, // F1
|
|
|
|
|
{ 4000, 4096, 1 + BLEN_KEYPAD_F2 }, // F2
|
|
|
|
|
{ 4000, 4096, 1 + BLEN_KEYPAD_F3 }, // F3
|
|
|
|
|
{ 300, 500, 1 + BLEN_KEYPAD_LEFT }, // LEFT
|
|
|
|
|
{ 1900, 2200, 1 + BLEN_KEYPAD_RIGHT }, // RIGHT
|
|
|
|
|
{ 570, 870, 1 + BLEN_KEYPAD_UP }, // UP
|
|
|
|
|
{ 2670, 2870, 1 + BLEN_KEYPAD_DOWN }, // DOWN
|
|
|
|
|
{ 1150, 1450, 1 + BLEN_KEYPAD_MIDDLE }, // ENTER
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
uint8_t get_ADC_keyValue(void) {
|
|
|
|
@ -1025,7 +1025,7 @@ void MarlinUI::update() {
|
|
|
|
|
#endif // UP || DWN || LFT || RT
|
|
|
|
|
|
|
|
|
|
buttons = newbutton
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
#if HAS_SLOW_BUTTONS
|
|
|
|
|
| slow_buttons
|
|
|
|
|
#endif
|
|
|
|
|
;
|
|
|
|
@ -1087,7 +1087,7 @@ void MarlinUI::update() {
|
|
|
|
|
#endif // HAS_ENCODER_WHEEL
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
#if HAS_SLOW_BUTTONS
|
|
|
|
|
|
|
|
|
|
uint8_t MarlinUI::read_slow_buttons() {
|
|
|
|
|
#if ENABLED(LCD_I2C_TYPE_MCP23017)
|
|
|
|
@ -1102,7 +1102,7 @@ void MarlinUI::update() {
|
|
|
|
|
#endif // LCD_I2C_TYPE_MCP23017
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // LCD_HAS_SLOW_BUTTONS
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // HAS_ENCODER_ACTION
|
|
|
|
|
|
|
|
|
|