Lightweight status screen for ST7920
- This status screen uses the ST7920 character generator to greatly reduce SPI traffic and MCU load when updating the status screen. - Has been tested with the RepRapDiscount Full Graphics Smart Controller but should work with any LCD that uses an ST7920 or fully compatible controller.
This commit is contained in:
committed by
Scott Lahteine
parent
59c98d6fd5
commit
532bb3aaa1
@ -5141,20 +5141,34 @@ void lcd_update() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(DOGLCD)
|
||||
if (!drawing_screen) { // If not already drawing pages
|
||||
u8g.firstPage(); // Start the first page
|
||||
drawing_screen = 1; // Flag as drawing pages
|
||||
}
|
||||
lcd_setFont(FONT_MENU); // Setup font for every page draw
|
||||
u8g.setColorIndex(1); // And reset the color
|
||||
CURRENTSCREEN(); // Draw and process the current screen
|
||||
#if ENABLED(LIGHTWEIGHT_UI)
|
||||
#if ENABLED(ULTIPANEL)
|
||||
const bool in_status = currentScreen == lcd_status_screen;
|
||||
#else
|
||||
constexpr bool in_status = true;
|
||||
#endif
|
||||
const bool do_u8g_loop = !in_status;
|
||||
lcd_in_status(in_status);
|
||||
if (in_status) lcd_status_screen();
|
||||
#else
|
||||
constexpr bool do_u8g_loop = true;
|
||||
#endif
|
||||
if (do_u8g_loop) {
|
||||
if (!drawing_screen) { // If not already drawing pages
|
||||
u8g.firstPage(); // Start the first page
|
||||
drawing_screen = 1; // Flag as drawing pages
|
||||
}
|
||||
lcd_setFont(FONT_MENU); // Setup font for every page draw
|
||||
u8g.setColorIndex(1); // And reset the color
|
||||
CURRENTSCREEN(); // Draw and process the current screen
|
||||
|
||||
// The screen handler can clear drawing_screen for an action that changes the screen.
|
||||
// If still drawing and there's another page, update max-time and return now.
|
||||
// The nextPage will already be set up on the next call.
|
||||
if (drawing_screen && (drawing_screen = u8g.nextPage())) {
|
||||
NOLESS(max_display_update_time, millis() - ms);
|
||||
return;
|
||||
// The screen handler can clear drawing_screen for an action that changes the screen.
|
||||
// If still drawing and there's another page, update max-time and return now.
|
||||
// The nextPage will already be set up on the next call.
|
||||
if (drawing_screen && (drawing_screen = u8g.nextPage())) {
|
||||
NOLESS(max_display_update_time, millis() - ms);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
CURRENTSCREEN();
|
||||
|
Reference in New Issue
Block a user