Browse Source

Fix compile error with ZONESTAR_LCD+NO_LCD_MENUS (#12466)

pull/1/head
Ludy 6 years ago
committed by Scott Lahteine
parent
commit
93e958f695
  1. 4
      Marlin/src/inc/Conditionals_LCD.h
  2. 85
      Marlin/src/lcd/ultralcd.cpp
  3. 2
      Marlin/src/lcd/ultralcd.h

4
Marlin/src/inc/Conditionals_LCD.h

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

85
Marlin/src/lcd/ultralcd.cpp

@ -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,27 +1032,36 @@ void MarlinUI::update() {
} // next_button_update_ms } // next_button_update_ms
// Manage encoder rotation #if HAS_ENCODER_WHEEL
#define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; }
#define encrot0 0
uint8_t enc = 0; #define encrot1 2
if (buttons & EN_A) enc |= B01; #define encrot2 3
if (buttons & EN_B) enc |= B10; #define encrot3 1
if (enc != lastEncoderBits) {
switch (enc) { // Manage encoder rotation
case encrot0: ENCODER_SPIN(encrot3, encrot1); break; #define ENCODER_SPIN(_E1, _E2) switch (lastEncoderBits) { case _E1: encoderDiff += encoderDirection; break; case _E2: encoderDiff -= encoderDirection; }
case encrot1: ENCODER_SPIN(encrot0, encrot2); break;
case encrot2: ENCODER_SPIN(encrot1, encrot3); break; uint8_t enc = 0;
case encrot3: ENCODER_SPIN(encrot2, encrot0); break; if (buttons & EN_A) enc |= B01;
} if (buttons & EN_B) enc |= B10;
if (external_control) { if (enc != lastEncoderBits) {
#if ENABLED(AUTO_BED_LEVELING_UBL) switch (enc) {
ubl.encoder_diff = encoderDiff; // Make encoder rotation available to UBL G29 mesh editing. case encrot0: ENCODER_SPIN(encrot3, encrot1); break;
#endif case encrot1: ENCODER_SPIN(encrot0, encrot2); break;
encoderDiff = 0; // Hide the encoder event from the current screen handler. case encrot2: ENCODER_SPIN(encrot1, encrot3); break;
case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
}
if (external_control) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.encoder_diff = encoderDiff; // Make encoder rotation available to UBL G29 mesh editing.
#endif
encoderDiff = 0; // Hide the encoder event from the current screen handler.
}
lastEncoderBits = enc;
} }
lastEncoderBits = enc;
} #endif // HAS_ENCODER_WHEEL
} }
#if ENABLED(LCD_HAS_SLOW_BUTTONS) #if ENABLED(LCD_HAS_SLOW_BUTTONS)

2
Marlin/src/lcd/ultralcd.h

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

Loading…
Cancel
Save