Fix build issues with REPRAPWORLD_KEYPAD (#17038)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Jason Smith 2020-03-01 17:54:22 -08:00 committed by GitHub
parent 362c9ae79a
commit 5da6819277
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 43 deletions

View file

@ -391,7 +391,7 @@ bool MarlinUI::get_blink() {
void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
encoderPosition = dir; ui.encoderPosition = dir;
switch (axis) { switch (axis) {
case X_AXIS: lcd_move_x(); break; case X_AXIS: lcd_move_x(); break;
case Y_AXIS: lcd_move_y(); break; case Y_AXIS: lcd_move_y(); break;
@ -1149,27 +1149,6 @@ void MarlinUI::update() {
#if HAS_ENCODER_ACTION #if HAS_ENCODER_ACTION
#if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_BUTTONS)
/**
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
* These values are independent of which pins are used for EN_A and EN_B indications
* The rotary encoder part is also independent to the chipset used for the LCD
*/
#define GET_SHIFT_BUTTON_STATES(DST) \
uint8_t new_##DST = 0; \
WRITE(SHIFT_LD, LOW); \
WRITE(SHIFT_LD, HIGH); \
for (int8_t i = 0; i < 8; i++) { \
new_##DST >>= 1; \
if (READ(SHIFT_OUT)) SBI(new_##DST, 7); \
WRITE(SHIFT_CLK, HIGH); \
WRITE(SHIFT_CLK, LOW); \
} \
DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0
#endif
/** /**
* Read encoder buttons from the hardware registers * Read encoder buttons from the hardware registers
* Warning: This function is called from interrupt context! * Warning: This function is called from interrupt context!
@ -1267,15 +1246,25 @@ void MarlinUI::update() {
#endif #endif
#if HAS_SHIFT_ENCODER #if HAS_SHIFT_ENCODER
/**
GET_SHIFT_BUTTON_STATES(( * Set up Rotary Encoder bit values (for two pin encoders to indicate movement).
#if ENABLED(REPRAPWORLD_KEYPAD) * These values are independent of which pins are used for EN_A / EN_B indications.
keypad_buttons * The rotary encoder part is also independent of the LCD chipset.
#else */
buttons uint8_t val = 0;
#endif WRITE(SHIFT_LD, LOW);
)); WRITE(SHIFT_LD, HIGH);
LOOP_L_N(i, 8) {
val >>= 1;
if (READ(SHIFT_OUT)) SBI(val, 7);
WRITE(SHIFT_CLK, HIGH);
WRITE(SHIFT_CLK, LOW);
}
#if ENABLED(REPRAPWORLD_KEYPAD)
keypad_buttons = ~val;
#else
buttons = ~val;
#endif
#endif #endif
} // next_button_update_ms } // next_button_update_ms

View file

@ -647,7 +647,7 @@
#define NEOPIXEL_PIN 25 #define NEOPIXEL_PIN 25
#endif #endif
#endif #endif
#elif ENABLED(MINIPANEL) #elif ENABLED(MINIPANEL)
@ -685,14 +685,7 @@
#define BEEPER_PIN 33 #define BEEPER_PIN 33
// Buttons are directly attached to AUX-2 // Buttons are directly attached to AUX-2
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(PANEL_ONE)
#define SHIFT_OUT 40
#define SHIFT_CLK 44
#define SHIFT_LD 42
#define BTN_EN1 64
#define BTN_EN2 59
#define BTN_ENC 63
#elif ENABLED(PANEL_ONE)
#define BTN_EN1 59 // AUX2 PIN 3 #define BTN_EN1 59 // AUX2 PIN 3
#define BTN_EN2 63 // AUX2 PIN 4 #define BTN_EN2 63 // AUX2 PIN 4
#define BTN_ENC 49 // AUX3 PIN 7 #define BTN_ENC 49 // AUX3 PIN 7
@ -711,3 +704,18 @@
#endif // NEWPANEL #endif // NEWPANEL
#endif // HAS_SPI_LCD #endif // HAS_SPI_LCD
#if ENABLED(REPRAPWORLD_KEYPAD)
#define SHIFT_OUT 40
#define SHIFT_CLK 44
#define SHIFT_LD 42
#ifndef BTN_EN1
#define BTN_EN1 64
#endif
#ifndef BTN_EN2
#define BTN_EN2 59
#endif
#ifndef BTN_ENC
#define BTN_ENC 63
#endif
#endif

View file

@ -146,12 +146,14 @@ exec_test $1 $2 "Azteeg X3 | Mixing Extruder (x5) | Gradient Mix | Cyrillic"
# Test DUAL_X_CARRIAGE # Test DUAL_X_CARRIAGE
# #
restore_configs restore_configs
opt_set MOTHERBOARD BOARD_RUMBA opt_set MOTHERBOARD BOARD_TT_OSCAR
opt_set LCD_LANGUAGE pt opt_set LCD_LANGUAGE pt
opt_set EXTRUDERS 2 opt_set EXTRUDERS 2
opt_set TEMP_SENSOR_1 1 opt_set TEMP_SENSOR_1 1
opt_enable USE_XMAX_PLUG DUAL_X_CARRIAGE opt_enable USE_XMAX_PLUG DUAL_X_CARRIAGE
exec_test $1 $2 "Rumba | DUAL_X_CARRIAGE" opt_enable REPRAPWORLD_KEYPAD
opt_set REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
exec_test $1 $2 "TT Oscar | DUAL_X_CARRIAGE"
# #
# Test SPEAKER with BOARD_BQ_ZUM_MEGA_3D and BQ_LCD_SMART_CONTROLLER # Test SPEAKER with BOARD_BQ_ZUM_MEGA_3D and BQ_LCD_SMART_CONTROLLER