Explorar el Código

Merge pull request #5058 from thinkyhead/rc_reverse_arrow_buttons

Apply encoder reverse options to keypad arrows
Scott Lahteine hace 8 años
padre
commit
8b967a9ff0
Se han modificado 1 ficheros con 18 adiciones y 4 borrados
  1. 18
    4
      Marlin/ultralcd.cpp

+ 18
- 4
Marlin/ultralcd.cpp Ver fichero

@@ -2929,30 +2929,44 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
2929 2929
 
2930 2930
         #if LCD_HAS_DIRECTIONAL_BUTTONS
2931 2931
 
2932
+          // Manage directional buttons
2933
+          #if ENABLED(REVERSE_MENU_DIRECTION)
2934
+            #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
2935
+          #else
2936
+            #define _ENCODER_UD_STEPS ENCODER_STEPS_PER_MENU_ITEM
2937
+          #endif
2938
+          #if ENABLED(REVERSE_ENCODER_DIRECTION)
2939
+            #define ENCODER_UD_STEPS _ENCODER_UD_STEPS
2940
+            #define ENCODER_LR_PULSES ENCODER_PULSES_PER_STEP
2941
+          #else
2942
+            #define ENCODER_UD_STEPS -(_ENCODER_UD_STEPS)
2943
+            #define ENCODER_LR_PULSES -(ENCODER_PULSES_PER_STEP)
2944
+          #endif
2945
+
2932 2946
           if (false) {
2933 2947
             // for the else-ifs below
2934 2948
           }
2935 2949
           #if BUTTON_EXISTS(UP)
2936 2950
             else if (BUTTON_PRESSED(UP)) {
2937
-              encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM);
2951
+              encoderDiff = -(ENCODER_UD_STEPS);
2938 2952
               next_button_update_ms = now + 300;
2939 2953
             }
2940 2954
           #endif
2941 2955
           #if BUTTON_EXISTS(DWN)
2942 2956
             else if (BUTTON_PRESSED(DWN)) {
2943
-              encoderDiff = ENCODER_STEPS_PER_MENU_ITEM;
2957
+              encoderDiff = ENCODER_UD_STEPS;
2944 2958
               next_button_update_ms = now + 300;
2945 2959
             }
2946 2960
           #endif
2947 2961
           #if BUTTON_EXISTS(LFT)
2948 2962
             else if (BUTTON_PRESSED(LFT)) {
2949
-              encoderDiff = -(ENCODER_PULSES_PER_STEP);
2963
+              encoderDiff = -(ENCODER_LR_PULSES);
2950 2964
               next_button_update_ms = now + 300;
2951 2965
             }
2952 2966
           #endif
2953 2967
           #if BUTTON_EXISTS(RT)
2954 2968
             else if (BUTTON_PRESSED(RT)) {
2955
-              encoderDiff = ENCODER_PULSES_PER_STEP;
2969
+              encoderDiff = ENCODER_LR_PULSES;
2956 2970
               next_button_update_ms = now + 300;
2957 2971
             }
2958 2972
           #endif

Loading…
Cancelar
Guardar