Browse Source

Faster menu navigation for Anet A8

Addressing #8166
Scott Lahteine 7 years ago
parent
commit
03e5369411
1 changed files with 10 additions and 7 deletions
  1. 10
    7
      Marlin/src/lcd/ultralcd.cpp

+ 10
- 7
Marlin/src/lcd/ultralcd.cpp View File

@@ -4329,27 +4329,30 @@ void kill_screen(const char* lcd_msg) {
4329 4329
   #if ENABLED(ADC_KEYPAD)
4330 4330
 
4331 4331
     inline bool handle_adc_keypad() {
4332
+      #define ADC_MIN_KEY_DELAY 100
4332 4333
       static uint8_t adc_steps = 0;
4333 4334
       if (buttons_reprapworld_keypad) {
4334 4335
         if (adc_steps < 20) ++adc_steps;
4335
-        lcd_quick_feedback();
4336 4336
         lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4337 4337
         if (encoderDirection == -1) { // side effect which signals we are inside a menu
4338 4338
           if      (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)  encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
4339 4339
           else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)    encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
4340
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)  menu_action_back();
4341
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) lcd_return_to_status();
4340
+          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)  { menu_action_back(); lcd_quick_feedback(); }
4341
+          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) { lcd_return_to_status(); lcd_quick_feedback(); }
4342 4342
         }
4343 4343
         else {
4344
-          const int8_t step = adc_steps > 19 ? 100 : adc_steps > 10 ? 10 : 1;
4345
-               if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)  encoderPosition += ENCODER_PULSES_PER_STEP * step;
4346
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)    encoderPosition -= ENCODER_PULSES_PER_STEP * step;
4347
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
4344
+          if (buttons_reprapworld_keypad & (EN_REPRAPWORLD_KEYPAD_DOWN|EN_REPRAPWORLD_KEYPAD_UP|EN_REPRAPWORLD_KEYPAD_RIGHT)) {
4345
+            const int8_t step = adc_steps > 19 ? 100 : adc_steps > 10 ? 10 : 1;
4346
+                 if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)  encoderPosition += ENCODER_PULSES_PER_STEP * step;
4347
+            else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)    encoderPosition -= ENCODER_PULSES_PER_STEP * step;
4348
+            else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
4349
+          }
4348 4350
         }
4349 4351
         #if ENABLED(ADC_KEYPAD_DEBUG)
4350 4352
           SERIAL_PROTOCOLLNPAIR("buttons_reprapworld_keypad = ", (uint32_t)buttons_reprapworld_keypad);
4351 4353
           SERIAL_PROTOCOLLNPAIR("encoderPosition = ", (uint32_t)encoderPosition);
4352 4354
         #endif
4355
+        next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
4353 4356
         return true;
4354 4357
       }
4355 4358
       else if (!thermalManager.current_ADCKey_raw)

Loading…
Cancel
Save