From 4880ac653303829ca1f50a9fe61a1b20688a3c8e Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 14 Feb 2018 14:43:54 -0700 Subject: [PATCH] Added a light-weight status screen for the ST7920 - The 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. --- Marlin/Configuration.h | 11 +++++ Marlin/src/config/default/Configuration.h | 11 +++++ .../AliExpress/CL-260/Configuration.h | 11 +++++ .../config/examples/Anet/A6/Configuration.h | 11 ++++- .../config/examples/Anet/A8/Configuration.h | 13 ++++++ .../BIBO/TouchX/cyclops/Configuration.h | 11 +++++ .../BIBO/TouchX/default/Configuration.h | 11 +++++ .../FolgerTech/i3-2020/Configuration.h | 11 +++++ .../examples/Infitary/i3-M508/Configuration.h | 11 +++++ .../examples/JGAurora/A5/Configuration.h | 11 +++++ .../config/examples/RigidBot/Configuration.h | 12 +++++ .../config/examples/STM32F10/Configuration.h | 11 +++++ .../examples/Sanguinololu/Configuration.h | 11 +++++ .../config/examples/Tronxy/X1/Configuration.h | 11 +++++ .../examples/Tronxy/X5S/Configuration.h | 11 +++++ .../examples/Velleman/K8200/Configuration.h | 11 +++++ .../examples/Velleman/K8400/Configuration.h | 11 +++++ .../Velleman/K8400/Dual-head/Configuration.h | 11 +++++ .../delta/kossel_mini/Configuration.h | 11 +++++ .../examples/gCreate/gMax1.5+/Configuration.h | 11 +++++ .../config/examples/makibox/Configuration.h | 11 +++++ .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 16 +++++-- Marlin/src/lcd/ultralcd.cpp | 44 +++++++++++++------ Marlin/src/lcd/ultralcd_impl_DOGM.h | 10 +++++ 24 files changed, 287 insertions(+), 17 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index b3b8dc1c99..1438b8e334 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1510,7 +1510,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index b3b8dc1c99..1438b8e334 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -1510,7 +1510,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index 56745f364a..01fed3c30c 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -1510,7 +1510,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index b23194476c..aa04b092c6 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -1658,9 +1658,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // -// Note: Details on connecting to the Anet V1.0 controller are in the file pins_ANET_10.h +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. // +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index fbd79e19fc..98a240dbe3 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -1513,6 +1513,7 @@ // //#define G3D_PANEL + // // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller @@ -1521,6 +1522,18 @@ // //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 + // // MakerLab Mini Panel with graphic // controller and SD support - http://reprap.org/wiki/Mini_panel diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h index 90e3349ca7..5ea66f89ed 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -1510,7 +1510,18 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h index 3681bd44ff..43d9e7bc63 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -1510,7 +1510,18 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index bc57446780..e72a6c0675 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -1516,7 +1516,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h index 01d7b036d9..1ef84d79dd 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -1514,7 +1514,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/Marlin/src/config/examples/JGAurora/A5/Configuration.h index ee582782a3..d784398176 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h @@ -1521,7 +1521,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index be5ef3e98f..aa31545daf 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -1512,6 +1512,18 @@ // //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 + // // MakerLab Mini Panel with graphic // controller and SD support - http://reprap.org/wiki/Mini_panel diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/Marlin/src/config/examples/STM32F10/Configuration.h index 2d4a43f465..774ded73fb 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/Configuration.h @@ -1513,7 +1513,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h index 73fae70b02..207fcc01bd 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -1541,7 +1541,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/Marlin/src/config/examples/Tronxy/X1/Configuration.h index 982bd2ff90..687448b583 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -1495,7 +1495,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h index c97b346efb..53ba5efb2f 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h @@ -1510,7 +1510,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index 463c8dba33..dad7750d41 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -1543,7 +1543,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h index 3f0ca51503..1747b6ec7b 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -1510,7 +1510,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h index 7dbe74aa47..667550beb8 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -1504,7 +1504,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index 324739d6fb..84079e7370 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -1634,7 +1634,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h index 6f8e1ec4f9..e7ab09e736 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -1524,7 +1524,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h index 232bc3f55f..b0d0c5d506 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -1513,7 +1513,18 @@ // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // +// If USE_ST7920_LIGHTWEIGHT_UI is uncommented, then an alternative +// light-weight status screen will be used that takes advantage of +// the ST7920 character-generator to conserve MCU resources. +// +// Since the lightweight status screen can only show a status +// message or the position, but not both, set DELAY_TO_SHOW_POSITION +// to the number of seconds until the position is revealed after a new +// status message is drawn. + //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define USE_ST7920_LIGHTWEIGHT_UI +//#define DELAY_TO_SHOW_POSITION 20 // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp index bdab2efa8c..34b3a7431a 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -119,10 +119,12 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ST7920_CS(); u8g_Delay(120); //initial delay for boot up ST7920_SET_CMD(); + ST7920_WRITE_NIBBLES(0x20); //non-extended mode ST7920_WRITE_NIBBLES(0x08); //display off, cursor+blink off - ST7920_WRITE_NIBBLES(0x01); //clear CGRAM ram - u8g_Delay(15); //delay for CGRAM clear - ST7920_WRITE_NIBBLES(0x3E); //extended mode + GDRAM active + ST7920_WRITE_NIBBLES(0x01); //clear DDRAM ram + u8g_Delay(15); //delay for DDRAM clear + ST7920_WRITE_NIBBLES(0x24); //extended mode + ST7920_WRITE_NIBBLES(0x26); //extended mode + GDRAM active for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM ST7920_WRITE_NIBBLES(0x80 | y); //set y ST7920_WRITE_NIBBLES(0x80); //set x = 0 @@ -178,6 +180,14 @@ uint8_t u8g_dev_st7920_128x64_rrd_buf[(LCD_PIXEL_WIDTH) * (PAGE_HEIGHT) / 8] U u8g_pb_t u8g_dev_st7920_128x64_rrd_pb = {{PAGE_HEIGHT, LCD_PIXEL_HEIGHT, 0, 0, 0}, LCD_PIXEL_WIDTH, u8g_dev_st7920_128x64_rrd_buf}; u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g_dev_st7920_128x64_rrd_pb, &u8g_com_null_fn}; +#if ENABLED(USE_ST7920_LIGHTWEIGHT_UI) + typedef const __FlashStringHelper *progmem_str; + + // We have to include the code for the lightweight UI here + // as it relies on macros that are only defined in this file. + #include "ultralcd_impl_st7920_lite_status_screen_impl_spi.h" +#endif + #pragma GCC reset_options #endif // U8G_HAL_LINKS diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index fb85089a32..0a0671cc73 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -5113,20 +5113,38 @@ 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 defined(USE_ST7920_LIGHTWEIGHT_UI) + #if ENABLED(ULTIPANEL) + bool do_U8G_loop = true; + lcd_in_status(currentScreen == lcd_status_screen); + if(currentScreen == lcd_status_screen) { + lcd_status_screen(); + do_U8G_loop = false; + } + #else + const bool do_U8G_loop = false; + lcd_in_status(true); + lcd_status_screen(); + #endif + #else + const 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(); diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h index 6bf80c6191..09ff1a2b32 100644 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ b/Marlin/src/lcd/ultralcd_impl_DOGM.h @@ -54,6 +54,11 @@ #include "dogm/dogm_bitmaps.h" +#if ENABLED(USE_ST7920_LIGHTWEIGHT_UI) + typedef const __FlashStringHelper *progmem_str; + #include "dogm/ultralcd_impl_st7920_lite_status_screen_impl.h" +#endif + #if ENABLED(SDSUPPORT) #include "../libs/duration_t.h" #endif @@ -373,6 +378,9 @@ static void lcd_implementation_init() { // The kill screen is displayed for unrecoverable conditions void lcd_kill_screen() { + #if ENABLED(USE_ST7920_LIGHTWEIGHT_UI) + ST7920_Lite_Status_Screen::clear_text_buffer(); + #endif const uint8_t h4 = u8g.getHeight() / 4; u8g.firstPage(); do { @@ -498,6 +506,7 @@ inline void lcd_implementation_status_message(const bool blink) { #endif } +#if !ENABLED(USE_ST7920_LIGHTWEIGHT_UI) static void lcd_implementation_status_screen() { const bool blink = lcd_blink(); @@ -803,6 +812,7 @@ static void lcd_implementation_status_screen() { #endif } } +#endif #if ENABLED(ULTIPANEL)