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. 45
      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_STEPS_PER_MENU_ITEM 1
#define ENCODER_FEEDRATE_DEADZONE 2
#define REVERSE_MENU_DIRECTION
#elif ENABLED(RADDS_DISPLAY)
#define ULTIPANEL
@ -306,7 +305,8 @@
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD)
#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
/**

45
Marlin/src/lcd/ultralcd.cpp

@ -186,7 +186,7 @@ void MarlinUI::init() {
init_lcd();
#if HAS_DIGITAL_ENCODER
#if HAS_DIGITAL_BUTTONS
#if BUTTON_EXISTS(EN1)
SET_INPUT_PULLUP(BTN_EN1);
@ -217,7 +217,7 @@ void MarlinUI::init() {
SET_INPUT(BTN_RT);
#endif
#else // !HAS_DIGITAL_ENCODER
#else // !HAS_DIGITAL_BUTTONS
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
SET_OUTPUT(SR_DATA_PIN);
@ -229,7 +229,7 @@ void MarlinUI::init() {
SET_INPUT_PULLUP(SHIFT_OUT);
#endif // SR_LCD_2W_NL
#endif // !HAS_DIGITAL_ENCODER
#endif // !HAS_DIGITAL_BUTTONS
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN);
@ -262,7 +262,7 @@ bool MarlinUI::get_blink() {
///////////// Keypad Handling //////////////
////////////////////////////////////////////
#if ENABLED(REPRAPWORLD_KEYPAD)
#if ENABLED(REPRAPWORLD_KEYPAD) && HAS_ENCODER_ACTION
volatile uint8_t MarlinUI::buttons_reprapworld_keypad;
@ -295,8 +295,8 @@ bool MarlinUI::get_blink() {
refresh(LCDVIEW_REDRAW_NOW);
if (encoderDirection == -1) { // side effect which signals we are inside a menu
#if HAS_LCD_MENU
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;
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_LEFT)) { MenuItem_back::action(); quick_feedback(); }
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { return_to_status(); quick_feedback(); }
#endif
@ -443,7 +443,7 @@ void MarlinUI::status_screen() {
#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;
// Dead zone at 100% feedrate
@ -708,17 +708,12 @@ void MarlinUI::update() {
#if ENABLED(REPRAPWORLD_KEYPAD)
if (
#if ENABLED(ADC_KEYPAD)
handle_keypad()
#else
handle_keypad()
#endif
) {
if (handle_keypad()) {
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
#endif
}
#endif
const float abs_diff = ABS(encoderDiff);
@ -923,7 +918,7 @@ void MarlinUI::update() {
#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)
@ -944,13 +939,6 @@ void MarlinUI::update() {
#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
* Warning: This function is called from interrupt context!
@ -960,7 +948,7 @@ void MarlinUI::update() {
const millis_t now = millis();
if (ELAPSED(now, next_button_update_ms)) {
#if HAS_DIGITAL_ENCODER
#if HAS_DIGITAL_BUTTONS
uint8_t newbutton = 0;
#if BUTTON_EXISTS(EN1)
@ -1036,7 +1024,7 @@ void MarlinUI::update() {
#endif
#else // !HAS_DIGITAL_ENCODER
#else // !HAS_DIGITAL_BUTTONS
GET_SHIFT_BUTTON_STATES(buttons);
@ -1044,6 +1032,13 @@ void MarlinUI::update() {
} // next_button_update_ms
#if HAS_ENCODER_WHEEL
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
// Manage encoder rotation
#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;
}
#endif // HAS_ENCODER_WHEEL
}
#if ENABLED(LCD_HAS_SLOW_BUTTONS)

2
Marlin/src/lcd/ultralcd.h

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

Loading…
Cancel
Save