More comprehensive NO_LCD_MENUS (#12367)

This commit is contained in:
Scott Lahteine 2018-11-09 00:07:16 -06:00 committed by GitHub
parent 9c8f083d6c
commit 4ed6397e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 187 additions and 142 deletions

View File

@ -296,10 +296,6 @@
#define ULTIPANEL #define ULTIPANEL
#endif #endif
#if ENABLED(NO_LCD_MENUS)
#undef ULTIPANEL
#endif
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD) #define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
@ -336,9 +332,7 @@
// Aliases for LCD features // Aliases for LCD features
#define HAS_SPI_LCD ENABLED(ULTRA_LCD) #define HAS_SPI_LCD ENABLED(ULTRA_LCD)
#define HAS_CHARACTER_LCD (ENABLED(ULTRA_LCD) && DISABLED(DOGLCD)) #define HAS_CHARACTER_LCD (ENABLED(ULTRA_LCD) && DISABLED(DOGLCD))
#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL)) #define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
#define HAS_LCD_MENU ENABLED(ULTIPANEL)
#define HAS_DEBUG_MENU (HAS_LCD_MENU && ENABLED(LCD_PROGRESS_BAR_TEST))
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
/* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */ /* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */

View File

@ -27,7 +27,7 @@
/** /**
* ultralcd_impl_HD44780.cpp * ultralcd_impl_HD44780.cpp
* *
* Implementation of the LCD display routines for a Hitachi HD44780 display. * LCD display implementations for Hitachi HD44780.
* These are the most common LCD character displays. * These are the most common LCD character displays.
*/ */
@ -44,43 +44,46 @@
#include "../../feature/bedlevel/ubl/ubl.h" #include "../../feature/bedlevel/ubl/ubl.h"
#endif #endif
//////////////////////////////////// //
// Create LCD class instance and chipset-specific information // Create LCD instance and chipset-specific information
//
#if ENABLED(LCD_I2C_TYPE_PCF8575) #if ENABLED(LCD_I2C_TYPE_PCF8575)
LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7); LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_I2C_PIN_EN, LCD_I2C_PIN_RW, LCD_I2C_PIN_RS, LCD_I2C_PIN_D4, LCD_I2C_PIN_D5, LCD_I2C_PIN_D6, LCD_I2C_PIN_D7);
#elif ENABLED(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)
#if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else
LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif
#elif ENABLED(LCD_I2C_TYPE_MCP23008) LCD_CLASS lcd(LCD_I2C_ADDRESS
#if ENABLED(DETECT_DEVICE) #ifdef DETECT_DEVICE
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); , 1
#else #endif
LCD_CLASS lcd(LCD_I2C_ADDRESS); );
#endif
#elif ENABLED(LCD_I2C_TYPE_PCA8574) #elif ENABLED(LCD_I2C_TYPE_PCA8574)
LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#elif ENABLED(SR_LCD_2W_NL) #elif ENABLED(SR_LCD_2W_NL)
#if PIN_EXISTS(SR_STROBE)
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN); // 2 wire Non-latching LCD SR from:
#else // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);
#endif LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN
#if PIN_EXISTS(SR_STROBE)
, SR_STROBE_PIN
#endif
);
#elif ENABLED(LCM1602) #elif ENABLED(LCM1602)
LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#else #else
// Standard directly connected LCD implementations
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7 // Standard direct-connected LCD implementations
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7);
#endif #endif
#if ENABLED(LCD_HAS_STATUS_INDICATORS) #if ENABLED(LCD_HAS_STATUS_INDICATORS)

View File

@ -24,9 +24,7 @@
#include "../ultralcd.h" #include "../ultralcd.h"
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
extern uint32_t encoderPosition;
extern int8_t encoderLine, encoderTopLine, screen_items; extern int8_t encoderLine, encoderTopLine, screen_items;
extern millis_t lastEncoderMovementMillis;
extern bool screen_changed; extern bool screen_changed;
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP); constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP);
@ -279,10 +277,10 @@ class menu_item_bool {
#endif #endif
#if ENABLED(ENCODER_RATE_MULTIPLIER) #if ENABLED(ENCODER_RATE_MULTIPLIER)
extern millis_t lastEncoderMovementMillis;
extern bool encoderRateMultiplierEnabled; extern bool encoderRateMultiplierEnabled;
#define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F) #define ENCODER_RATE_MULTIPLY(F) (encoderRateMultiplierEnabled = F)
#define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) if(USE_MULTIPLIER) {encoderRateMultiplierEnabled = true; lastEncoderMovementMillis = 0;} #define _MENU_ITEM_MULTIPLIER_CHECK(USE_MULTIPLIER) if (USE_MULTIPLIER) { encoderRateMultiplierEnabled = true; lastEncoderMovementMillis = 0; }
//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
#else // !ENCODER_RATE_MULTIPLIER #else // !ENCODER_RATE_MULTIPLIER
#define ENCODER_RATE_MULTIPLY(F) NOOP #define ENCODER_RATE_MULTIPLY(F) NOOP

View File

@ -36,6 +36,8 @@
#include "../../feature/runout.h" #include "../../feature/runout.h"
#endif #endif
#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
void menu_advanced_settings(); void menu_advanced_settings();
void menu_delta_calibrate(); void menu_delta_calibrate();

View File

@ -114,12 +114,16 @@ millis_t next_button_update_ms;
bool drawing_screen, first_page; // = false bool drawing_screen, first_page; // = false
#endif #endif
#if ENABLED(ENCODER_RATE_MULTIPLIER) // Encoder Handling
bool encoderRateMultiplierEnabled; #if HAS_ENCODER_ACTION
#endif uint32_t encoderPosition;
volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update
#if ENABLED(REVERSE_MENU_DIRECTION) #if ENABLED(ENCODER_RATE_MULTIPLIER)
int8_t encoderDirection = 1; bool encoderRateMultiplierEnabled;
#endif
#if ENABLED(REVERSE_MENU_DIRECTION)
int8_t encoderDirection = 1;
#endif
#endif #endif
#if HAS_LCD_MENU #if HAS_LCD_MENU
@ -127,10 +131,10 @@ millis_t next_button_update_ms;
screenFunc_t currentScreen = lcd_status_screen; screenFunc_t currentScreen = lcd_status_screen;
// Encoder Handling #if ENABLED(ENCODER_RATE_MULTIPLIER)
volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update millis_t lastEncoderMovementMillis = 0;
uint32_t encoderPosition; #endif
millis_t lastEncoderMovementMillis = 0;
bool lcd_clicked, wait_for_unclick; bool lcd_clicked, wait_for_unclick;
float move_menu_scale; float move_menu_scale;
@ -139,6 +143,11 @@ millis_t next_button_update_ms;
lcd_clicked = false; lcd_clicked = false;
return click; return click;
} }
#else
constexpr bool lcd_clicked = false;
#endif #endif
void lcd_init() { void lcd_init() {
@ -200,7 +209,7 @@ void lcd_init() {
lcd_buttons_update(); lcd_buttons_update();
#if HAS_LCD_MENU #if HAS_ENCODER_ACTION
encoderDiff = 0; encoderDiff = 0;
#endif #endif
} }
@ -229,17 +238,20 @@ bool lcd_blink() {
inline bool handle_adc_keypad() { inline bool handle_adc_keypad() {
#define ADC_MIN_KEY_DELAY 100 #define ADC_MIN_KEY_DELAY 100
if (buttons_reprapworld_keypad) { if (buttons_reprapworld_keypad) {
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; #if HAS_ENCODER_ACTION
if (encoderDirection == -1) { // side effect which signals we are inside a menu lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM; if (encoderDirection == -1) { // side effect which signals we are inside a menu
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM; #if HAS_LCD_MENU
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { menu_action_back(); lcd_quick_feedback(true); } if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition -= ENCODER_STEPS_PER_MENU_ITEM;
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { lcd_return_to_status(); lcd_quick_feedback(true); } else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition += ENCODER_STEPS_PER_MENU_ITEM;
} else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { menu_item_back::action(); lcd_quick_feedback(true); }
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_PULSES_PER_STEP; else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { lcd_return_to_status(); lcd_quick_feedback(true); }
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition -= ENCODER_PULSES_PER_STEP; #endif
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) encoderPosition = 0; }
else if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) encoderPosition += ENCODER_PULSES_PER_STEP;
else if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) encoderPosition -= ENCODER_PULSES_PER_STEP;
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) encoderPosition = 0;
#endif
next_button_update_ms = millis() + ADC_MIN_KEY_DELAY; next_button_update_ms = millis() + ADC_MIN_KEY_DELAY;
return true; return true;
} }
@ -249,20 +261,24 @@ bool lcd_blink() {
#elif ENABLED(REPRAPWORLD_KEYPAD) #elif ENABLED(REPRAPWORLD_KEYPAD)
void lcd_move_x(); #if HAS_LCD_MENU
void lcd_move_y();
void lcd_move_z();
void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) { void lcd_move_x();
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; void lcd_move_y();
encoderPosition = dir; void lcd_move_z();
switch (axis) {
case X_AXIS: lcd_move_x(); break; void _reprapworld_keypad_move(const AxisEnum axis, const int16_t dir) {
case Y_AXIS: lcd_move_y(); break; move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
case Z_AXIS: lcd_move_z(); encoderPosition = dir;
default: break; switch (axis) {
case X_AXIS: lcd_move_x(); break;
case Y_AXIS: lcd_move_y(); break;
case Z_AXIS: lcd_move_z();
default: break;
}
} }
}
#endif
inline void handle_reprapworld_keypad() { inline void handle_reprapworld_keypad() {
@ -278,23 +294,30 @@ bool lcd_blink() {
else if (!keypad_debounce) { else if (!keypad_debounce) {
keypad_debounce = 2; keypad_debounce = 2;
if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE)) lcd_goto_screen(menu_move); const bool homed = all_axes_homed();
#if DISABLED(DELTA) && Z_HOME_DIR == -1 #if HAS_LCD_MENU
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
#endif
if (all_axes_homed()) { if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE)) lcd_goto_screen(menu_move);
#if ENABLED(DELTA) || Z_HOME_DIR != -1
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1); #if DISABLED(DELTA) && Z_HOME_DIR == -1
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
#endif #endif
if (RRK(EN_REPRAPWORLD_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1);
if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) _reprapworld_keypad_move(X_AXIS, -1); if (homed) {
if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS, 1); #if ENABLED(DELTA) || Z_HOME_DIR != -1
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) _reprapworld_keypad_move(Y_AXIS, 1); if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) _reprapworld_keypad_move(Y_AXIS, -1); #endif
} if (RRK(EN_REPRAPWORLD_KEYPAD_F3)) _reprapworld_keypad_move(Z_AXIS, -1);
else if (RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28")); if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) _reprapworld_keypad_move(X_AXIS, -1);
if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) _reprapworld_keypad_move(X_AXIS, 1);
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) _reprapworld_keypad_move(Y_AXIS, 1);
if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) _reprapworld_keypad_move(Y_AXIS, -1);
}
#endif // HAS_LCD_MENU
if (!homed && RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
} }
} }
@ -387,32 +410,34 @@ void lcd_status_screen() {
return; return;
} }
#if ENABLED(ULTIPANEL_FEEDMULTIPLY) #endif // HAS_LCD_MENU
const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
// Dead zone at 100% feedrate #if ENABLED(ULTIPANEL_FEEDMULTIPLY)
if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) {
feedrate_percentage = 100; const int16_t new_frm = feedrate_percentage + (int32_t)encoderPosition;
// Dead zone at 100% feedrate
if ((feedrate_percentage < 100 && new_frm > 100) || (feedrate_percentage > 100 && new_frm < 100)) {
feedrate_percentage = 100;
encoderPosition = 0;
}
else if (feedrate_percentage == 100) {
if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) {
feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE);
encoderPosition = 0; encoderPosition = 0;
} }
else if (feedrate_percentage == 100) { else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) {
if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) { feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE;
feedrate_percentage += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE);
encoderPosition = 0;
}
else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) {
feedrate_percentage += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE;
encoderPosition = 0;
}
}
else {
feedrate_percentage = new_frm;
encoderPosition = 0; encoderPosition = 0;
} }
#endif // ULTIPANEL_FEEDMULTIPLY }
else {
feedrate_percentage = new_frm;
encoderPosition = 0;
}
feedrate_percentage = constrain(feedrate_percentage, 10, 999); feedrate_percentage = constrain(feedrate_percentage, 10, 999);
#endif // HAS_LCD_MENU #endif // ULTIPANEL_FEEDMULTIPLY
#if LCD_INFO_SCREEN_STYLE == 0 #if LCD_INFO_SCREEN_STYLE == 0
lcd_impl_status_screen_0(); lcd_impl_status_screen_0();
@ -594,6 +619,16 @@ LCDViewAction lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
volatile uint8_t slow_buttons; volatile uint8_t slow_buttons;
#endif #endif
bool lcd_detected() {
return
#if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE)
lcd.LcdDetected() == 1
#else
true
#endif
;
}
void lcd_update() { void lcd_update() {
static uint16_t max_display_update_time = 0; static uint16_t max_display_update_time = 0;
@ -693,10 +728,14 @@ void lcd_update() {
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
#endif #endif
#endif // HAS_LCD_MENU
#if HAS_ENCODER_ACTION
#if ENABLED(ADC_KEYPAD) #if ENABLED(ADC_KEYPAD)
if (handle_adc_keypad()) { if (handle_adc_keypad()) {
#if 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
} }
@ -710,9 +749,10 @@ void lcd_update() {
const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP); const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP);
if (encoderPastThreshold || lcd_clicked) { if (encoderPastThreshold || lcd_clicked) {
if (encoderPastThreshold) { if (encoderPastThreshold) {
int32_t encoderMultiplier = 1;
#if ENABLED(ENCODER_RATE_MULTIPLIER) #if HAS_LCD_MENU && ENABLED(ENCODER_RATE_MULTIPLIER)
int32_t encoderMultiplier = 1;
if (encoderRateMultiplierEnabled) { if (encoderRateMultiplierEnabled) {
int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP; int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP;
@ -737,18 +777,23 @@ void lcd_update() {
lastEncoderMovementMillis = ms; lastEncoderMovementMillis = ms;
} // encoderRateMultiplierEnabled } // encoderRateMultiplierEnabled
#else
constexpr int32_t encoderMultiplier = 1;
#endif // ENCODER_RATE_MULTIPLIER #endif // ENCODER_RATE_MULTIPLIER
encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP; encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
encoderDiff = 0; encoderDiff = 0;
} }
#if 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
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
} }
#endif // HAS_LCD_MENU #endif
// This runs every ~100ms when idling often enough. // This runs every ~100ms when idling often enough.
// Instead of tracking changes just redraw the Status Screen once per second. // Instead of tracking changes just redraw the Status Screen once per second.
@ -1039,12 +1084,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
} \ } \
DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0 DST = ~new_##DST; //invert it, because a pressed switch produces a logical 0
#if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
bool lcd_detected() { return lcd.LcdDetected() == 1; }
#else
bool lcd_detected() { return true; }
#endif
#if ENABLED(G26_MESH_VALIDATION) #if ENABLED(G26_MESH_VALIDATION)
void lcd_chirp() { void lcd_chirp() {
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);

View File

@ -198,6 +198,12 @@
inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); } inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
#endif #endif
#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
#if HAS_ENCODER_ACTION
extern uint32_t encoderPosition;
#endif
#if HAS_SPI_LCD #if HAS_SPI_LCD
#include "../Marlin.h" #include "../Marlin.h"
@ -375,30 +381,32 @@
#endif #endif
#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL))
#if HAS_DIGITAL_ENCODER
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
#define BLEN_A 0
#define BLEN_B 1
#define EN_A _BV(BLEN_A)
#define EN_B _BV(BLEN_B)
#if BUTTON_EXISTS(ENC)
#define BLEN_C 2
#define EN_C _BV(BLEN_C)
#endif
#if BUTTON_EXISTS(BACK)
#define BLEN_D 3
#define EN_D _BV(BLEN_D)
#define LCD_BACK_CLICKED (buttons & EN_D)
#endif
#endif // HAS_DIGITAL_ENCODER
#if HAS_LCD_MENU #if HAS_LCD_MENU
#if HAS_DIGITAL_ENCODER
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
#define BLEN_A 0
#define BLEN_B 1
#define EN_A _BV(BLEN_A)
#define EN_B _BV(BLEN_B)
#if BUTTON_EXISTS(ENC)
#define BLEN_C 2
#define EN_C _BV(BLEN_C)
#endif
#if BUTTON_EXISTS(BACK)
#define BLEN_D 3
#define EN_D _BV(BLEN_D)
#define LCD_BACK_CLICKED (buttons & EN_D)
#endif
#endif // NEWPANEL
extern volatile uint8_t buttons; // The last-checked buttons in a bit array. extern volatile uint8_t buttons; // The last-checked buttons in a bit array.
void lcd_buttons_update(); void lcd_buttons_update();

View File

@ -153,7 +153,7 @@
// //
// LCD / Controller // LCD / Controller
// //
#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) #if ENABLED(ULTRA_LCD)
#if ENABLED(DOGLCD) #if ENABLED(DOGLCD)
@ -217,9 +217,6 @@
#endif // !DOGLCD #endif // !DOGLCD
#define BTN_EN1 11
#define BTN_EN2 10
#if ENABLED(LCD_I2C_PANELOLU2) #if ENABLED(LCD_I2C_PANELOLU2)
#if ENABLED(IS_MELZI) #if ENABLED(IS_MELZI)
@ -258,7 +255,6 @@
#define LCD_PINS_D7 17 #define LCD_PINS_D7 17
#define ADC_KEYPAD_PIN 1 #define ADC_KEYPAD_PIN 1
// Not used
#define BTN_EN1 -1 #define BTN_EN1 -1
#define BTN_EN2 -1 #define BTN_EN2 -1
@ -269,9 +265,14 @@
#endif #endif
#if ENABLED(NEWPANEL) && !defined(BTN_EN1)
#define BTN_EN1 11
#define BTN_EN2 10
#endif
#define SD_DETECT_PIN -1 #define SD_DETECT_PIN -1
#endif // ULTRA_LCD && NEWPANEL #endif // ULTRA_LCD
// //
// M3/M4/M5 - Spindle/Laser Control // M3/M4/M5 - Spindle/Laser Control

View File

@ -13,7 +13,7 @@ opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSU
PAREN_COMMENTS GCODE_MOTION_MODES SINGLENOZZLE TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_PARK PAREN_COMMENTS GCODE_MOTION_MODES SINGLENOZZLE TOOLCHANGE_FILAMENT_SWAP TOOLCHANGE_PARK
exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT PAREN_COMMENTS GCODE_MOTION_MODES" exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT PAREN_COMMENTS GCODE_MOTION_MODES"
opt_enable SPINDLE_LASER_ENABLE opt_enable SPINDLE_LASER_ENABLE NO_LCD_MENUS
exec_test $1 $2 "STM32F1R SPINDLE_LASER_ENABLE" exec_test $1 $2 "STM32F1R SPINDLE_LASER_ENABLE"
# cleanup # cleanup