@ -622,7 +622,7 @@ void ST7920_Lite_Status_Screen::draw_status_message(const char *str) {
// Trim whitespace at the end of the str, as for some reason
// Trim whitespace at the end of the str, as for some reason
// messages like "Card Inserted" are padded with many spaces
// messages like "Card Inserted" are padded with many spaces
while ( str_len > 0 & & str [ str_len - 1 ] = = ' ' ) str_len - - ;
while ( str_len & & str [ str_len - 1 ] = = ' ' ) str_len - - ;
if ( str_len < = lcd_len ) {
if ( str_len < = lcd_len ) {
// It all fits on the LCD without scrolling
// It all fits on the LCD without scrolling
@ -765,8 +765,15 @@ bool ST7920_Lite_Status_Screen::blink_changed() {
return true ;
return true ;
}
}
# ifndef STATUS_EXPIRE_SECONDS
# define STATUS_EXPIRE_SECONDS 20
# endif
void ST7920_Lite_Status_Screen : : update_status_or_position ( bool forceUpdate ) {
void ST7920_Lite_Status_Screen : : update_status_or_position ( bool forceUpdate ) {
# if STATUS_EXPIRE_SECONDS
static uint8_t countdown = 0 ;
static uint8_t countdown = 0 ;
# endif
/**
/**
* There is only enough room in the display for either the
* There is only enough room in the display for either the
@ -779,18 +786,26 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) {
* countdown > 1 - - Show status
* countdown > 1 - - Show status
* countdown = 1 - - Show status , until movement
* countdown = 1 - - Show status , until movement
* countdown = 0 - - Show position
* countdown = 0 - - Show position
*
* If STATUS_EXPIRE_SECONDS is zero , the position display
* will be disabled and only the status will be shown .
*/
*/
if ( forceUpdate | | status_changed ( ) ) {
if ( forceUpdate | | status_changed ( ) ) {
# if ENABLED(STATUS_MESSAGE_SCROLLING)
# if ENABLED(STATUS_MESSAGE_SCROLLING)
status_scroll_pos = 0 ;
status_scroll_pos = 0 ;
# endif
# endif
# ifndef STATUS_EXPIRE_SECONDS
# if STATUS_EXPIRE_SECONDS
# define STATUS_EXPIRE_SECONDS 20
countdown = lcd_status_message [ 0 ] ? STATUS_EXPIRE_SECONDS : 0 ;
# endif
# endif
countdown = lcd_strlen ( lcd_status_message ) ? STATUS_EXPIRE_SECONDS : 0 ;
draw_status_message ( lcd_status_message ) ;
draw_status_message ( lcd_status_message ) ;
blink_changed ( ) ; // Clear changed flag
blink_changed ( ) ; // Clear changed flag
}
}
# if !STATUS_EXPIRE_SECONDS
# if ENABLED(STATUS_MESSAGE_SCROLLING)
else
draw_status_message ( lcd_status_message ) ;
# endif
# else
else if ( countdown > 1 & & blink_changed ( ) ) {
else if ( countdown > 1 & & blink_changed ( ) ) {
countdown - - ;
countdown - - ;
# if ENABLED(STATUS_MESSAGE_SCROLLING)
# if ENABLED(STATUS_MESSAGE_SCROLLING)
@ -824,6 +839,7 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) {
# endif
# endif
) ;
) ;
}
}
# endif
}
}
void ST7920_Lite_Status_Screen : : update_progress ( const bool forceUpdate ) {
void ST7920_Lite_Status_Screen : : update_progress ( const bool forceUpdate ) {