@ -64,6 +64,8 @@ void lcd_status_screen();
millis_t next_lcd_update_ms ;
millis_t next_lcd_update_ms ;
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
millis_t max_display_update_time = 0 ;
# if ENABLED(DOGLCD)
# if ENABLED(DOGLCD)
bool drawing_screen = false ;
bool drawing_screen = false ;
# endif
# endif
@ -2893,7 +2895,11 @@ void lcd_update() {
# endif //SDSUPPORT && SD_DETECT_PIN
# endif //SDSUPPORT && SD_DETECT_PIN
millis_t ms = millis ( ) ;
millis_t ms = millis ( ) ;
if ( ELAPSED ( ms , next_lcd_update_ms ) ) {
if ( ELAPSED ( ms , next_lcd_update_ms )
# if ENABLED(DOGLCD)
| | drawing_screen
# endif
) {
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL ;
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL ;
@ -2954,36 +2960,30 @@ void lcd_update() {
}
}
# endif // ULTIPANEL
# endif // ULTIPANEL
# if ENABLED(ENSURE_SMOOTH_MOVES) && ENABLED(ALWAYS_ALLOW_MENU)
# define STATUS_UPDATE_CONDITION planner.long_move()
# else
# define STATUS_UPDATE_CONDITION true
# endif
# if ENABLED(ENSURE_SMOOTH_MOVES) && DISABLED(ALWAYS_ALLOW_MENU)
# define LCD_HANDLER_CONDITION planner.long_move()
# else
# define LCD_HANDLER_CONDITION true
# endif
// We arrive here every ~100ms when idling often enough.
// We arrive here every ~100ms when idling often enough.
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
static int8_t lcd_status_update_delay = 1 ; // first update one loop delayed
static int8_t lcd_status_update_delay = 1 ; // first update one loop delayed
if ( STATUS_UPDATE_CONDITION & &
if (
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)
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)
+ 3
# endif
;
max_display_update_time - - ;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW ;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW ;
}
}
if ( LCD_HANDLER_CONDITION ) {
millis_t bbr = planner . block_buffer_runtime ( ) ;
# if ENABLED(DOGLCD)
# if ENABLED(DOGLCD)
if ( lcdDrawUpdate | | drawing_screen )
if ( ( lcdDrawUpdate | | drawing_screen ) & & ( ! bbr | | ( bbr > max_display_update_time * 2000 ) ) )
# else
# else
if ( lcdDrawUpdate )
if ( lcdDrawUpdate & & ( ! bbr | | ( bbr > max_display_update_time * 2000 ) ) )
# endif
# endif
{
{
# if ENABLED(DOGLCD)
# if ENABLED(DOGLCD)
@ -3015,10 +3015,14 @@ void lcd_update() {
}
}
lcd_setFont ( FONT_MENU ) ;
lcd_setFont ( FONT_MENU ) ;
CURRENTSCREEN ( ) ;
CURRENTSCREEN ( ) ;
if ( drawing_screen & & ( drawing_screen = u8g . nextPage ( ) ) ) return ;
if ( drawing_screen & & ( drawing_screen = u8g . nextPage ( ) ) ) {
max_display_update_time = max ( max_display_update_time , millis ( ) - ms ) ;
return ;
}
# else
# else
CURRENTSCREEN ( ) ;
CURRENTSCREEN ( ) ;
# endif
# endif
max_display_update_time = max ( max_display_update_time , millis ( ) - ms ) ;
}
}
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)
@ -3048,7 +3052,6 @@ void lcd_update() {
break ;
break ;
} // switch
} // switch
}
}
} // LCD_HANDLER_CONDITION
} // ELAPSED(ms, next_lcd_update_ms)
} // ELAPSED(ms, next_lcd_update_ms)
}
}