|
@ -49,7 +49,7 @@ |
|
|
|
|
|
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY) |
|
|
#if ENABLED(POWER_LOSS_RECOVERY) |
|
|
#include "../feature/power_loss_recovery.h" |
|
|
#include "../feature/power_loss_recovery.h" |
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
void menu_job_recovery(); |
|
|
void menu_job_recovery(); |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
@ -100,7 +100,7 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed |
|
|
millis_t previous_lcd_status_ms = 0; |
|
|
millis_t previous_lcd_status_ms = 0; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT) && ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) |
|
|
#if HAS_LCD_MENU && ENABLED(SDSUPPORT) && ENABLED(SCROLL_LONG_FILENAMES) |
|
|
uint8_t filename_scroll_pos, filename_scroll_max; |
|
|
uint8_t filename_scroll_pos, filename_scroll_max; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -122,8 +122,6 @@ millis_t next_button_update_ms; |
|
|
int8_t encoderDirection = 1; |
|
|
int8_t encoderDirection = 1; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
void lcd_status_screen(); |
|
|
|
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU |
|
|
#if HAS_LCD_MENU |
|
|
#include "menu/menu.h" |
|
|
#include "menu/menu.h" |
|
|
|
|
|
|
|
@ -202,7 +200,7 @@ void lcd_init() { |
|
|
|
|
|
|
|
|
lcd_buttons_update(); |
|
|
lcd_buttons_update(); |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
encoderDiff = 0; |
|
|
encoderDiff = 0; |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
@ -363,6 +361,14 @@ bool lcd_blink() { |
|
|
* This is very display-dependent, so the lcd implementation draws this. |
|
|
* This is very display-dependent, so the lcd implementation draws this. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(LCD_PROGRESS_BAR) |
|
|
|
|
|
millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle
|
|
|
|
|
|
#if PROGRESS_MSG_EXPIRE > 0 |
|
|
|
|
|
static millis_t expire_status_ms = 0; |
|
|
|
|
|
void dontExpireStatus() { expire_status_ms = 0; } |
|
|
|
|
|
#endif |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#if LCD_INFO_SCREEN_STYLE == 0 |
|
|
#if LCD_INFO_SCREEN_STYLE == 0 |
|
|
void lcd_impl_status_screen_0(); |
|
|
void lcd_impl_status_screen_0(); |
|
|
#elif LCD_INFO_SCREEN_STYLE == 1 |
|
|
#elif LCD_INFO_SCREEN_STYLE == 1 |
|
@ -371,12 +377,12 @@ bool lcd_blink() { |
|
|
|
|
|
|
|
|
void lcd_status_screen() { |
|
|
void lcd_status_screen() { |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
ENCODER_DIRECTION_NORMAL(); |
|
|
ENCODER_DIRECTION_NORMAL(); |
|
|
ENCODER_RATE_MULTIPLY(false); |
|
|
ENCODER_RATE_MULTIPLY(false); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD)) |
|
|
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || HAS_GRAPHICAL_LCD) |
|
|
// Progress bar % comes from SD when actively printing
|
|
|
// Progress bar % comes from SD when actively printing
|
|
|
if (IS_SD_PRINTING()) |
|
|
if (IS_SD_PRINTING()) |
|
|
progress_bar_percent = card.percentDone(); |
|
|
progress_bar_percent = card.percentDone(); |
|
@ -425,18 +431,14 @@ void lcd_status_screen() { |
|
|
|
|
|
|
|
|
#endif // LCD_PROGRESS_BAR
|
|
|
#endif // LCD_PROGRESS_BAR
|
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
|
|
|
|
|
|
if (use_click()) { |
|
|
if (use_click()) { |
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) |
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) |
|
|
previous_lcd_status_ms = millis(); // get status message to show up for a while
|
|
|
previous_lcd_status_ms = millis(); // get status message to show up for a while
|
|
|
#endif |
|
|
#endif |
|
|
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
|
|
|
|
|
#if ENABLED(LCD_PROGRESS_BAR) |
|
|
|
|
|
CHARSET_MENU |
|
|
|
|
|
#endif |
|
|
|
|
|
); |
|
|
|
|
|
lcd_goto_screen(menu_main); |
|
|
lcd_goto_screen(menu_main); |
|
|
|
|
|
lcd_implementation_init(); // May revive the LCD if static electricity killed it
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -465,7 +467,7 @@ void lcd_status_screen() { |
|
|
|
|
|
|
|
|
feedrate_percentage = constrain(feedrate_percentage, 10, 999); |
|
|
feedrate_percentage = constrain(feedrate_percentage, 10, 999); |
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
#if LCD_INFO_SCREEN_STYLE == 0 |
|
|
#if LCD_INFO_SCREEN_STYLE == 0 |
|
|
lcd_impl_status_screen_0(); |
|
|
lcd_impl_status_screen_0(); |
|
@ -514,7 +516,7 @@ void kill_screen(PGM_P lcd_msg) { |
|
|
|
|
|
|
|
|
void lcd_quick_feedback(const bool clear_buttons) { |
|
|
void lcd_quick_feedback(const bool clear_buttons) { |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
lcd_refresh(); |
|
|
lcd_refresh(); |
|
|
if (clear_buttons) buttons = 0; |
|
|
if (clear_buttons) buttons = 0; |
|
|
next_button_update_ms = millis() + 500; |
|
|
next_button_update_ms = millis() + 500; |
|
@ -525,7 +527,7 @@ void lcd_quick_feedback(const bool clear_buttons) { |
|
|
// Buzz and wait. The delay is needed for buttons to settle!
|
|
|
// Buzz and wait. The delay is needed for buttons to settle!
|
|
|
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); |
|
|
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
#if ENABLED(LCD_USE_I2C_BUZZER) |
|
|
#if ENABLED(LCD_USE_I2C_BUZZER) |
|
|
delay(10); |
|
|
delay(10); |
|
|
#elif PIN_EXISTS(BEEPER) |
|
|
#elif PIN_EXISTS(BEEPER) |
|
@ -534,7 +536,7 @@ void lcd_quick_feedback(const bool clear_buttons) { |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
|
|
|
|
|
|
extern bool no_reentry; // Flag to prevent recursion into menu handlers
|
|
|
extern bool no_reentry; // Flag to prevent recursion into menu handlers
|
|
|
|
|
|
|
|
@ -602,7 +604,7 @@ void lcd_quick_feedback(const bool clear_buttons) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Update the LCD, read encoder buttons, etc. |
|
|
* Update the LCD, read encoder buttons, etc. |
|
@ -652,7 +654,7 @@ void lcd_update() { |
|
|
static uint16_t max_display_update_time = 0; |
|
|
static uint16_t max_display_update_time = 0; |
|
|
static millis_t next_lcd_update_ms; |
|
|
static millis_t next_lcd_update_ms; |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
static millis_t return_to_status_ms = 0; |
|
|
static millis_t return_to_status_ms = 0; |
|
|
|
|
|
|
|
|
// Handle any queued Move Axis motion
|
|
|
// Handle any queued Move Axis motion
|
|
@ -688,7 +690,7 @@ void lcd_update() { |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) |
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) |
|
|
|
|
|
|
|
@ -712,11 +714,7 @@ void lcd_update() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
lcd_refresh(); |
|
|
lcd_refresh(); |
|
|
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
|
|
lcd_implementation_init(); // May revive the LCD if static electricity killed it
|
|
|
#if ENABLED(LCD_PROGRESS_BAR) |
|
|
|
|
|
currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU |
|
|
|
|
|
#endif |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // SDSUPPORT && SD_DETECT_PIN
|
|
|
#endif // SDSUPPORT && SD_DETECT_PIN
|
|
@ -730,7 +728,7 @@ void lcd_update() { |
|
|
|
|
|
|
|
|
const millis_t ms = millis(); |
|
|
const millis_t ms = millis(); |
|
|
if (ELAPSED(ms, next_lcd_update_ms) |
|
|
if (ELAPSED(ms, next_lcd_update_ms) |
|
|
#if ENABLED(DOGLCD) |
|
|
#if HAS_GRAPHICAL_LCD |
|
|
|| drawing_screen |
|
|
|| drawing_screen |
|
|
#endif |
|
|
#endif |
|
|
) { |
|
|
) { |
|
@ -741,7 +739,7 @@ void lcd_update() { |
|
|
lcd_implementation_update_indicators(); |
|
|
lcd_implementation_update_indicators(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
|
|
|
|
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS) |
|
|
#if ENABLED(LCD_HAS_SLOW_BUTTONS) |
|
|
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
|
|
@ -797,18 +795,18 @@ void lcd_update() { |
|
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; |
|
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
// 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.
|
|
|
if ( |
|
|
if ( |
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
currentScreen == lcd_status_screen && |
|
|
currentScreen == lcd_status_screen && |
|
|
#endif |
|
|
#endif |
|
|
!lcd_status_update_delay-- |
|
|
!lcd_status_update_delay-- |
|
|
) { |
|
|
) { |
|
|
lcd_status_update_delay = 9 |
|
|
lcd_status_update_delay = 9 |
|
|
#if ENABLED(DOGLCD) |
|
|
#if HAS_GRAPHICAL_LCD |
|
|
+ 3 |
|
|
+ 3 |
|
|
#endif |
|
|
#endif |
|
|
; |
|
|
; |
|
@ -816,7 +814,7 @@ void lcd_update() { |
|
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; |
|
|
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES) |
|
|
#if HAS_LCD_MENU && ENABLED(SCROLL_LONG_FILENAMES) |
|
|
// If scrolling of long file names is enabled and we are in the sd card menu,
|
|
|
// If scrolling of long file names is enabled and we are in the sd card menu,
|
|
|
// cause a refresh to occur until all the text has scrolled into view.
|
|
|
// cause a refresh to occur until all the text has scrolled into view.
|
|
|
if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { |
|
|
if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) { |
|
@ -830,7 +828,7 @@ void lcd_update() { |
|
|
// then we want to use 1/2 of the time only.
|
|
|
// then we want to use 1/2 of the time only.
|
|
|
uint16_t bbr2 = planner.block_buffer_runtime() >> 1; |
|
|
uint16_t bbr2 = planner.block_buffer_runtime() >> 1; |
|
|
|
|
|
|
|
|
#if ENABLED(DOGLCD) |
|
|
#if HAS_GRAPHICAL_LCD |
|
|
const bool &is_drawing = drawing_screen; |
|
|
const bool &is_drawing = drawing_screen; |
|
|
#else |
|
|
#else |
|
|
constexpr bool is_drawing = false; |
|
|
constexpr bool is_drawing = false; |
|
@ -855,15 +853,15 @@ void lcd_update() { |
|
|
buttons_reprapworld_keypad = 0; |
|
|
buttons_reprapworld_keypad = 0; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
#define CURRENTSCREEN() (*currentScreen)() |
|
|
#define CURRENTSCREEN() (*currentScreen)() |
|
|
#else |
|
|
#else |
|
|
#define CURRENTSCREEN() lcd_status_screen() |
|
|
#define CURRENTSCREEN() lcd_status_screen() |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(DOGLCD) |
|
|
#if HAS_GRAPHICAL_LCD |
|
|
#if ENABLED(LIGHTWEIGHT_UI) |
|
|
#if ENABLED(LIGHTWEIGHT_UI) |
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
const bool in_status = currentScreen == lcd_status_screen; |
|
|
const bool in_status = currentScreen == lcd_status_screen; |
|
|
#else |
|
|
#else |
|
|
constexpr bool in_status = true; |
|
|
constexpr bool in_status = true; |
|
@ -896,7 +894,7 @@ void lcd_update() { |
|
|
CURRENTSCREEN(); |
|
|
CURRENTSCREEN(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
lcd_clicked = false; |
|
|
lcd_clicked = false; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
@ -905,7 +903,7 @@ void lcd_update() { |
|
|
NOLESS(max_display_update_time, millis() - ms); |
|
|
NOLESS(max_display_update_time, millis() - ms); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
|
|
|
|
|
|
// Return to Status Screen after a timeout
|
|
|
// Return to Status Screen after a timeout
|
|
|
if (currentScreen == lcd_status_screen || defer_return_to_status) |
|
|
if (currentScreen == lcd_status_screen || defer_return_to_status) |
|
@ -913,7 +911,7 @@ void lcd_update() { |
|
|
else if (ELAPSED(ms, return_to_status_ms)) |
|
|
else if (ELAPSED(ms, return_to_status_ms)) |
|
|
lcd_return_to_status(); |
|
|
lcd_return_to_status(); |
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
// Change state of drawing flag between screen updates
|
|
|
// Change state of drawing flag between screen updates
|
|
|
if (!is_drawing) switch (lcdDrawUpdate) { |
|
|
if (!is_drawing) switch (lcdDrawUpdate) { |
|
@ -942,6 +940,7 @@ void lcd_finishstatus(const bool persist=false) { |
|
|
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; |
|
|
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
lcd_refresh(); |
|
|
lcd_refresh(); |
|
|
|
|
|
|
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) |
|
|
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) |
|
@ -953,10 +952,6 @@ void lcd_finishstatus(const bool persist=false) { |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 |
|
|
|
|
|
void dontExpireStatus() { expire_status_ms = 0; } |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } |
|
|
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } |
|
|
|
|
|
|
|
|
void lcd_setstatus(const char * const message, const bool persist) { |
|
|
void lcd_setstatus(const char * const message, const bool persist) { |
|
@ -1023,7 +1018,7 @@ void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) { |
|
|
|
|
|
|
|
|
void lcd_setalertstatusPGM(PGM_P const message) { |
|
|
void lcd_setalertstatusPGM(PGM_P const message) { |
|
|
lcd_setstatusPGM(message, 1); |
|
|
lcd_setstatusPGM(message, 1); |
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
lcd_return_to_status(); |
|
|
lcd_return_to_status(); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
@ -1068,7 +1063,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(ULTIPANEL) |
|
|
#if HAS_LCD_MENU |
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) |
|
|
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) |
|
@ -1252,6 +1247,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // ULTIPANEL
|
|
|
#endif // HAS_LCD_MENU
|
|
|
|
|
|
|
|
|
#endif // ULTRA_LCD
|
|
|
#endif // ULTRA_LCD
|
|
|