|
|
@ -235,22 +235,42 @@ bool MarlinUI::get_blink() {
|
|
|
|
////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
#if ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
volatile uint8_t buttons_reprapworld_keypad;
|
|
|
|
|
|
|
|
|
|
|
|
volatile uint8_t MarlinUI::buttons_reprapworld_keypad;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if DISABLED(ADC_KEYPAD) && HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_move_x();
|
|
|
|
|
|
|
|
void lcd_move_y();
|
|
|
|
|
|
|
|
void lcd_move_z();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
|
|
|
|
|
|
|
|
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
|
|
|
|
|
|
encoderPosition = dir;
|
|
|
|
|
|
|
|
switch (axis) {
|
|
|
|
|
|
|
|
case X_AXIS: lcd_move_x(); break;
|
|
|
|
|
|
|
|
case Y_AXIS: lcd_move_y(); break;
|
|
|
|
|
|
|
|
case Z_AXIS: lcd_move_z();
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool MarlinUI::handle_keypad() {
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ADC_KEYPAD)
|
|
|
|
#if ENABLED(ADC_KEYPAD)
|
|
|
|
|
|
|
|
|
|
|
|
inline bool handle_adc_keypad() {
|
|
|
|
|
|
|
|
#define ADC_MIN_KEY_DELAY 100
|
|
|
|
#define ADC_MIN_KEY_DELAY 100
|
|
|
|
if (buttons_reprapworld_keypad) {
|
|
|
|
if (buttons_reprapworld_keypad) {
|
|
|
|
#if HAS_ENCODER_ACTION
|
|
|
|
#if HAS_ENCODER_ACTION
|
|
|
|
ui.refresh(LCDVIEW_REDRAW_NOW);
|
|
|
|
refresh(LCDVIEW_REDRAW_NOW);
|
|
|
|
if (encoderDirection == -1) { // side effect which signals we are inside a menu
|
|
|
|
if (encoderDirection == -1) { // side effect which signals we are inside a menu
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
|
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_UP)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { menu_item_back::action(); ui.quick_feedback(); }
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { menu_item_back::action(); quick_feedback(); }
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { ui.return_to_status(); ui.quick_feedback(); }
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); }
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_PULSES_PER_STEP;
|
|
|
|
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_PULSES_PER_STEP;
|
|
|
@ -261,31 +281,7 @@ bool MarlinUI::get_blink() {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
#else // !ADC_KEYPAD
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_move_x();
|
|
|
|
|
|
|
|
void lcd_move_y();
|
|
|
|
|
|
|
|
void lcd_move_z();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
|
|
|
|
|
|
|
|
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
|
|
|
|
|
|
encoderPosition = dir;
|
|
|
|
|
|
|
|
switch (axis) {
|
|
|
|
|
|
|
|
case X_AXIS: lcd_move_x(); break;
|
|
|
|
|
|
|
|
case Y_AXIS: lcd_move_y(); break;
|
|
|
|
|
|
|
|
case Z_AXIS: lcd_move_z();
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline void handle_reprapworld_keypad() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t keypad_debounce = 0;
|
|
|
|
static uint8_t keypad_debounce = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -303,7 +299,7 @@ bool MarlinUI::get_blink() {
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE)) ui.goto_screen(menu_move);
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE)) goto_screen(menu_move);
|
|
|
|
|
|
|
|
|
|
|
|
#if DISABLED(DELTA) && Z_HOME_DIR == -1
|
|
|
|
#if DISABLED(DELTA) && Z_HOME_DIR == -1
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
|
|
|
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
|
|
@ -323,7 +319,12 @@ bool MarlinUI::get_blink() {
|
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
|
|
|
if (!homed && RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
|
if (!homed && RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // !ADC_KEYPAD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // REPRAPWORLD_KEYPAD
|
|
|
|
#endif // REPRAPWORLD_KEYPAD
|
|
|
@ -684,18 +685,19 @@ void MarlinUI::update() {
|
|
|
|
slow_buttons = read_slow_buttons(); // Buttons that take too long to read in interrupt context
|
|
|
|
slow_buttons = read_slow_buttons(); // Buttons that take too long to read in interrupt context
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ADC_KEYPAD)
|
|
|
|
#if ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
|
|
|
|
|
|
|
|
if (handle_adc_keypad()) {
|
|
|
|
if (
|
|
|
|
|
|
|
|
#if ENABLED(ADC_KEYPAD)
|
|
|
|
|
|
|
|
handle_keypad()
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
handle_keypad()
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
) {
|
|
|
|
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
|
|
|
|
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
|
|
|
|
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
|
|
|
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handle_reprapworld_keypad();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
const float abs_diff = ABS(encoderDiff);
|
|
|
|
const float abs_diff = ABS(encoderDiff);
|
|
|
@ -990,25 +992,26 @@ void MarlinUI::update() {
|
|
|
|
|
|
|
|
|
|
|
|
#endif // LCD_HAS_DIRECTIONAL_BUTTONS
|
|
|
|
#endif // LCD_HAS_DIRECTIONAL_BUTTONS
|
|
|
|
|
|
|
|
|
|
|
|
buttons = newbutton
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
|
|
|
| slow_buttons
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(ADC_KEYPAD)
|
|
|
|
#if ENABLED(ADC_KEYPAD)
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t newbutton_reprapworld_keypad = 0;
|
|
|
|
|
|
|
|
buttons = 0;
|
|
|
|
buttons = 0;
|
|
|
|
if (buttons_reprapworld_keypad == 0) {
|
|
|
|
if (buttons_reprapworld_keypad == 0) {
|
|
|
|
newbutton_reprapworld_keypad = get_ADC_keyValue();
|
|
|
|
uint8_t newbutton_reprapworld_keypad = get_ADC_keyValue();
|
|
|
|
if (WITHIN(newbutton_reprapworld_keypad, 1, 8))
|
|
|
|
if (WITHIN(newbutton_reprapworld_keypad, 1, 8))
|
|
|
|
buttons_reprapworld_keypad = _BV(newbutton_reprapworld_keypad - 1);
|
|
|
|
buttons_reprapworld_keypad = _BV(newbutton_reprapworld_keypad - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buttons = newbutton
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
|
|
|
|
|
|
|
| slow_buttons
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(REPRAPWORLD_KEYPAD)
|
|
|
|
GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad);
|
|
|
|
GET_SHIFT_BUTTON_STATES(buttons_reprapworld_keypad);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|