소스 검색

Fix build issues with REPRAPWORLD_KEYPAD (#17038)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Jason Smith 4 년 전
부모
커밋
5da6819277
No account linked to committer's email address
3개의 변경된 파일42개의 추가작업 그리고 43개의 파일을 삭제
  1. 21
    32
      Marlin/src/lcd/ultralcd.cpp
  2. 17
    9
      Marlin/src/pins/ramps/pins_RAMPS.h
  3. 4
    2
      buildroot/share/tests/megaatmega2560-tests

+ 21
- 32
Marlin/src/lcd/ultralcd.cpp 파일 보기

@@ -391,7 +391,7 @@ bool MarlinUI::get_blink() {
391 391
 
392 392
     void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
393 393
       move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
394
-      encoderPosition = dir;
394
+      ui.encoderPosition = dir;
395 395
       switch (axis) {
396 396
         case X_AXIS: lcd_move_x(); break;
397 397
         case Y_AXIS: lcd_move_y(); break;
@@ -1149,27 +1149,6 @@ void MarlinUI::update() {
1149 1149
 
1150 1150
 #if HAS_ENCODER_ACTION
1151 1151
 
1152
-  #if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_BUTTONS)
1153
-
1154
-    /**
1155
-     * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
1156
-     * These values are independent of which pins are used for EN_A and EN_B indications
1157
-     * The rotary encoder part is also independent to the chipset used for the LCD
1158
-     */
1159
-    #define GET_SHIFT_BUTTON_STATES(DST) \
1160
-      uint8_t new_##DST = 0; \
1161
-      WRITE(SHIFT_LD, LOW); \
1162
-      WRITE(SHIFT_LD, HIGH); \
1163
-      for (int8_t i = 0; i < 8; i++) { \
1164
-        new_##DST >>= 1; \
1165
-        if (READ(SHIFT_OUT)) SBI(new_##DST, 7); \
1166
-        WRITE(SHIFT_CLK, HIGH); \
1167
-        WRITE(SHIFT_CLK, LOW); \
1168
-      } \
1169
-      DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0
1170
-
1171
-  #endif
1172
-
1173 1152
   /**
1174 1153
    * Read encoder buttons from the hardware registers
1175 1154
    * Warning: This function is called from interrupt context!
@@ -1266,16 +1245,26 @@ void MarlinUI::update() {
1266 1245
         }
1267 1246
       #endif
1268 1247
 
1269
-      #if HAS_SHIFT_ENCODER
1270
-
1271
-        GET_SHIFT_BUTTON_STATES((
1272
-          #if ENABLED(REPRAPWORLD_KEYPAD)
1273
-            keypad_buttons
1274
-          #else
1275
-            buttons
1276
-          #endif
1277
-        ));
1278
-
1248
+      #if HAS_SHIFT_ENCODER      
1249
+        /**
1250
+         * Set up Rotary Encoder bit values (for two pin encoders to indicate movement).
1251
+         * These values are independent of which pins are used for EN_A / EN_B indications.
1252
+         * The rotary encoder part is also independent of the LCD chipset.
1253
+         */
1254
+        uint8_t val = 0;
1255
+        WRITE(SHIFT_LD, LOW);
1256
+        WRITE(SHIFT_LD, HIGH);
1257
+        LOOP_L_N(i, 8) {
1258
+          val >>= 1;
1259
+          if (READ(SHIFT_OUT)) SBI(val, 7);
1260
+          WRITE(SHIFT_CLK, HIGH);
1261
+          WRITE(SHIFT_CLK, LOW);
1262
+        }
1263
+        #if ENABLED(REPRAPWORLD_KEYPAD)
1264
+          keypad_buttons = ~val;
1265
+        #else
1266
+          buttons = ~val;
1267
+        #endif
1279 1268
       #endif
1280 1269
 
1281 1270
     } // next_button_update_ms

+ 17
- 9
Marlin/src/pins/ramps/pins_RAMPS.h 파일 보기

@@ -647,7 +647,7 @@
647 647
           #define NEOPIXEL_PIN    25
648 648
         #endif
649 649
 
650
-    #endif
650
+      #endif
651 651
 
652 652
     #elif ENABLED(MINIPANEL)
653 653
 
@@ -685,14 +685,7 @@
685 685
       #define BEEPER_PIN        33
686 686
 
687 687
       // Buttons are directly attached to AUX-2
688
-      #if ENABLED(REPRAPWORLD_KEYPAD)
689
-        #define SHIFT_OUT       40
690
-        #define SHIFT_CLK       44
691
-        #define SHIFT_LD        42
692
-        #define BTN_EN1         64
693
-        #define BTN_EN2         59
694
-        #define BTN_ENC         63
695
-      #elif ENABLED(PANEL_ONE)
688
+      #if ENABLED(PANEL_ONE)
696 689
         #define BTN_EN1         59   // AUX2 PIN 3
697 690
         #define BTN_EN2         63   // AUX2 PIN 4
698 691
         #define BTN_ENC         49   // AUX3 PIN 7
@@ -711,3 +704,18 @@
711 704
   #endif // NEWPANEL
712 705
 
713 706
 #endif // HAS_SPI_LCD
707
+
708
+#if ENABLED(REPRAPWORLD_KEYPAD)
709
+  #define SHIFT_OUT        40
710
+  #define SHIFT_CLK        44
711
+  #define SHIFT_LD         42
712
+  #ifndef BTN_EN1
713
+    #define BTN_EN1        64
714
+  #endif
715
+  #ifndef BTN_EN2
716
+    #define BTN_EN2        59
717
+  #endif
718
+  #ifndef BTN_ENC
719
+    #define BTN_ENC        63
720
+  #endif
721
+#endif

+ 4
- 2
buildroot/share/tests/megaatmega2560-tests 파일 보기

@@ -146,12 +146,14 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Cyrillic"
146 146
 # Test DUAL_X_CARRIAGE
147 147
 #
148 148
 restore_configs
149
-opt_set MOTHERBOARD BOARD_RUMBA
149
+opt_set MOTHERBOARD BOARD_TT_OSCAR
150 150
 opt_set LCD_LANGUAGE pt
151 151
 opt_set EXTRUDERS 2
152 152
 opt_set TEMP_SENSOR_1 1
153 153
 opt_enable USE_XMAX_PLUG DUAL_X_CARRIAGE
154
-exec_test $1 $2 "Rumba | DUAL_X_CARRIAGE"
154
+opt_enable REPRAPWORLD_KEYPAD
155
+opt_set REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
156
+exec_test $1 $2 "TT Oscar | DUAL_X_CARRIAGE"
155 157
 
156 158
 #
157 159
 # Test SPEAKER with BOARD_BQ_ZUM_MEGA_3D and BQ_LCD_SMART_CONTROLLER

Loading…
취소
저장