Fix compile error with ZONESTAR_LCD+NO_LCD_MENUS (#12466)

This commit is contained in:
Ludy 2018-11-18 04:21:30 +01:00 committed by Scott Lahteine
parent 22d7fed60a
commit 93e958f695
3 changed files with 43 additions and 46 deletions

View file

@ -52,7 +52,6 @@
#define ENCODER_PULSES_PER_STEP 1 #define ENCODER_PULSES_PER_STEP 1
#define ENCODER_STEPS_PER_MENU_ITEM 1 #define ENCODER_STEPS_PER_MENU_ITEM 1
#define ENCODER_FEEDRATE_DEADZONE 2 #define ENCODER_FEEDRATE_DEADZONE 2
#define REVERSE_MENU_DIRECTION
#elif ENABLED(RADDS_DISPLAY) #elif ENABLED(RADDS_DISPLAY)
#define ULTIPANEL #define ULTIPANEL
@ -306,7 +305,8 @@
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD) #define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD) #define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)) #define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
#define HAS_DIGITAL_ENCODER ENABLED(NEWPANEL) #define HAS_DIGITAL_BUTTONS ENABLED(NEWPANEL)
#define HAS_ENCODER_WHEEL (ENABLED(NEWPANEL) && DISABLED(ADC_KEYPAD))
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
/** /**

View file

@ -186,7 +186,7 @@ void MarlinUI::init() {
init_lcd(); init_lcd();
#if HAS_DIGITAL_ENCODER #if HAS_DIGITAL_BUTTONS
#if BUTTON_EXISTS(EN1) #if BUTTON_EXISTS(EN1)
SET_INPUT_PULLUP(BTN_EN1); SET_INPUT_PULLUP(BTN_EN1);
@ -217,7 +217,7 @@ void MarlinUI::init() {
SET_INPUT(BTN_RT); SET_INPUT(BTN_RT);
#endif #endif
#else // !HAS_DIGITAL_ENCODER #else // !HAS_DIGITAL_BUTTONS
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
SET_OUTPUT(SR_DATA_PIN); SET_OUTPUT(SR_DATA_PIN);
@ -229,7 +229,7 @@ void MarlinUI::init() {
SET_INPUT_PULLUP(SHIFT_OUT); SET_INPUT_PULLUP(SHIFT_OUT);
#endif // SR_LCD_2W_NL #endif // SR_LCD_2W_NL
#endif // !HAS_DIGITAL_ENCODER #endif // !HAS_DIGITAL_BUTTONS
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN); SET_INPUT_PULLUP(SD_DETECT_PIN);
@ -262,7 +262,7 @@ bool MarlinUI::get_blink() {
///////////// Keypad Handling ////////////// ///////////// Keypad Handling //////////////
//////////////////////////////////////////// ////////////////////////////////////////////
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD) && HAS_ENCODER_ACTION
volatile uint8_t MarlinUI::buttons_reprapworld_keypad; volatile uint8_t MarlinUI::buttons_reprapworld_keypad;
@ -295,8 +295,8 @@ bool MarlinUI::get_blink() {
refresh(LCDVIEW_REDRAW_NOW); refresh(LCDVIEW_REDRAW_NOW);
if (encoderDirection == -1) { // side effect which signals we are inside a menu if (encoderDirection == -1) { // side effect which signals we are inside a menu
#if HAS_LCD_MENU #if HAS_LCD_MENU
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM; if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); } else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { MenuItem_back::action(); quick_feedback(); }
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); } else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); }
#endif #endif
@ -443,7 +443,7 @@ void MarlinUI::status_screen() {
#endif // HAS_LCD_MENU #endif // HAS_LCD_MENU
#if ENABLED(ULTIPANEL_FEEDMULTIPLY) #if ENABLED(ULTIPANEL_FEEDMULTIPLY) && HAS_ENCODER_ACTION
const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition; const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
// Dead zone at 100% feedrate // Dead zone at 100% feedrate
@ -708,17 +708,12 @@ void MarlinUI::update() {
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
if ( if (handle_keypad()) {
#if ENABLED(ADC_KEYPAD)
handle_keypad()
#else
handle_keypad()
#endif
) {
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS #if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
#endif #endif
} }
#endif #endif
const float abs_diff = ABS(encoderDiff); const float abs_diff = ABS(encoderDiff);
@ -923,7 +918,7 @@ void MarlinUI::update() {
#if HAS_ENCODER_ACTION #if HAS_ENCODER_ACTION
#if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_ENCODER) #if DISABLED(ADC_KEYPAD) && (ENABLED(REPRAPWORLD_KEYPAD) || !HAS_DIGITAL_BUTTONS)
/** /**
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
@ -944,13 +939,6 @@ void MarlinUI::update() {
#endif #endif
#if defined(EN_A) && defined(EN_B)
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#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!
@ -960,7 +948,7 @@ void MarlinUI::update() {
const millis_t now = millis(); const millis_t now = millis();
if (ELAPSED(now, next_button_update_ms)) { if (ELAPSED(now, next_button_update_ms)) {
#if HAS_DIGITAL_ENCODER #if HAS_DIGITAL_BUTTONS
uint8_t newbutton = 0; uint8_t newbutton = 0;
#if BUTTON_EXISTS(EN1) #if BUTTON_EXISTS(EN1)
@ -1036,7 +1024,7 @@ void MarlinUI::update() {
#endif #endif
#else // !HAS_DIGITAL_ENCODER #else // !HAS_DIGITAL_BUTTONS
GET_SHIFT_BUTTON_STATES(buttons); GET_SHIFT_BUTTON_STATES(buttons);
@ -1044,6 +1032,13 @@ void MarlinUI::update() {
} // next_button_update_ms } // next_button_update_ms
#if HAS_ENCODER_WHEEL
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
// Manage encoder rotation // Manage encoder rotation
#define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; } #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; }
@ -1065,6 +1060,8 @@ void MarlinUI::update() {
} }
lastEncoderBits = enc; lastEncoderBits = enc;
} }
#endif // HAS_ENCODER_WHEEL
} }
#if ENABLED(LCD_HAS_SLOW_BUTTONS) #if ENABLED(LCD_HAS_SLOW_BUTTONS)

View file

@ -88,7 +88,7 @@
#endif #endif
#if HAS_DIGITAL_ENCODER #if HAS_DIGITAL_BUTTONS
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes) // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
#define BLEN_A 0 #define BLEN_A 0