Przeglądaj źródła

Fix compile error with ZONESTAR_LCD+NO_LCD_MENUS (#12466)

Ludy 6 lat temu
rodzic
commit
93e958f695

+ 2
- 2
Marlin/src/inc/Conditionals_LCD.h Wyświetl plik

52
   #define ENCODER_PULSES_PER_STEP 1
52
   #define ENCODER_PULSES_PER_STEP 1
53
   #define ENCODER_STEPS_PER_MENU_ITEM 1
53
   #define ENCODER_STEPS_PER_MENU_ITEM 1
54
   #define ENCODER_FEEDRATE_DEADZONE 2
54
   #define ENCODER_FEEDRATE_DEADZONE 2
55
-  #define REVERSE_MENU_DIRECTION
56
 
55
 
57
 #elif ENABLED(RADDS_DISPLAY)
56
 #elif ENABLED(RADDS_DISPLAY)
58
   #define ULTIPANEL
57
   #define ULTIPANEL
306
 #define HAS_GRAPHICAL_LCD    ENABLED(DOGLCD)
305
 #define HAS_GRAPHICAL_LCD    ENABLED(DOGLCD)
307
 #define HAS_CHARACTER_LCD   (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
306
 #define HAS_CHARACTER_LCD   (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
308
 #define HAS_LCD_MENU        (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
307
 #define HAS_LCD_MENU        (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
309
-#define HAS_DIGITAL_ENCODER  ENABLED(NEWPANEL)
308
+#define HAS_DIGITAL_BUTTONS  ENABLED(NEWPANEL)
309
+#define HAS_ENCODER_WHEEL   (ENABLED(NEWPANEL) && DISABLED(ADC_KEYPAD))
310
 
310
 
311
 #if HAS_GRAPHICAL_LCD
311
 #if HAS_GRAPHICAL_LCD
312
   /**
312
   /**

+ 41
- 44
Marlin/src/lcd/ultralcd.cpp Wyświetl plik

186
 
186
 
187
   init_lcd();
187
   init_lcd();
188
 
188
 
189
-  #if HAS_DIGITAL_ENCODER
189
+  #if HAS_DIGITAL_BUTTONS
190
 
190
 
191
     #if BUTTON_EXISTS(EN1)
191
     #if BUTTON_EXISTS(EN1)
192
       SET_INPUT_PULLUP(BTN_EN1);
192
       SET_INPUT_PULLUP(BTN_EN1);
217
       SET_INPUT(BTN_RT);
217
       SET_INPUT(BTN_RT);
218
     #endif
218
     #endif
219
 
219
 
220
-  #else // !HAS_DIGITAL_ENCODER
220
+  #else // !HAS_DIGITAL_BUTTONS
221
 
221
 
222
     #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
222
     #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
223
       SET_OUTPUT(SR_DATA_PIN);
223
       SET_OUTPUT(SR_DATA_PIN);
229
       SET_INPUT_PULLUP(SHIFT_OUT);
229
       SET_INPUT_PULLUP(SHIFT_OUT);
230
     #endif // SR_LCD_2W_NL
230
     #endif // SR_LCD_2W_NL
231
 
231
 
232
-  #endif // !HAS_DIGITAL_ENCODER
232
+  #endif // !HAS_DIGITAL_BUTTONS
233
 
233
 
234
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
234
   #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
235
     SET_INPUT_PULLUP(SD_DETECT_PIN);
235
     SET_INPUT_PULLUP(SD_DETECT_PIN);
262
 ///////////// Keypad Handling //////////////
262
 ///////////// Keypad Handling //////////////
263
 ////////////////////////////////////////////
263
 ////////////////////////////////////////////
264
 
264
 
265
-#if ENABLED(REPRAPWORLD_KEYPAD)
265
+#if ENABLED(REPRAPWORLD_KEYPAD) && HAS_ENCODER_ACTION
266
 
266
 
267
   volatile uint8_t MarlinUI::buttons_reprapworld_keypad;
267
   volatile uint8_t MarlinUI::buttons_reprapworld_keypad;
268
 
268
 
295
           refresh(LCDVIEW_REDRAW_NOW);
295
           refresh(LCDVIEW_REDRAW_NOW);
296
           if (encoderDirection == -1) { // side effect which signals we are inside a menu
296
           if (encoderDirection == -1) { // side effect which signals we are inside a menu
297
             #if HAS_LCD_MENU
297
             #if HAS_LCD_MENU
298
-              if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
299
-              else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))     encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
298
+              if      (RRK(EN_REPRAPWORLD_KEYPAD_DOWN))   encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
299
+              else if (RRK(EN_REPRAPWORLD_KEYPAD_UP))     encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
300
               else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))   { MenuItem_back::action(); quick_feedback(); }
300
               else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT))   { MenuItem_back::action(); quick_feedback(); }
301
               else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { return_to_status(); quick_feedback(); }
301
               else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT))  { return_to_status(); quick_feedback(); }
302
             #endif
302
             #endif
443
 
443
 
444
   #endif // HAS_LCD_MENU
444
   #endif // HAS_LCD_MENU
445
 
445
 
446
-  #if ENABLED(ULTIPANEL_FEEDMULTIPLY)
446
+  #if ENABLED(ULTIPANEL_FEEDMULTIPLY) && HAS_ENCODER_ACTION
447
 
447
 
448
     const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
448
     const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
449
     // Dead zone at 100% feedrate
449
     // Dead zone at 100% feedrate
708
 
708
 
709
       #if ENABLED(REPRAPWORLD_KEYPAD)
709
       #if ENABLED(REPRAPWORLD_KEYPAD)
710
 
710
 
711
-        if (
712
-          #if ENABLED(ADC_KEYPAD)
713
-            handle_keypad()
714
-          #else
715
-            handle_keypad()
716
-          #endif
717
-        ) {
711
+        if (handle_keypad()) {
718
           #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
712
           #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
719
             return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
713
             return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
720
           #endif
714
           #endif
721
         }
715
         }
716
+
722
       #endif
717
       #endif
723
 
718
 
724
       const float abs_diff = ABS(encoderDiff);
719
       const float abs_diff = ABS(encoderDiff);
923
 
918
 
924
 #if HAS_ENCODER_ACTION
919
 #if HAS_ENCODER_ACTION
925
 
920
 
926
-  #if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_ENCODER)
921
+  #if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_BUTTONS)
927
 
922
 
928
     /**
923
     /**
929
      * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
924
      * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
944
 
939
 
945
   #endif
940
   #endif
946
 
941
 
947
-  #if defined(EN_A) && defined(EN_B)
948
-    #define encrot0 0
949
-    #define encrot1 2
950
-    #define encrot2 3
951
-    #define encrot3 1
952
-  #endif
953
-
954
   /**
942
   /**
955
    * Read encoder buttons from the hardware registers
943
    * Read encoder buttons from the hardware registers
956
    * Warning: This function is called from interrupt context!
944
    * Warning: This function is called from interrupt context!
960
     const millis_t now = millis();
948
     const millis_t now = millis();
961
     if (ELAPSED(now, next_button_update_ms)) {
949
     if (ELAPSED(now, next_button_update_ms)) {
962
 
950
 
963
-      #if HAS_DIGITAL_ENCODER
951
+      #if HAS_DIGITAL_BUTTONS
964
         uint8_t newbutton = 0;
952
         uint8_t newbutton = 0;
965
 
953
 
966
         #if BUTTON_EXISTS(EN1)
954
         #if BUTTON_EXISTS(EN1)
1036
 
1024
 
1037
         #endif
1025
         #endif
1038
 
1026
 
1039
-      #else // !HAS_DIGITAL_ENCODER
1027
+      #else // !HAS_DIGITAL_BUTTONS
1040
 
1028
 
1041
         GET_SHIFT_BUTTON_STATES(buttons);
1029
         GET_SHIFT_BUTTON_STATES(buttons);
1042
 
1030
 
1044
 
1032
 
1045
     } // next_button_update_ms
1033
     } // next_button_update_ms
1046
 
1034
 
1047
-    // Manage encoder rotation
1048
-    #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; }
1049
-
1050
-    uint8_t enc = 0;
1051
-    if (buttons & EN_A) enc |= B01;
1052
-    if (buttons & EN_B) enc |= B10;
1053
-    if (enc != lastEncoderBits) {
1054
-      switch (enc) {
1055
-        case encrot0: ENCODER_SPIN(encrot3, encrot1); break;
1056
-        case encrot1: ENCODER_SPIN(encrot0, encrot2); break;
1057
-        case encrot2: ENCODER_SPIN(encrot1, encrot3); break;
1058
-        case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
1059
-      }
1060
-      if (external_control) {
1061
-        #if ENABLED(AUTO_BED_LEVELING_UBL)
1062
-          ubl.encoder_diff = encoderDiff;   // Make encoder rotation available to UBL G29 mesh editing.
1063
-        #endif
1064
-        encoderDiff = 0;                    // Hide the encoder event from the current screen handler.
1035
+    #if HAS_ENCODER_WHEEL
1036
+
1037
+      #define encrot0 0
1038
+      #define encrot1 2
1039
+      #define encrot2 3
1040
+      #define encrot3 1
1041
+
1042
+      // Manage encoder rotation
1043
+      #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; }
1044
+
1045
+      uint8_t enc = 0;
1046
+      if (buttons & EN_A) enc |= B01;
1047
+      if (buttons & EN_B) enc |= B10;
1048
+      if (enc != lastEncoderBits) {
1049
+        switch (enc) {
1050
+          case encrot0: ENCODER_SPIN(encrot3, encrot1); break;
1051
+          case encrot1: ENCODER_SPIN(encrot0, encrot2); break;
1052
+          case encrot2: ENCODER_SPIN(encrot1, encrot3); break;
1053
+          case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
1054
+        }
1055
+        if (external_control) {
1056
+          #if ENABLED(AUTO_BED_LEVELING_UBL)
1057
+            ubl.encoder_diff = encoderDiff;   // Make encoder rotation available to UBL G29 mesh editing.
1058
+          #endif
1059
+          encoderDiff = 0;                    // Hide the encoder event from the current screen handler.
1060
+        }
1061
+        lastEncoderBits = enc;
1065
       }
1062
       }
1066
-      lastEncoderBits = enc;
1067
-    }
1063
+
1064
+    #endif // HAS_ENCODER_WHEEL
1068
   }
1065
   }
1069
 
1066
 
1070
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1067
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)

+ 1
- 1
Marlin/src/lcd/ultralcd.h Wyświetl plik

88
 
88
 
89
 #endif
89
 #endif
90
 
90
 
91
-#if HAS_DIGITAL_ENCODER
91
+#if HAS_DIGITAL_BUTTONS
92
 
92
 
93
   // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
93
   // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
94
   #define BLEN_A 0
94
   #define BLEN_A 0

Ładowanie…
Anuluj
Zapisz