More comprehensive NO_LCD_MENUS (#12367)
This commit is contained in:
parent
9c8f083d6c
commit
4ed6397e5d
8 changed files with 187 additions and 142 deletions
|
@ -296,10 +296,6 @@
|
|||
#define ULTIPANEL
|
||||
#endif
|
||||
|
||||
#if ENABLED(NO_LCD_MENUS)
|
||||
#undef ULTIPANEL
|
||||
#endif
|
||||
|
||||
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD)
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
|
@ -336,9 +332,7 @@
|
|||
// Aliases for LCD features
|
||||
#define HAS_SPI_LCD ENABLED(ULTRA_LCD)
|
||||
#define HAS_CHARACTER_LCD (ENABLED(ULTRA_LCD) && DISABLED(DOGLCD))
|
||||
#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL))
|
||||
#define HAS_LCD_MENU ENABLED(ULTIPANEL)
|
||||
#define HAS_DEBUG_MENU (HAS_LCD_MENU && ENABLED(LCD_PROGRESS_BAR_TEST))
|
||||
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
|
||||
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
/* Custom characters defined in font Marlin_symbols.fon which was merged to ISO10646-0-3.bdf */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
@ -44,43 +44,46 @@
|
|||
#include "../../feature/bedlevel/ubl/ubl.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////
|
||||
// Create LCD class instance and chipset-specific information
|
||||
//
|
||||
// Create LCD instance and chipset-specific information
|
||||
//
|
||||
|
||||
#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);
|
||||
|
||||
#elif ENABLED(LCD_I2C_TYPE_MCP23017)
|
||||
#if ENABLED(DETECT_DEVICE)
|
||||
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
|
||||
#else
|
||||
LCD_CLASS lcd(LCD_I2C_ADDRESS);
|
||||
#endif
|
||||
#elif ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)
|
||||
|
||||
#elif ENABLED(LCD_I2C_TYPE_MCP23008)
|
||||
#if ENABLED(DETECT_DEVICE)
|
||||
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
|
||||
#else
|
||||
LCD_CLASS lcd(LCD_I2C_ADDRESS);
|
||||
LCD_CLASS lcd(LCD_I2C_ADDRESS
|
||||
#ifdef DETECT_DEVICE
|
||||
, 1
|
||||
#endif
|
||||
);
|
||||
|
||||
#elif ENABLED(LCD_I2C_TYPE_PCA8574)
|
||||
|
||||
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)
|
||||
|
||||
// 2 wire Non-latching LCD SR from:
|
||||
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
|
||||
|
||||
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN
|
||||
#if PIN_EXISTS(SR_STROBE)
|
||||
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN, SR_STROBE_PIN);
|
||||
#else
|
||||
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);
|
||||
, SR_STROBE_PIN
|
||||
#endif
|
||||
);
|
||||
|
||||
#elif ENABLED(LCM1602)
|
||||
|
||||
LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
|
||||
|
||||
#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
|
||||
|
||||
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
#include "../ultralcd.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
extern uint32_t encoderPosition;
|
||||
extern int8_t encoderLine, encoderTopLine, screen_items;
|
||||
extern millis_t lastEncoderMovementMillis;
|
||||
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);
|
||||
|
@ -279,10 +277,10 @@ class menu_item_bool {
|
|||
#endif
|
||||
|
||||
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
||||
|
||||
extern millis_t lastEncoderMovementMillis;
|
||||
extern bool encoderRateMultiplierEnabled;
|
||||
#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
|
||||
#else // !ENCODER_RATE_MULTIPLIER
|
||||
#define ENCODER_RATE_MULTIPLY(F) NOOP
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include "../../feature/runout.h"
|
||||
#endif
|
||||
|
||||
#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
|
||||
|
||||
void menu_advanced_settings();
|
||||
void menu_delta_calibrate();
|
||||
|
||||
|
|
|
@ -114,12 +114,16 @@ millis_t next_button_update_ms;
|
|||
bool drawing_screen, first_page; // = false
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
||||
// Encoder Handling
|
||||
#if HAS_ENCODER_ACTION
|
||||
uint32_t encoderPosition;
|
||||
volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update
|
||||
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
||||
bool encoderRateMultiplierEnabled;
|
||||
#endif
|
||||
|
||||
#if ENABLED(REVERSE_MENU_DIRECTION)
|
||||
#endif
|
||||
#if ENABLED(REVERSE_MENU_DIRECTION)
|
||||
int8_t encoderDirection = 1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
@ -127,10 +131,10 @@ millis_t next_button_update_ms;
|
|||
|
||||
screenFunc_t currentScreen = lcd_status_screen;
|
||||
|
||||
// Encoder Handling
|
||||
volatile int8_t encoderDiff; // Updated in lcd_buttons_update, added to encoderPosition every LCD update
|
||||
uint32_t encoderPosition;
|
||||
#if ENABLED(ENCODER_RATE_MULTIPLIER)
|
||||
millis_t lastEncoderMovementMillis = 0;
|
||||
#endif
|
||||
|
||||
bool lcd_clicked, wait_for_unclick;
|
||||
float move_menu_scale;
|
||||
|
||||
|
@ -139,6 +143,11 @@ millis_t next_button_update_ms;
|
|||
lcd_clicked = false;
|
||||
return click;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
constexpr bool lcd_clicked = false;
|
||||
|
||||
#endif
|
||||
|
||||
void lcd_init() {
|
||||
|
@ -200,7 +209,7 @@ void lcd_init() {
|
|||
|
||||
lcd_buttons_update();
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#if HAS_ENCODER_ACTION
|
||||
encoderDiff = 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -229,17 +238,20 @@ bool lcd_blink() {
|
|||
inline bool handle_adc_keypad() {
|
||||
#define ADC_MIN_KEY_DELAY 100
|
||||
if (buttons_reprapworld_keypad) {
|
||||
#if HAS_ENCODER_ACTION
|
||||
lcdDrawUpdate = 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;
|
||||
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { menu_action_back(); lcd_quick_feedback(true); }
|
||||
else if (RRK(EN_REPRAPWORLD_KEYPAD_LEFT)) { menu_item_back::action(); lcd_quick_feedback(true); }
|
||||
else if (RRK(EN_REPRAPWORLD_KEYPAD_RIGHT)) { lcd_return_to_status(); lcd_quick_feedback(true); }
|
||||
#endif
|
||||
}
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
@ -249,6 +261,8 @@ bool lcd_blink() {
|
|||
|
||||
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
void lcd_move_x();
|
||||
void lcd_move_y();
|
||||
void lcd_move_z();
|
||||
|
@ -264,6 +278,8 @@ bool lcd_blink() {
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline void handle_reprapworld_keypad() {
|
||||
|
||||
static uint8_t keypad_debounce = 0;
|
||||
|
@ -278,13 +294,17 @@ bool lcd_blink() {
|
|||
else if (!keypad_debounce) {
|
||||
keypad_debounce = 2;
|
||||
|
||||
const bool homed = all_axes_homed();
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
if (RRK(EN_REPRAPWORLD_KEYPAD_MIDDLE)) lcd_goto_screen(menu_move);
|
||||
|
||||
#if DISABLED(DELTA) && Z_HOME_DIR == -1
|
||||
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
||||
#endif
|
||||
|
||||
if (all_axes_homed()) {
|
||||
if (homed) {
|
||||
#if ENABLED(DELTA) || Z_HOME_DIR != -1
|
||||
if (RRK(EN_REPRAPWORLD_KEYPAD_F2)) _reprapworld_keypad_move(Z_AXIS, 1);
|
||||
#endif
|
||||
|
@ -294,7 +314,10 @@ bool lcd_blink() {
|
|||
if (RRK(EN_REPRAPWORLD_KEYPAD_DOWN)) _reprapworld_keypad_move(Y_AXIS, 1);
|
||||
if (RRK(EN_REPRAPWORLD_KEYPAD_UP)) _reprapworld_keypad_move(Y_AXIS, -1);
|
||||
}
|
||||
else if (RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
if (!homed && RRK(EN_REPRAPWORLD_KEYPAD_F1)) enqueue_and_echo_commands_P(PSTR("G28"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,7 +410,10 @@ void lcd_status_screen() {
|
|||
return;
|
||||
}
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
|
||||
|
||||
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)) {
|
||||
|
@ -408,11 +434,10 @@ void lcd_status_screen() {
|
|||
feedrate_percentage = new_frm;
|
||||
encoderPosition = 0;
|
||||
}
|
||||
#endif // ULTIPANEL_FEEDMULTIPLY
|
||||
|
||||
feedrate_percentage = constrain(feedrate_percentage, 10, 999);
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
#endif // ULTIPANEL_FEEDMULTIPLY
|
||||
|
||||
#if LCD_INFO_SCREEN_STYLE == 0
|
||||
lcd_impl_status_screen_0();
|
||||
|
@ -594,6 +619,16 @@ LCDViewAction lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
|
|||
volatile uint8_t slow_buttons;
|
||||
#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() {
|
||||
|
||||
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
|
||||
#endif
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
#if HAS_ENCODER_ACTION
|
||||
|
||||
#if ENABLED(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;
|
||||
#endif
|
||||
}
|
||||
|
@ -710,9 +749,10 @@ void lcd_update() {
|
|||
const bool encoderPastThreshold = (ABS(encoderDiff) >= ENCODER_PULSES_PER_STEP);
|
||||
if (encoderPastThreshold || lcd_clicked) {
|
||||
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) {
|
||||
int32_t encoderMovementSteps = ABS(encoderDiff) / ENCODER_PULSES_PER_STEP;
|
||||
|
@ -737,18 +777,23 @@ void lcd_update() {
|
|||
|
||||
lastEncoderMovementMillis = ms;
|
||||
} // encoderRateMultiplierEnabled
|
||||
|
||||
#else
|
||||
|
||||
constexpr int32_t encoderMultiplier = 1;
|
||||
|
||||
#endif // ENCODER_RATE_MULTIPLIER
|
||||
|
||||
encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
|
||||
encoderDiff = 0;
|
||||
}
|
||||
#if LCD_TIMEOUT_TO_STATUS
|
||||
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
|
||||
return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS;
|
||||
#endif
|
||||
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
||||
}
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
#endif
|
||||
|
||||
// This runs every ~100ms when idling often enough.
|
||||
// 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
|
||||
|
||||
#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)
|
||||
void lcd_chirp() {
|
||||
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
|
|
|
@ -198,6 +198,12 @@
|
|||
inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
|
||||
#endif
|
||||
|
||||
#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
|
||||
|
||||
#if HAS_ENCODER_ACTION
|
||||
extern uint32_t encoderPosition;
|
||||
#endif
|
||||
|
||||
#if HAS_SPI_LCD
|
||||
|
||||
#include "../Marlin.h"
|
||||
|
@ -375,9 +381,9 @@
|
|||
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
#define HAS_DIGITAL_ENCODER (HAS_SPI_LCD && ENABLED(NEWPANEL))
|
||||
|
||||
#if HAS_DIGITAL_ENCODER
|
||||
#if HAS_DIGITAL_ENCODER
|
||||
|
||||
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
|
||||
#define BLEN_A 0
|
||||
|
@ -397,7 +403,9 @@
|
|||
#define LCD_BACK_CLICKED (buttons & EN_D)
|
||||
#endif
|
||||
|
||||
#endif // NEWPANEL
|
||||
#endif // HAS_DIGITAL_ENCODER
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
extern volatile uint8_t buttons; // The last-checked buttons in a bit array.
|
||||
void lcd_buttons_update();
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
//
|
||||
// LCD / Controller
|
||||
//
|
||||
#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
|
||||
#if ENABLED(ULTRA_LCD)
|
||||
|
||||
#if ENABLED(DOGLCD)
|
||||
|
||||
|
@ -217,9 +217,6 @@
|
|||
|
||||
#endif // !DOGLCD
|
||||
|
||||
#define BTN_EN1 11
|
||||
#define BTN_EN2 10
|
||||
|
||||
#if ENABLED(LCD_I2C_PANELOLU2)
|
||||
|
||||
#if ENABLED(IS_MELZI)
|
||||
|
@ -258,7 +255,6 @@
|
|||
#define LCD_PINS_D7 17
|
||||
#define ADC_KEYPAD_PIN 1
|
||||
|
||||
// Not used
|
||||
#define BTN_EN1 -1
|
||||
#define BTN_EN2 -1
|
||||
|
||||
|
@ -269,9 +265,14 @@
|
|||
|
||||
#endif
|
||||
|
||||
#if ENABLED(NEWPANEL) && !defined(BTN_EN1)
|
||||
#define BTN_EN1 11
|
||||
#define BTN_EN2 10
|
||||
#endif
|
||||
|
||||
#define SD_DETECT_PIN -1
|
||||
|
||||
#endif // ULTRA_LCD && NEWPANEL
|
||||
#endif // ULTRA_LCD
|
||||
|
||||
//
|
||||
// M3/M4/M5 - Spindle/Laser Control
|
||||
|
|
|
@ -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
|
||||
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"
|
||||
|
||||
# cleanup
|
||||
|
|
Loading…
Reference in a new issue