Browse Source

Merge pull request #8179 from thinkyhead/bf1_config_tweak

[1.1.x] Faster menu navigation for Anet A8
Scott Lahteine 7 years ago
parent
commit
64029ef8a6
No account linked to committer's email address
1 changed files with 10 additions and 12 deletions
  1. 10
    12
      Marlin/ultralcd.cpp

+ 10
- 12
Marlin/ultralcd.cpp View File

@@ -4337,31 +4337,29 @@ void kill_screen(const char* lcd_msg) {
4337 4337
   #if ENABLED(ADC_KEYPAD)
4338 4338
 
4339 4339
     inline bool handle_adc_keypad() {
4340
-      static uint8_t adc_steps = 0;
4340
+      #define ADC_MIN_KEY_DELAY 100
4341 4341
       if (buttons_reprapworld_keypad) {
4342
-        if (adc_steps < 20) ++adc_steps;
4343
-        lcd_quick_feedback();
4344 4342
         lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
4345 4343
         if (encoderDirection == -1) { // side effect which signals we are inside a menu
4346 4344
           if      (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)  encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
4347 4345
           else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)    encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
4348
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)  menu_action_back();
4349
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) lcd_return_to_status();
4346
+          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)  { menu_action_back(); lcd_quick_feedback(); }
4347
+          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) { lcd_return_to_status(); lcd_quick_feedback(); }
4350 4348
         }
4351 4349
         else {
4352
-          const int8_t step = adc_steps > 19 ? 100 : adc_steps > 10 ? 10 : 1;
4353
-               if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)  encoderPosition += ENCODER_PULSES_PER_STEP * step;
4354
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)    encoderPosition -= ENCODER_PULSES_PER_STEP * step;
4355
-          else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
4350
+          if (buttons_reprapworld_keypad & (EN_REPRAPWORLD_KEYPAD_DOWN|EN_REPRAPWORLD_KEYPAD_UP|EN_REPRAPWORLD_KEYPAD_RIGHT)) {
4351
+                 if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)  encoderPosition += ENCODER_PULSES_PER_STEP;
4352
+            else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)    encoderPosition -= ENCODER_PULSES_PER_STEP;
4353
+            else if (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) encoderPosition = 0;
4354
+          }
4356 4355
         }
4357 4356
         #if ENABLED(ADC_KEYPAD_DEBUG)
4358 4357
           SERIAL_PROTOCOLLNPAIR("buttons_reprapworld_keypad = ", (uint32_t)buttons_reprapworld_keypad);
4359 4358
           SERIAL_PROTOCOLLNPAIR("encoderPosition = ", (uint32_t)encoderPosition);
4360 4359
         #endif
4360
+        next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
4361 4361
         return true;
4362 4362
       }
4363
-      else if (!thermalManager.current_ADCKey_raw)
4364
-        adc_steps = 0; // reset stepping acceleration
4365 4363
 
4366 4364
       return false;
4367 4365
     }
@@ -4672,7 +4670,7 @@ void lcd_update() {
4672 4670
 
4673 4671
       #endif
4674 4672
 
4675
-      bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
4673
+      const bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
4676 4674
       if (encoderPastThreshold || lcd_clicked) {
4677 4675
         if (encoderPastThreshold) {
4678 4676
           int32_t encoderMultiplier = 1;

Loading…
Cancel
Save