|
@@ -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
|