Skip to content

Commit

Permalink
Merge pull request MarlinFirmware#8178 from thinkyhead/bf2_config_tweak
Browse files Browse the repository at this point in the history
[2.0.x] Faster menu navigation for Anet A8
  • Loading branch information
thinkyhead authored Nov 3, 2017
2 parents 70be4d2 + e5ae545 commit 84b93d9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Marlin/src/lcd/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4329,31 +4329,29 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(ADC_KEYPAD)

inline bool handle_adc_keypad() {
static uint8_t adc_steps = 0;
#define ADC_MIN_KEY_DELAY 100
if (buttons_reprapworld_keypad) {
if (adc_steps < 20) ++adc_steps;
lcd_quick_feedback();
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
if (encoderDirection == -1) { // side effect which signals we are inside a menu
if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) menu_action_back();
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) lcd_return_to_status();
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) { menu_action_back(); lcd_quick_feedback(); }
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) { lcd_return_to_status(); lcd_quick_feedback(); }
}
else {
const int8_t step = adc_steps > 19 ? 100 : adc_steps > 10 ? 10 : 1;
if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition += ENCODER_PULSES_PER_STEP * step;
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition -= ENCODER_PULSES_PER_STEP * step;
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
if (buttons_reprapworld_keypad & (EN_REPRAPWORLD_KEYPAD_DOWN|EN_REPRAPWORLD_KEYPAD_UP|EN_REPRAPWORLD_KEYPAD_RIGHT)) {
if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) encoderPosition += ENCODER_PULSES_PER_STEP;
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) encoderPosition -= ENCODER_PULSES_PER_STEP;
else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
}
}
#if ENABLED(ADC_KEYPAD_DEBUG)
SERIAL_PROTOCOLLNPAIR("buttons_reprapworld_keypad = ", (uint32_t)buttons_reprapworld_keypad);
SERIAL_PROTOCOLLNPAIR("encoderPosition = ", (uint32_t)encoderPosition);
#endif
next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
return true;
}
else if (!thermalManager.current_ADCKey_raw)
adc_steps = 0; // reset stepping acceleration

return false;
}
Expand Down

0 comments on commit 84b93d9

Please sign in to comment.