From 4880ac653303829ca1f50a9fe61a1b20688a3c8e Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 14 Feb 2018 14:43:54 -0700 Subject: [PATCH 01/12] 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 b3b8dc1c9..1438b8e33 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 b3b8dc1c9..1438b8e33 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 56745f364..01fed3c30 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 b23194476..aa04b092c 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 fbd79e19f..98a240dbe 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 90e3349ca..5ea66f89e 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 3681bd44f..43d9e7bc6 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 bc5744678..e72a6c067 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 01d7b036d..1ef84d79d 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 ee582782a..d78439817 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 be5ef3e98..aa31545da 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 2d4a43f46..774ded73f 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 73fae70b0..207fcc01b 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 982bd2ff9..687448b58 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 c97b346ef..53ba5efb2 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 463c8dba3..dad7750d4 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 3f0ca5150..1747b6ec7 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 7dbe74aa4..667550beb 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 324739d6f..84079e737 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 6f8e1ec4f..e7ab09e73 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 232bc3f55..b0d0c5d50 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 bdab2efa8..34b3a7431 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 fb85089a3..0a0671cc7 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 6bf80c619..09ff1a2b3 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) From f05bd7f0829d412c5cd97e10feda985c26cdb8ac Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 14 Feb 2018 14:51:35 -0700 Subject: [PATCH 02/12] Added files missing from earlier commit. --- .../ultralcd_impl_st7920_lite_status_screen.h | 247 ++++++ ...alcd_impl_st7920_lite_status_screen_impl.h | 757 ++++++++++++++++++ ..._impl_st7920_lite_status_screen_impl_spi.h | 39 + 3 files changed, 1043 insertions(+) create mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h create mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h create mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h new file mode 100644 index 000000000..19c356426 --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h @@ -0,0 +1,247 @@ +/* + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#ifndef ULTRALCD_ST7920_LITE_STATUS_H +#define ULTRALCD_ST7920_LITE_STATUS_H + +class ST7920_Lite_Status_Screen { + private: + static struct st7920_state_t { + uint8_t synced : 1; // Whether a sync has been sent + uint8_t cmd : 1; // Whether the sync was cmd or data + uint8_t extended : 1; + uint8_t graphics : 1; + uint8_t sa : 1; + } current_bits; + + static void cs(); + static void ncs(); + static void sync_cmd(); + static void sync_dat(); + static void write_byte(uint8_t w); + + static void cmd(uint8_t cmd); + static void begin_data(); + static void write_word(uint16_t w); + static void write_str(const char *str); + static void write_str(const char *str, uint8_t len); + static void write_str_P(const char *str); + static void write_str(progmem_str str); + static void write_number(uint8_t value, uint8_t digits=3); + + static void _extended_function_set(bool extended, bool graphics); + static void _scroll_or_addr_select(bool sa); + static void reset_state_from_unknown(); + + static void home(); + static void display_status(bool display_on, bool cursor_on, bool blink_on); + static void extended_function_set(bool extended); + static void graphics(bool graphics); + static void entry_mode_select(bool ac_increase, bool shift); + static void scroll_or_addr_select(bool sa); + static void set_ddram_address(uint8_t addr); + static void set_cgram_address(uint8_t addr); + static void set_gdram_address(uint8_t x, uint8_t y); + + static void clear(); + static void clear_ddram(); + static void clear_gdram(); + + static void load_cgram_icon(uint16_t addr, const void *data); + static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); + + static uint8_t string_checksum(const char *str); + + protected: + static void draw_static_elements(); + static void draw_progress_bar(uint8_t value); + static void draw_fan_icon(bool whichIcon); + static void draw_heat_icon(bool whichIcon, bool heating); + static void draw_extruder_1_temp(uint8_t temp, uint8_t target); + static void draw_extruder_2_temp(uint8_t temp, uint8_t target); + static void draw_bed_temp(uint8_t temp, uint8_t target); + static void draw_fan_speed(uint8_t value); + static void draw_print_time(uint32_t elapsed); + static void draw_feedrate_percentage(uint8_t percentage); + static void draw_status_message(const unsigned char *str); + static void draw_position(const float x, const float y, const float z, bool position_known = true); + + static bool indicators_changed(); + static bool position_changed(); + static bool blink_changed(); + static bool status_changed(); + + static void update_indicators(bool forceUpdate); + static void update_position(bool forceUpdate, bool resetChecksum); + static void update_status_or_position(bool forceUpdate); + static void update_progress(bool forceUpdate); + + public: + static void update(bool forceUpdate); + static void on_entry(); + static void on_exit(); + static void clear_text_buffer(); +}; + +/************************** ICON DEFINITIONS *************************************/ + +#define CGRAM_ICON_1_ADDR 0x00 +#define CGRAM_ICON_2_ADDR 0x10 +#define CGRAM_ICON_3_ADDR 0x20 +#define CGRAM_ICON_4_ADDR 0x30 + +#define CGRAM_ICON_1_WORD 0x00 +#define CGRAM_ICON_2_WORD 0x02 +#define CGRAM_ICON_3_WORD 0x04 +#define CGRAM_ICON_4_WORD 0x06 + +PROGMEM const uint16_t nozzle_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000111111110000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000011111100000, + 0b0000001111000000, + 0b0000000110000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t bed_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0111111111111110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t heat1_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t heat2_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t fan1_icon[] = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110001111000110, + 0b0100001111000010, + 0b0100000110000010, + 0b0101100000011010, + 0b0101110110111010, + 0b0101100000011010, + 0b0100000110000010, + 0b0100001111000010, + 0b0110001111000110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t fan2_icon[] = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110010000100110, + 0b0100111001110010, + 0b0101111001111010, + 0b0100110000110010, + 0b0100000110000010, + 0b0100110000110010, + 0b0101111001111010, + 0b0100111001110010, + 0b0110010000100110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t feedrate_icon[] = { + 0b0000000000000000, + 0b0111111000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0111111011111000, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000011111000, + 0b0000000010001000, + 0b0000000010000100, + 0b0000000010000100, + 0b0000000010000010, + 0b0000000000000000, + 0b0000000000000000 +}; + +static void lcd_implementation_status_screen(); +static void lcd_in_status(bool inStatus); + +#endif // ULTRALCD_ST7920_LITE_STATUS_H \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h new file mode 100644 index 000000000..3a90ee183 --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h @@ -0,0 +1,757 @@ +/* + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + + /* This is an implementation of a status screen for the RepRapDiscount + * Full Graphics Smart Controller using native ST7920 commands rather + * than using U8Glib. + * + * This alternative status screen makes use of the built-in character + * generation capabilities of the ST7920 to update the status screen + * with less SPI traffic and CPU use. In particular: + * + * - The fan and bed animations are handled using custom characters + * that are stored in CGRAM. This allows for the animation to be + * updated by writing a single character to the text-buffer (DDRAM). + * + * - All the information in the status screen is text that is written + * to DDRAM, so the work of generating the bitmaps is offloaded to + * the ST7920 rather than being render by U8Glib on the MCU. + * + * - The graphics buffer (GDRAM) is only used for static graphics + * elements (nozzle and feedrate bitmaps) and for the progress + * bar, so updates are sporadic. + */ + +#include "../../libs/duration_t.h" + +typedef const __FlashStringHelper *progmem_str; + +#include "ultralcd_impl_st7920_lite_status_screen.h" + +#define BUFFER_WIDTH 256 +#define BUFFER_HEIGHT 32 + +#define DDRAM_LINE_1 0x00 +#define DDRAM_LINE_2 0x10 +#define DDRAM_LINE_3 0x08 +#define DDRAM_LINE_4 0x18 + +ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; + +void ST7920_Lite_Status_Screen::cmd(uint8_t cmd) { + if(!current_bits.synced || !current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = true; + sync_cmd(); + } + write_byte(cmd); +} + +void ST7920_Lite_Status_Screen::begin_data() { + extended_function_set(false); + if(!current_bits.synced || current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = false; + sync_dat(); + } +} + +void ST7920_Lite_Status_Screen::write_word(uint16_t w) { + write_byte((w >> 8) & 0xFF); + write_byte((w >> 0) & 0xFF); +} + +void ST7920_Lite_Status_Screen::write_str(const char *str) { + while(*str) { + write_byte(*str++); + } +} + +void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { + while(*str && len--) { + write_byte(*str++); + } +} + +void ST7920_Lite_Status_Screen::write_str_P(const char *str) { + const char *p_str = (const char *)str; + char c = pgm_read_byte_near(p_str++); + while(c) { + write_byte(c); + c = pgm_read_byte_near(p_str++); + } +} + +void ST7920_Lite_Status_Screen::write_str(progmem_str str) { + write_str_P((const char*)str); +} + +void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits=3) { + char str[7]; + const char *fmt; + switch(digits) { + case 6: fmt = PSTR("%6d"); break; + case 5: fmt = PSTR("%5d"); break; + case 4: fmt = PSTR("%4d"); break; + case 3: fmt = PSTR("%3d"); break; + case 2: fmt = PSTR("%2d"); break; + case 1: fmt = PSTR("%1d"); break; + } + sprintf_P(str,fmt,value); + write_str(str); +} + +void ST7920_Lite_Status_Screen::display_status(bool display_on, bool cursor_on, bool blink_on) { + extended_function_set(false); + cmd(0b00001000 | + (display_on ? 0b0100 : 0) | + (cursor_on ? 0b0010 : 0) | + (blink_on ? 0b0001 : 0) + ); +} + +// Sets the extended and graphics bits simultaneously, regardless of +// the current state. This is a helper function for extended_function_set() +// and graphics() +void ST7920_Lite_Status_Screen::_extended_function_set(bool extended, bool graphics) { + cmd( 0b00100000 | + (extended ? 0b00000100 : 0) | + (graphics ? 0b00000010 : 0) + ); + current_bits.extended = extended; + current_bits.graphics = graphics; +} + +void ST7920_Lite_Status_Screen::extended_function_set(bool extended) { + if(extended != current_bits.extended) { + _extended_function_set(extended, current_bits.graphics); + } +} + +void ST7920_Lite_Status_Screen::graphics(bool graphics) { + if(graphics != current_bits.graphics) { + _extended_function_set(current_bits.extended, graphics); + } +} + +void ST7920_Lite_Status_Screen::entry_mode_select(bool ac_increase, bool shift) { + extended_function_set(false); + cmd(0b00000100 | + (ac_increase ? 0b00000010 : 0) | + (shift ? 0b00000001 : 0) + ); +} + +// Sets the sa bit regardless of the current state. This is a helper +// function for scroll_or_addr_select() +void ST7920_Lite_Status_Screen::_scroll_or_addr_select(bool sa) { + extended_function_set(true); + cmd(0b00100010 | + (sa ? 0b000001 : 0) + ); + current_bits.sa = sa; +} + +void ST7920_Lite_Status_Screen::scroll_or_addr_select(bool sa) { + if(sa != current_bits.sa) { + _scroll_or_addr_select(sa); + } +} + +void ST7920_Lite_Status_Screen::set_ddram_address(uint8_t addr) { + extended_function_set(false); + cmd(0b10000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_cgram_address(uint8_t addr) { + extended_function_set(false); + cmd(0b01000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_gdram_address(uint8_t x, uint8_t y) { + extended_function_set(true); + cmd(0b10000000 | (y & 0b01111111)); + cmd(0b10000000 | (x & 0b00001111)); +} + +void ST7920_Lite_Status_Screen::clear() { + extended_function_set(false); + cmd(0x00000001); + delay(15); //delay for CGRAM clear +} + +void ST7920_Lite_Status_Screen::home() { + extended_function_set(false); + cmd(0x00000010); +} + +/* This fills the entire text buffer with spaces */ +void ST7920_Lite_Status_Screen::clear_ddram() +{ + set_ddram_address(DDRAM_LINE_1); + begin_data(); + for(int i=0; i < 64;i++) { + write_byte(' '); + } +} + +/* This fills the entire graphics buffer with zeros */ +void ST7920_Lite_Status_Screen::clear_gdram() +{ + for(int y = 0; y < BUFFER_HEIGHT; y++) { + set_gdram_address(0,y); + begin_data(); + for(int i = 0; i < (BUFFER_WIDTH / 16); i++) { + write_byte(0); + write_byte(0); + } + } +} + +void ST7920_Lite_Status_Screen::load_cgram_icon(uint16_t addr, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + set_cgram_address(addr); + begin_data(); + for(int i = 0; i < 16; i++) { + uint16_t word = pgm_read_word_near(p_word++); + write_byte((word & 0xFF00) >> 8); + write_byte((word & 0x00FF) >> 0); + } +} + +/* Draws an icon in GDRAM. The position is specified in + as if they were DDRAM coordinates, i.e. the x position + is [1-8], while the y position is [1-4] */ +void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + if(y > 2) { + // Handle display folding + y -= 2; + x += 8; + } + x -= 1; + y -= 1; + for(int i = 0; i < 16; i++) { + uint16_t word = pgm_read_word_near(p_word++); + set_gdram_address(x,i+y*16); + begin_data(); + write_byte((word & 0xFF00) >> 8); + write_byte((word & 0x00FF) >> 0); + } +} + +/************************** MAIN SCREEN *************************************/ + +void ST7920_Lite_Status_Screen::draw_static_elements() { + scroll_or_addr_select(0); + + // Load the animated bed and fan icons + load_cgram_icon(CGRAM_ICON_1_ADDR, heat1_icon); + load_cgram_icon(CGRAM_ICON_2_ADDR, heat2_icon); + load_cgram_icon(CGRAM_ICON_3_ADDR, fan1_icon); + load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); + + // Draw the static icons in GDRAM + draw_gdram_icon(1,1,nozzle_icon); + #if EXTRUDERS == 2 + draw_gdram_icon(1,2,nozzle_icon); + #endif + draw_gdram_icon(6,2,feedrate_icon); + draw_gdram_icon(1,2,bed_icon); + + // Draw the initial fan icon + draw_fan_icon(false); +} + +/* Although this is undocumented, the ST7920 allows the character + * data buffer (DDRAM) to be used in conjunction with the graphics + * bitmap buffer (CGRAM). The contents of the graphics buffer is + * XORed with the data from the character generator. This allows + * us to make the progess bar out of graphical data (the bar) and + * text data (the percentage). + */ +void ST7920_Lite_Status_Screen::draw_progress_bar(uint8_t value) { + #if EXTRUDERS == 1 + // If we have only one extruder, draw a long progress bar on the third line + const int top = 1; // Top in pixels + const int bottom = 13; // Bottom in pixels + const int left = 8; // Left edge, in 16-bit words + const int width = 5; // Width of progress bar, in 16-bit words + #else + const int top = 16 + 1; // Top in pixels + const int bottom = 16 + 13; // Bottom in pixels + const int left = 5; // Left edge, in 16-bit words + const int width = 3; // Width of progress bar, in 16-bit words + #endif + const int char_pcnt = 100/width; // How many percent does each 16-bit word represent? + + // Draw the progress bar as a bitmap in CGRAM + + for(int y = top; y <= bottom; y++) { + set_gdram_address(left,y); + begin_data(); + for(int x = 0; x < width; x++) { + uint16_t gfx_word = 0x0000; + if((x+1)*char_pcnt <= value) { + // Draw completely filled bytes + gfx_word = 0xFFFF; + } else if((x*char_pcnt) < value) { + // Draw partially filled bytes + gfx_word = int(0x8000) >> (value % char_pcnt)*16/char_pcnt; + } + // Draw the frame around the progress bar + if(y == top || y == bottom) { + // Draw top/bottom border + gfx_word = 0xFFFF; + } else if (x == (width-1)) { + // Draw right border + gfx_word |= 0x0001; + } else if (x == 0) { + // Draw left border + gfx_word |= 0x8000; + } + write_word(gfx_word); + } + } + + // Draw the percentage as text in DDRAM + + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_3 + 1); + #else + set_ddram_address(DDRAM_LINE_2 + left); + #endif + + begin_data(); + if(value > 9) { + write_number(value,4); + write_str(F("% ")); + } else { + write_number(value,3); + write_str(F("% ")); + } +} + +void ST7920_Lite_Status_Screen::draw_fan_icon(bool whichIcon) { + set_ddram_address(DDRAM_LINE_1+5); + begin_data(); + write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); +} + +void ST7920_Lite_Status_Screen::draw_heat_icon(bool whichIcon, bool heating) { + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2); + #else + set_ddram_address(DDRAM_LINE_3); + #endif + begin_data(); + if(heating) { + write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); + } else { + write_byte(' '); + write_byte(' '); + } +} + +#define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 1) + +void ST7920_Lite_Status_Screen::draw_extruder_1_temp(uint8_t temp, uint8_t target) { + set_ddram_address(DDRAM_LINE_1+1); + begin_data(); + write_number(temp); + if(target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } else { + write_str(F(" ")); + } +} + +void ST7920_Lite_Status_Screen::draw_extruder_2_temp(uint8_t temp, uint8_t target) { + set_ddram_address(DDRAM_LINE_2+1); + begin_data(); + write_number(temp); + if(target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } else { + write_str(F(" ")); + } +} + +void ST7920_Lite_Status_Screen::draw_bed_temp(uint8_t temp, uint8_t target) { + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2+1); + #else + set_ddram_address(DDRAM_LINE_3+1); + #endif + begin_data(); + write_number(temp); + if(target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } else { + write_str(F(" ")); + } +} + +void ST7920_Lite_Status_Screen::draw_fan_speed(uint8_t value) { + set_ddram_address(DDRAM_LINE_1+6); + begin_data(); + write_number(value,4); +} + +void ST7920_Lite_Status_Screen::draw_print_time(uint32_t elapsed) { + const uint8_t hrs = elapsed/3600; + const uint8_t min = (elapsed/60)%60; + char str[7]; + sprintf_P(str,hrs > 99 ? PSTR("%03d:%02d") : PSTR(" %02d:%02d"),hrs,min); + + set_ddram_address(DDRAM_LINE_3+5); + begin_data(); + write_str(str); +} + +void ST7920_Lite_Status_Screen::draw_feedrate_percentage(uint8_t percentage) { + // We only have enough room for the feedrate when + // we have one extruder + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2+6); + begin_data(); + write_number(percentage,4); + #endif +} + +void ST7920_Lite_Status_Screen::draw_status_message(const unsigned char *str) { + set_ddram_address(DDRAM_LINE_4); + begin_data(); + #if ENABLED(STATUS_MESSAGE_SCROLLING) + const uint8_t lcd_len = 16; + const uint8_t padding = 2; + uint8_t str_len = strlen(str); + + // Trim whitespace at the end of the str, as for some reason + // messages like "Card Inserted" are padded with many spaces + while(str_len > 0 && str[str_len-1] == ' ') { + str_len--; + } + + if(str_len <= lcd_len) { + // It all fits on the LCD without scrolling + write_str(str); + } else { + // Print the message repeatedly until covering the LCD + uint8_t c = status_scroll_pos; + for(uint8_t n = 0; n < lcd_len; n++) { + write_byte(c < str_len ? str[c] : ' '); + c++; + c %= str_len + padding; // Wrap around + } + + // Scroll the message + if(status_scroll_pos == str_len + padding) { + status_scroll_pos = 0; + } else { + status_scroll_pos++; + } + } + #else + write_str(str, 16); + #endif +} + +void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, const float z, bool position_known) { + char str[7]; + set_ddram_address(DDRAM_LINE_4); + begin_data(); + + // If position is unknown, flash the labels. + const unsigned char alt_label = position_known ? 0 : (lcd_blink() ? ' ' : 0); + + dtostrf(x, -4, 0, str); + write_byte(alt_label ? alt_label : 'X'); + write_str(str, 4); + + dtostrf(y, -4, 0, str); + write_byte(alt_label ? alt_label : 'Y'); + write_str(str, 4); + + dtostrf(z, -5, 1, str); + write_byte(alt_label ? alt_label : 'Z'); + write_str(str, 5); +} + +bool ST7920_Lite_Status_Screen::indicators_changed() { + // We only add the target temperatures to the checksum + // because the actual temps fluctuate so by updating + // them only during blinks we gain a bit of stability. + const bool blink = lcd_blink(); + const uint8_t feedrate_perc = feedrate_percentage; + const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; + const float extruder_1_target = thermalManager.degTargetHotend(0); + #if EXTRUDERS == 2 + const float extruder_2_target = thermalManager.degTargetHotend(1); + #endif + const float bed_target = thermalManager.degTargetBed(); + + static uint8_t last_checksum = 0; + + const uint8_t checksum = + uint8_t(blink) ^ + uint8_t(feedrate_perc) ^ + uint8_t(fan_speed) ^ + uint8_t(extruder_1_target) ^ +#if EXTRUDERS == 2 + uint8_t(extruder_2_target) ^ +#endif + uint8_t(bed_target); + + if(last_checksum == checksum) { + return false; + } else { + last_checksum = checksum; + return true; + } +} + +void ST7920_Lite_Status_Screen::update_indicators(bool forceUpdate) { + if(forceUpdate || indicators_changed()) { + const bool blink = lcd_blink(); + const duration_t elapsed = print_job_timer.duration(); + const uint32_t seconds_elapsed = elapsed.value; + const uint8_t feedrate_perc = feedrate_percentage; + const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; + const float extruder_1_temp = thermalManager.degHotend(0); + const float extruder_1_target = thermalManager.degTargetHotend(0); + #if EXTRUDERS == 2 + const float extruder_2_temp = thermalManager.degHotend(1); + const float extruder_2_target = thermalManager.degTargetHotend(1); + #endif + const float bed_temp = thermalManager.degBed(); + const float bed_target = thermalManager.degTargetBed(); + + draw_extruder_1_temp(extruder_1_temp, extruder_1_target); + #if EXTRUDERS == 2 + draw_extruder_2_temp(extruder_2_temp, extruder_2_target); + #endif + draw_bed_temp(bed_temp, bed_target); + draw_fan_speed(fan_speed); + draw_print_time(seconds_elapsed); + draw_feedrate_percentage(feedrate_perc); + + // Update the fan and bed animations + if(fan_speed > 0) { + draw_fan_icon(blink); + } + if(bed_target > 0) { + draw_heat_icon(blink, true); + } else { + draw_heat_icon(false, false); + } + } +} + +bool ST7920_Lite_Status_Screen::position_changed() { + const float x_pos = current_position[X_AXIS]; + const float y_pos = current_position[Y_AXIS]; + const float z_pos = current_position[Z_AXIS]; + const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); + + static uint8_t last_checksum = 0; + if(last_checksum == checksum) { + return false; + } else { + last_checksum = checksum; + return true; + } +} + +bool ST7920_Lite_Status_Screen::status_changed() { + uint8_t checksum = 0; + for(const char *p = lcd_status_message; *p; p++) { + checksum ^= *p; + } + + static uint8_t last_checksum = 0; + if(last_checksum == checksum) { + return false; + } else { + last_checksum = checksum; + return true; + } +} + +bool ST7920_Lite_Status_Screen::blink_changed() { + static uint8_t last_blink = 0; + + const bool blink = lcd_blink(); + if(last_blink == blink) { + return false; + } else { + last_blink = blink; + return true; + } +} + +void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { + static uint8_t countdown = 0; + + /* There is only enough room in the display for either the + * status message or the position, not both, so we choose + * one or another. Whenever the status message changes, + * we show it for a number of consecutive seconds, but + * then go back to showing the position as soon as the + * head moves, i.e: + * + * countdown > 1 -- Show status + * countdown = 1 -- Show status, until movement + * countdown = 0 -- Show position + */ + if( forceUpdate || status_changed() ) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + status_scroll_pos = 0; + #endif + if(lcd_strlen(lcd_status_message)) { + countdown = DELAY_TO_SHOW_POSITION; + } else { + countdown = 0; + } + draw_status_message(lcd_status_message); + blink_changed(); // Clear changed flag + } + else if(countdown > 1 && blink_changed() ) { + countdown--; + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(lcd_status_message); + #endif + } + else if(countdown > 0 && blink_changed() ) { + if(position_changed()) { + countdown--; + forceUpdate = true; + } + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(lcd_status_message); + #endif + } + if(countdown == 0 && (forceUpdate || position_changed() || + #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + blink_changed() + #endif + )) { + draw_position( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS], + #if ENABLED(DISABLE_REDUCED_ACCURACY_WARNING) + true + #else + axis_known_position[X_AXIS] && + axis_known_position[Y_AXIS] && + axis_known_position[Z_AXIS] + #endif + ); + } +} + +void ST7920_Lite_Status_Screen::update_progress(bool forceUpdate) { + #if ENABLED(SDSUPPORT) + const uint8_t percent_done = card.percentDone(); + #else + const uint8_t percent_done = 0; + #endif + + // Since the progress bar involves writing + // quite a few bytes to GDRAM, only do this + // when an update is actually necessary. + + static uint8_t last_progress = 0; + if(!forceUpdate && last_progress == percent_done) + return; + last_progress = percent_done; + + draw_progress_bar(percent_done); +} + +void ST7920_Lite_Status_Screen::update(bool forceUpdate) { + cs(); + update_indicators(forceUpdate); + update_status_or_position(forceUpdate); + update_progress(forceUpdate); + ncs(); +} + +void ST7920_Lite_Status_Screen::reset_state_from_unknown() { + _extended_function_set(true, true); // Do it twice as only one bit + _extended_function_set(true, true); // get set at a time. + _scroll_or_addr_select(false); +} + +void ST7920_Lite_Status_Screen::on_entry() { + cs(); + reset_state_from_unknown(); + clear(); + clear_gdram(); + draw_static_elements(); + update(true); + ncs(); +} + +void ST7920_Lite_Status_Screen::on_exit() { + cs(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +// This is called prior to the KILL screen to +// clear the screen so we don't end up with a +// garbled display. +void ST7920_Lite_Status_Screen::clear_text_buffer() { + cs(); + reset_state_from_unknown(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +static void lcd_implementation_status_screen() { + ST7920_Lite_Status_Screen::update(false); +} + +/* In order to properly update the lite status screen, + * we must know when we have entered and left the + * status screen. Since the ultralcd code is not + * set up for doing this, we call this function before + * each update indicating whether the current screen + * is the status screen. + * + * This function keeps track of whether we have left or + * entered the status screen and calls the on_entry() + * and on_exit() methods for cleanup. + */ + +static void lcd_in_status(bool inStatus) { + static bool lastInStatus = false; + if(!lastInStatus && inStatus) { + ST7920_Lite_Status_Screen::on_entry(); + lastInStatus = true; + } + if(lastInStatus && !inStatus) { + ST7920_Lite_Status_Screen::on_exit(); + lastInStatus = false; + } +} \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h new file mode 100644 index 000000000..1a0a33be4 --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h @@ -0,0 +1,39 @@ +/* + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#include "ultralcd_impl_st7920_lite_status_screen.h" + +void ST7920_Lite_Status_Screen::cs() { + ST7920_CS(); + current_bits.synced = false; +} + +void ST7920_Lite_Status_Screen::ncs() { + ST7920_NCS(); + current_bits.synced = false; +} + +void ST7920_Lite_Status_Screen::sync_cmd() { + ST7920_SET_CMD(); +} + +void ST7920_Lite_Status_Screen::sync_dat() { + ST7920_SET_DAT(); +} + +void ST7920_Lite_Status_Screen::write_byte(uint8_t data) { + ST7920_WRITE_NIBBLES(data); +} \ No newline at end of file From 8db67d1647727ce639a2a7ba74ddd0d1a4ee36ca Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 14 Feb 2018 15:51:25 -0700 Subject: [PATCH 03/12] Fixed compilation when using avr-gcc - avr-gcc is more strict than the Arduino IDE, it seems. --- Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h | 2 +- .../lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h index 19c356426..dd3c71a1e 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h @@ -76,7 +76,7 @@ class ST7920_Lite_Status_Screen { static void draw_fan_speed(uint8_t value); static void draw_print_time(uint32_t elapsed); static void draw_feedrate_percentage(uint8_t percentage); - static void draw_status_message(const unsigned char *str); + static void draw_status_message(const char *str); static void draw_position(const float x, const float y, const float z, bool position_known = true); static bool indicators_changed(); diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h index 3a90ee183..db66fc12f 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h @@ -99,7 +99,7 @@ void ST7920_Lite_Status_Screen::write_str(progmem_str str) { write_str_P((const char*)str); } -void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits=3) { +void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits) { char str[7]; const char *fmt; switch(digits) { @@ -435,7 +435,7 @@ void ST7920_Lite_Status_Screen::draw_feedrate_percentage(uint8_t percentage) { #endif } -void ST7920_Lite_Status_Screen::draw_status_message(const unsigned char *str) { +void ST7920_Lite_Status_Screen::draw_status_message(const char *str) { set_ddram_address(DDRAM_LINE_4); begin_data(); #if ENABLED(STATUS_MESSAGE_SCROLLING) From 24eb275b99bf8d31c2ae5d89c9e0cc7d0f0c5edb Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 14 Feb 2018 14:43:54 -0700 Subject: [PATCH 04/12] 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 + .../ultralcd_impl_st7920_lite_status_screen.h | 247 ++++++ ...alcd_impl_st7920_lite_status_screen_impl.h | 757 ++++++++++++++++++ ..._impl_st7920_lite_status_screen_impl_spi.h | 39 + .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 16 +- Marlin/src/lcd/ultralcd.cpp | 44 +- Marlin/src/lcd/ultralcd_impl_DOGM.h | 10 + 27 files changed, 1330 insertions(+), 17 deletions(-) create mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h create mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h create mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 906765503..126fdc089 100644 --- a/Marlin/Configuration.h +++ b/Marlin/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/default/Configuration.h b/Marlin/src/config/default/Configuration.h index 906765503..126fdc089 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/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/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index 629a2373a..56ae68867 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/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/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index 2a4365b24..e1c3ac694 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -1661,9 +1661,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 21f94a4ae..b303b158f 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -1516,6 +1516,7 @@ // //#define G3D_PANEL + // // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller @@ -1524,6 +1525,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 b8712d93e..0df628236 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -1513,7 +1513,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 0c3da3940..ca6c4ca7c 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -1513,7 +1513,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 35f1f8585..2848e71fe 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -1519,7 +1519,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 555e22fe1..77bd20aa6 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -1517,7 +1517,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 077733ca9..ce0d3e69b 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/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/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index 376c94977..09d4837c5 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -1515,6 +1515,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 affc79667..04282211b 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/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/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h index 239cf8d65..40d6d4c9f 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -1544,7 +1544,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 e74543b69..3e6554299 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -1498,7 +1498,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 38a6a31d1..aa562a5a5 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/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/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index ecc36d717..108ee285e 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -1546,7 +1546,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 5e6092b26..7d5038c78 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/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/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h index 2e0c436c2..662b1ba1c 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -1507,7 +1507,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 6ebfebf86..976a2bac4 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -1637,7 +1637,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 9053afb07..d52ab8a2f 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -1527,7 +1527,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 d063628ea..6ec77ec43 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/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/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h new file mode 100644 index 000000000..dd3c71a1e --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h @@ -0,0 +1,247 @@ +/* + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#ifndef ULTRALCD_ST7920_LITE_STATUS_H +#define ULTRALCD_ST7920_LITE_STATUS_H + +class ST7920_Lite_Status_Screen { + private: + static struct st7920_state_t { + uint8_t synced : 1; // Whether a sync has been sent + uint8_t cmd : 1; // Whether the sync was cmd or data + uint8_t extended : 1; + uint8_t graphics : 1; + uint8_t sa : 1; + } current_bits; + + static void cs(); + static void ncs(); + static void sync_cmd(); + static void sync_dat(); + static void write_byte(uint8_t w); + + static void cmd(uint8_t cmd); + static void begin_data(); + static void write_word(uint16_t w); + static void write_str(const char *str); + static void write_str(const char *str, uint8_t len); + static void write_str_P(const char *str); + static void write_str(progmem_str str); + static void write_number(uint8_t value, uint8_t digits=3); + + static void _extended_function_set(bool extended, bool graphics); + static void _scroll_or_addr_select(bool sa); + static void reset_state_from_unknown(); + + static void home(); + static void display_status(bool display_on, bool cursor_on, bool blink_on); + static void extended_function_set(bool extended); + static void graphics(bool graphics); + static void entry_mode_select(bool ac_increase, bool shift); + static void scroll_or_addr_select(bool sa); + static void set_ddram_address(uint8_t addr); + static void set_cgram_address(uint8_t addr); + static void set_gdram_address(uint8_t x, uint8_t y); + + static void clear(); + static void clear_ddram(); + static void clear_gdram(); + + static void load_cgram_icon(uint16_t addr, const void *data); + static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); + + static uint8_t string_checksum(const char *str); + + protected: + static void draw_static_elements(); + static void draw_progress_bar(uint8_t value); + static void draw_fan_icon(bool whichIcon); + static void draw_heat_icon(bool whichIcon, bool heating); + static void draw_extruder_1_temp(uint8_t temp, uint8_t target); + static void draw_extruder_2_temp(uint8_t temp, uint8_t target); + static void draw_bed_temp(uint8_t temp, uint8_t target); + static void draw_fan_speed(uint8_t value); + static void draw_print_time(uint32_t elapsed); + static void draw_feedrate_percentage(uint8_t percentage); + static void draw_status_message(const char *str); + static void draw_position(const float x, const float y, const float z, bool position_known = true); + + static bool indicators_changed(); + static bool position_changed(); + static bool blink_changed(); + static bool status_changed(); + + static void update_indicators(bool forceUpdate); + static void update_position(bool forceUpdate, bool resetChecksum); + static void update_status_or_position(bool forceUpdate); + static void update_progress(bool forceUpdate); + + public: + static void update(bool forceUpdate); + static void on_entry(); + static void on_exit(); + static void clear_text_buffer(); +}; + +/************************** ICON DEFINITIONS *************************************/ + +#define CGRAM_ICON_1_ADDR 0x00 +#define CGRAM_ICON_2_ADDR 0x10 +#define CGRAM_ICON_3_ADDR 0x20 +#define CGRAM_ICON_4_ADDR 0x30 + +#define CGRAM_ICON_1_WORD 0x00 +#define CGRAM_ICON_2_WORD 0x02 +#define CGRAM_ICON_3_WORD 0x04 +#define CGRAM_ICON_4_WORD 0x06 + +PROGMEM const uint16_t nozzle_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000111111110000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000011111100000, + 0b0000001111000000, + 0b0000000110000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t bed_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0111111111111110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t heat1_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t heat2_icon[] = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t fan1_icon[] = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110001111000110, + 0b0100001111000010, + 0b0100000110000010, + 0b0101100000011010, + 0b0101110110111010, + 0b0101100000011010, + 0b0100000110000010, + 0b0100001111000010, + 0b0110001111000110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t fan2_icon[] = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110010000100110, + 0b0100111001110010, + 0b0101111001111010, + 0b0100110000110010, + 0b0100000110000010, + 0b0100110000110010, + 0b0101111001111010, + 0b0100111001110010, + 0b0110010000100110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +PROGMEM const uint16_t feedrate_icon[] = { + 0b0000000000000000, + 0b0111111000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0111111011111000, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000011111000, + 0b0000000010001000, + 0b0000000010000100, + 0b0000000010000100, + 0b0000000010000010, + 0b0000000000000000, + 0b0000000000000000 +}; + +static void lcd_implementation_status_screen(); +static void lcd_in_status(bool inStatus); + +#endif // ULTRALCD_ST7920_LITE_STATUS_H \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h new file mode 100644 index 000000000..db66fc12f --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h @@ -0,0 +1,757 @@ +/* + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + + /* This is an implementation of a status screen for the RepRapDiscount + * Full Graphics Smart Controller using native ST7920 commands rather + * than using U8Glib. + * + * This alternative status screen makes use of the built-in character + * generation capabilities of the ST7920 to update the status screen + * with less SPI traffic and CPU use. In particular: + * + * - The fan and bed animations are handled using custom characters + * that are stored in CGRAM. This allows for the animation to be + * updated by writing a single character to the text-buffer (DDRAM). + * + * - All the information in the status screen is text that is written + * to DDRAM, so the work of generating the bitmaps is offloaded to + * the ST7920 rather than being render by U8Glib on the MCU. + * + * - The graphics buffer (GDRAM) is only used for static graphics + * elements (nozzle and feedrate bitmaps) and for the progress + * bar, so updates are sporadic. + */ + +#include "../../libs/duration_t.h" + +typedef const __FlashStringHelper *progmem_str; + +#include "ultralcd_impl_st7920_lite_status_screen.h" + +#define BUFFER_WIDTH 256 +#define BUFFER_HEIGHT 32 + +#define DDRAM_LINE_1 0x00 +#define DDRAM_LINE_2 0x10 +#define DDRAM_LINE_3 0x08 +#define DDRAM_LINE_4 0x18 + +ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; + +void ST7920_Lite_Status_Screen::cmd(uint8_t cmd) { + if(!current_bits.synced || !current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = true; + sync_cmd(); + } + write_byte(cmd); +} + +void ST7920_Lite_Status_Screen::begin_data() { + extended_function_set(false); + if(!current_bits.synced || current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = false; + sync_dat(); + } +} + +void ST7920_Lite_Status_Screen::write_word(uint16_t w) { + write_byte((w >> 8) & 0xFF); + write_byte((w >> 0) & 0xFF); +} + +void ST7920_Lite_Status_Screen::write_str(const char *str) { + while(*str) { + write_byte(*str++); + } +} + +void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { + while(*str && len--) { + write_byte(*str++); + } +} + +void ST7920_Lite_Status_Screen::write_str_P(const char *str) { + const char *p_str = (const char *)str; + char c = pgm_read_byte_near(p_str++); + while(c) { + write_byte(c); + c = pgm_read_byte_near(p_str++); + } +} + +void ST7920_Lite_Status_Screen::write_str(progmem_str str) { + write_str_P((const char*)str); +} + +void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits) { + char str[7]; + const char *fmt; + switch(digits) { + case 6: fmt = PSTR("%6d"); break; + case 5: fmt = PSTR("%5d"); break; + case 4: fmt = PSTR("%4d"); break; + case 3: fmt = PSTR("%3d"); break; + case 2: fmt = PSTR("%2d"); break; + case 1: fmt = PSTR("%1d"); break; + } + sprintf_P(str,fmt,value); + write_str(str); +} + +void ST7920_Lite_Status_Screen::display_status(bool display_on, bool cursor_on, bool blink_on) { + extended_function_set(false); + cmd(0b00001000 | + (display_on ? 0b0100 : 0) | + (cursor_on ? 0b0010 : 0) | + (blink_on ? 0b0001 : 0) + ); +} + +// Sets the extended and graphics bits simultaneously, regardless of +// the current state. This is a helper function for extended_function_set() +// and graphics() +void ST7920_Lite_Status_Screen::_extended_function_set(bool extended, bool graphics) { + cmd( 0b00100000 | + (extended ? 0b00000100 : 0) | + (graphics ? 0b00000010 : 0) + ); + current_bits.extended = extended; + current_bits.graphics = graphics; +} + +void ST7920_Lite_Status_Screen::extended_function_set(bool extended) { + if(extended != current_bits.extended) { + _extended_function_set(extended, current_bits.graphics); + } +} + +void ST7920_Lite_Status_Screen::graphics(bool graphics) { + if(graphics != current_bits.graphics) { + _extended_function_set(current_bits.extended, graphics); + } +} + +void ST7920_Lite_Status_Screen::entry_mode_select(bool ac_increase, bool shift) { + extended_function_set(false); + cmd(0b00000100 | + (ac_increase ? 0b00000010 : 0) | + (shift ? 0b00000001 : 0) + ); +} + +// Sets the sa bit regardless of the current state. This is a helper +// function for scroll_or_addr_select() +void ST7920_Lite_Status_Screen::_scroll_or_addr_select(bool sa) { + extended_function_set(true); + cmd(0b00100010 | + (sa ? 0b000001 : 0) + ); + current_bits.sa = sa; +} + +void ST7920_Lite_Status_Screen::scroll_or_addr_select(bool sa) { + if(sa != current_bits.sa) { + _scroll_or_addr_select(sa); + } +} + +void ST7920_Lite_Status_Screen::set_ddram_address(uint8_t addr) { + extended_function_set(false); + cmd(0b10000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_cgram_address(uint8_t addr) { + extended_function_set(false); + cmd(0b01000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_gdram_address(uint8_t x, uint8_t y) { + extended_function_set(true); + cmd(0b10000000 | (y & 0b01111111)); + cmd(0b10000000 | (x & 0b00001111)); +} + +void ST7920_Lite_Status_Screen::clear() { + extended_function_set(false); + cmd(0x00000001); + delay(15); //delay for CGRAM clear +} + +void ST7920_Lite_Status_Screen::home() { + extended_function_set(false); + cmd(0x00000010); +} + +/* This fills the entire text buffer with spaces */ +void ST7920_Lite_Status_Screen::clear_ddram() +{ + set_ddram_address(DDRAM_LINE_1); + begin_data(); + for(int i=0; i < 64;i++) { + write_byte(' '); + } +} + +/* This fills the entire graphics buffer with zeros */ +void ST7920_Lite_Status_Screen::clear_gdram() +{ + for(int y = 0; y < BUFFER_HEIGHT; y++) { + set_gdram_address(0,y); + begin_data(); + for(int i = 0; i < (BUFFER_WIDTH / 16); i++) { + write_byte(0); + write_byte(0); + } + } +} + +void ST7920_Lite_Status_Screen::load_cgram_icon(uint16_t addr, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + set_cgram_address(addr); + begin_data(); + for(int i = 0; i < 16; i++) { + uint16_t word = pgm_read_word_near(p_word++); + write_byte((word & 0xFF00) >> 8); + write_byte((word & 0x00FF) >> 0); + } +} + +/* Draws an icon in GDRAM. The position is specified in + as if they were DDRAM coordinates, i.e. the x position + is [1-8], while the y position is [1-4] */ +void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + if(y > 2) { + // Handle display folding + y -= 2; + x += 8; + } + x -= 1; + y -= 1; + for(int i = 0; i < 16; i++) { + uint16_t word = pgm_read_word_near(p_word++); + set_gdram_address(x,i+y*16); + begin_data(); + write_byte((word & 0xFF00) >> 8); + write_byte((word & 0x00FF) >> 0); + } +} + +/************************** MAIN SCREEN *************************************/ + +void ST7920_Lite_Status_Screen::draw_static_elements() { + scroll_or_addr_select(0); + + // Load the animated bed and fan icons + load_cgram_icon(CGRAM_ICON_1_ADDR, heat1_icon); + load_cgram_icon(CGRAM_ICON_2_ADDR, heat2_icon); + load_cgram_icon(CGRAM_ICON_3_ADDR, fan1_icon); + load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); + + // Draw the static icons in GDRAM + draw_gdram_icon(1,1,nozzle_icon); + #if EXTRUDERS == 2 + draw_gdram_icon(1,2,nozzle_icon); + #endif + draw_gdram_icon(6,2,feedrate_icon); + draw_gdram_icon(1,2,bed_icon); + + // Draw the initial fan icon + draw_fan_icon(false); +} + +/* Although this is undocumented, the ST7920 allows the character + * data buffer (DDRAM) to be used in conjunction with the graphics + * bitmap buffer (CGRAM). The contents of the graphics buffer is + * XORed with the data from the character generator. This allows + * us to make the progess bar out of graphical data (the bar) and + * text data (the percentage). + */ +void ST7920_Lite_Status_Screen::draw_progress_bar(uint8_t value) { + #if EXTRUDERS == 1 + // If we have only one extruder, draw a long progress bar on the third line + const int top = 1; // Top in pixels + const int bottom = 13; // Bottom in pixels + const int left = 8; // Left edge, in 16-bit words + const int width = 5; // Width of progress bar, in 16-bit words + #else + const int top = 16 + 1; // Top in pixels + const int bottom = 16 + 13; // Bottom in pixels + const int left = 5; // Left edge, in 16-bit words + const int width = 3; // Width of progress bar, in 16-bit words + #endif + const int char_pcnt = 100/width; // How many percent does each 16-bit word represent? + + // Draw the progress bar as a bitmap in CGRAM + + for(int y = top; y <= bottom; y++) { + set_gdram_address(left,y); + begin_data(); + for(int x = 0; x < width; x++) { + uint16_t gfx_word = 0x0000; + if((x+1)*char_pcnt <= value) { + // Draw completely filled bytes + gfx_word = 0xFFFF; + } else if((x*char_pcnt) < value) { + // Draw partially filled bytes + gfx_word = int(0x8000) >> (value % char_pcnt)*16/char_pcnt; + } + // Draw the frame around the progress bar + if(y == top || y == bottom) { + // Draw top/bottom border + gfx_word = 0xFFFF; + } else if (x == (width-1)) { + // Draw right border + gfx_word |= 0x0001; + } else if (x == 0) { + // Draw left border + gfx_word |= 0x8000; + } + write_word(gfx_word); + } + } + + // Draw the percentage as text in DDRAM + + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_3 + 1); + #else + set_ddram_address(DDRAM_LINE_2 + left); + #endif + + begin_data(); + if(value > 9) { + write_number(value,4); + write_str(F("% ")); + } else { + write_number(value,3); + write_str(F("% ")); + } +} + +void ST7920_Lite_Status_Screen::draw_fan_icon(bool whichIcon) { + set_ddram_address(DDRAM_LINE_1+5); + begin_data(); + write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); +} + +void ST7920_Lite_Status_Screen::draw_heat_icon(bool whichIcon, bool heating) { + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2); + #else + set_ddram_address(DDRAM_LINE_3); + #endif + begin_data(); + if(heating) { + write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); + } else { + write_byte(' '); + write_byte(' '); + } +} + +#define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 1) + +void ST7920_Lite_Status_Screen::draw_extruder_1_temp(uint8_t temp, uint8_t target) { + set_ddram_address(DDRAM_LINE_1+1); + begin_data(); + write_number(temp); + if(target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } else { + write_str(F(" ")); + } +} + +void ST7920_Lite_Status_Screen::draw_extruder_2_temp(uint8_t temp, uint8_t target) { + set_ddram_address(DDRAM_LINE_2+1); + begin_data(); + write_number(temp); + if(target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } else { + write_str(F(" ")); + } +} + +void ST7920_Lite_Status_Screen::draw_bed_temp(uint8_t temp, uint8_t target) { + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2+1); + #else + set_ddram_address(DDRAM_LINE_3+1); + #endif + begin_data(); + write_number(temp); + if(target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } else { + write_str(F(" ")); + } +} + +void ST7920_Lite_Status_Screen::draw_fan_speed(uint8_t value) { + set_ddram_address(DDRAM_LINE_1+6); + begin_data(); + write_number(value,4); +} + +void ST7920_Lite_Status_Screen::draw_print_time(uint32_t elapsed) { + const uint8_t hrs = elapsed/3600; + const uint8_t min = (elapsed/60)%60; + char str[7]; + sprintf_P(str,hrs > 99 ? PSTR("%03d:%02d") : PSTR(" %02d:%02d"),hrs,min); + + set_ddram_address(DDRAM_LINE_3+5); + begin_data(); + write_str(str); +} + +void ST7920_Lite_Status_Screen::draw_feedrate_percentage(uint8_t percentage) { + // We only have enough room for the feedrate when + // we have one extruder + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2+6); + begin_data(); + write_number(percentage,4); + #endif +} + +void ST7920_Lite_Status_Screen::draw_status_message(const char *str) { + set_ddram_address(DDRAM_LINE_4); + begin_data(); + #if ENABLED(STATUS_MESSAGE_SCROLLING) + const uint8_t lcd_len = 16; + const uint8_t padding = 2; + uint8_t str_len = strlen(str); + + // Trim whitespace at the end of the str, as for some reason + // messages like "Card Inserted" are padded with many spaces + while(str_len > 0 && str[str_len-1] == ' ') { + str_len--; + } + + if(str_len <= lcd_len) { + // It all fits on the LCD without scrolling + write_str(str); + } else { + // Print the message repeatedly until covering the LCD + uint8_t c = status_scroll_pos; + for(uint8_t n = 0; n < lcd_len; n++) { + write_byte(c < str_len ? str[c] : ' '); + c++; + c %= str_len + padding; // Wrap around + } + + // Scroll the message + if(status_scroll_pos == str_len + padding) { + status_scroll_pos = 0; + } else { + status_scroll_pos++; + } + } + #else + write_str(str, 16); + #endif +} + +void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, const float z, bool position_known) { + char str[7]; + set_ddram_address(DDRAM_LINE_4); + begin_data(); + + // If position is unknown, flash the labels. + const unsigned char alt_label = position_known ? 0 : (lcd_blink() ? ' ' : 0); + + dtostrf(x, -4, 0, str); + write_byte(alt_label ? alt_label : 'X'); + write_str(str, 4); + + dtostrf(y, -4, 0, str); + write_byte(alt_label ? alt_label : 'Y'); + write_str(str, 4); + + dtostrf(z, -5, 1, str); + write_byte(alt_label ? alt_label : 'Z'); + write_str(str, 5); +} + +bool ST7920_Lite_Status_Screen::indicators_changed() { + // We only add the target temperatures to the checksum + // because the actual temps fluctuate so by updating + // them only during blinks we gain a bit of stability. + const bool blink = lcd_blink(); + const uint8_t feedrate_perc = feedrate_percentage; + const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; + const float extruder_1_target = thermalManager.degTargetHotend(0); + #if EXTRUDERS == 2 + const float extruder_2_target = thermalManager.degTargetHotend(1); + #endif + const float bed_target = thermalManager.degTargetBed(); + + static uint8_t last_checksum = 0; + + const uint8_t checksum = + uint8_t(blink) ^ + uint8_t(feedrate_perc) ^ + uint8_t(fan_speed) ^ + uint8_t(extruder_1_target) ^ +#if EXTRUDERS == 2 + uint8_t(extruder_2_target) ^ +#endif + uint8_t(bed_target); + + if(last_checksum == checksum) { + return false; + } else { + last_checksum = checksum; + return true; + } +} + +void ST7920_Lite_Status_Screen::update_indicators(bool forceUpdate) { + if(forceUpdate || indicators_changed()) { + const bool blink = lcd_blink(); + const duration_t elapsed = print_job_timer.duration(); + const uint32_t seconds_elapsed = elapsed.value; + const uint8_t feedrate_perc = feedrate_percentage; + const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; + const float extruder_1_temp = thermalManager.degHotend(0); + const float extruder_1_target = thermalManager.degTargetHotend(0); + #if EXTRUDERS == 2 + const float extruder_2_temp = thermalManager.degHotend(1); + const float extruder_2_target = thermalManager.degTargetHotend(1); + #endif + const float bed_temp = thermalManager.degBed(); + const float bed_target = thermalManager.degTargetBed(); + + draw_extruder_1_temp(extruder_1_temp, extruder_1_target); + #if EXTRUDERS == 2 + draw_extruder_2_temp(extruder_2_temp, extruder_2_target); + #endif + draw_bed_temp(bed_temp, bed_target); + draw_fan_speed(fan_speed); + draw_print_time(seconds_elapsed); + draw_feedrate_percentage(feedrate_perc); + + // Update the fan and bed animations + if(fan_speed > 0) { + draw_fan_icon(blink); + } + if(bed_target > 0) { + draw_heat_icon(blink, true); + } else { + draw_heat_icon(false, false); + } + } +} + +bool ST7920_Lite_Status_Screen::position_changed() { + const float x_pos = current_position[X_AXIS]; + const float y_pos = current_position[Y_AXIS]; + const float z_pos = current_position[Z_AXIS]; + const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); + + static uint8_t last_checksum = 0; + if(last_checksum == checksum) { + return false; + } else { + last_checksum = checksum; + return true; + } +} + +bool ST7920_Lite_Status_Screen::status_changed() { + uint8_t checksum = 0; + for(const char *p = lcd_status_message; *p; p++) { + checksum ^= *p; + } + + static uint8_t last_checksum = 0; + if(last_checksum == checksum) { + return false; + } else { + last_checksum = checksum; + return true; + } +} + +bool ST7920_Lite_Status_Screen::blink_changed() { + static uint8_t last_blink = 0; + + const bool blink = lcd_blink(); + if(last_blink == blink) { + return false; + } else { + last_blink = blink; + return true; + } +} + +void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { + static uint8_t countdown = 0; + + /* There is only enough room in the display for either the + * status message or the position, not both, so we choose + * one or another. Whenever the status message changes, + * we show it for a number of consecutive seconds, but + * then go back to showing the position as soon as the + * head moves, i.e: + * + * countdown > 1 -- Show status + * countdown = 1 -- Show status, until movement + * countdown = 0 -- Show position + */ + if( forceUpdate || status_changed() ) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + status_scroll_pos = 0; + #endif + if(lcd_strlen(lcd_status_message)) { + countdown = DELAY_TO_SHOW_POSITION; + } else { + countdown = 0; + } + draw_status_message(lcd_status_message); + blink_changed(); // Clear changed flag + } + else if(countdown > 1 && blink_changed() ) { + countdown--; + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(lcd_status_message); + #endif + } + else if(countdown > 0 && blink_changed() ) { + if(position_changed()) { + countdown--; + forceUpdate = true; + } + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(lcd_status_message); + #endif + } + if(countdown == 0 && (forceUpdate || position_changed() || + #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + blink_changed() + #endif + )) { + draw_position( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS], + #if ENABLED(DISABLE_REDUCED_ACCURACY_WARNING) + true + #else + axis_known_position[X_AXIS] && + axis_known_position[Y_AXIS] && + axis_known_position[Z_AXIS] + #endif + ); + } +} + +void ST7920_Lite_Status_Screen::update_progress(bool forceUpdate) { + #if ENABLED(SDSUPPORT) + const uint8_t percent_done = card.percentDone(); + #else + const uint8_t percent_done = 0; + #endif + + // Since the progress bar involves writing + // quite a few bytes to GDRAM, only do this + // when an update is actually necessary. + + static uint8_t last_progress = 0; + if(!forceUpdate && last_progress == percent_done) + return; + last_progress = percent_done; + + draw_progress_bar(percent_done); +} + +void ST7920_Lite_Status_Screen::update(bool forceUpdate) { + cs(); + update_indicators(forceUpdate); + update_status_or_position(forceUpdate); + update_progress(forceUpdate); + ncs(); +} + +void ST7920_Lite_Status_Screen::reset_state_from_unknown() { + _extended_function_set(true, true); // Do it twice as only one bit + _extended_function_set(true, true); // get set at a time. + _scroll_or_addr_select(false); +} + +void ST7920_Lite_Status_Screen::on_entry() { + cs(); + reset_state_from_unknown(); + clear(); + clear_gdram(); + draw_static_elements(); + update(true); + ncs(); +} + +void ST7920_Lite_Status_Screen::on_exit() { + cs(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +// This is called prior to the KILL screen to +// clear the screen so we don't end up with a +// garbled display. +void ST7920_Lite_Status_Screen::clear_text_buffer() { + cs(); + reset_state_from_unknown(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +static void lcd_implementation_status_screen() { + ST7920_Lite_Status_Screen::update(false); +} + +/* In order to properly update the lite status screen, + * we must know when we have entered and left the + * status screen. Since the ultralcd code is not + * set up for doing this, we call this function before + * each update indicating whether the current screen + * is the status screen. + * + * This function keeps track of whether we have left or + * entered the status screen and calls the on_entry() + * and on_exit() methods for cleanup. + */ + +static void lcd_in_status(bool inStatus) { + static bool lastInStatus = false; + if(!lastInStatus && inStatus) { + ST7920_Lite_Status_Screen::on_entry(); + lastInStatus = true; + } + if(lastInStatus && !inStatus) { + ST7920_Lite_Status_Screen::on_exit(); + lastInStatus = false; + } +} \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h new file mode 100644 index 000000000..1a0a33be4 --- /dev/null +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h @@ -0,0 +1,39 @@ +/* + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#include "ultralcd_impl_st7920_lite_status_screen.h" + +void ST7920_Lite_Status_Screen::cs() { + ST7920_CS(); + current_bits.synced = false; +} + +void ST7920_Lite_Status_Screen::ncs() { + ST7920_NCS(); + current_bits.synced = false; +} + +void ST7920_Lite_Status_Screen::sync_cmd() { + ST7920_SET_CMD(); +} + +void ST7920_Lite_Status_Screen::sync_dat() { + ST7920_SET_DAT(); +} + +void ST7920_Lite_Status_Screen::write_byte(uint8_t data) { + ST7920_WRITE_NIBBLES(data); +} \ No newline at end of file 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 bc1e8bc16..39a3cc17a 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -124,10 +124,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_BYTE(0x20); //non-extended mode ST7920_WRITE_BYTE(0x08); //display off, cursor+blink off - ST7920_WRITE_BYTE(0x01); //clear CGRAM ram - u8g_Delay(15); //delay for CGRAM clear - ST7920_WRITE_BYTE(0x3E); //extended mode + GDRAM active + ST7920_WRITE_BYTE(0x01); //clear DDRAM ram + u8g_Delay(15); //delay for DDRAM clear + ST7920_WRITE_BYTE(0x24); //extended mode + ST7920_WRITE_BYTE(0x26); //extended mode + GDRAM active for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM ST7920_WRITE_BYTE(0x80 | y); //set y ST7920_WRITE_BYTE(0x80); //set x = 0 @@ -181,6 +183,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 c4b6756d0..b7a66e894 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -5116,20 +5116,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 0b7b4badf..2ec7432c5 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(); @@ -801,6 +810,7 @@ static void lcd_implementation_status_screen() { #endif } } +#endif #if ENABLED(ULTIPANEL) From 79272f98fce43c9559d136101c5b4e5e617d0676 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 16 Feb 2018 01:04:15 -0600 Subject: [PATCH 05/12] Proposed changes to ST7920 lightweight status screen --- .travis.yml | 2 +- Marlin/Configuration.h | 11 - Marlin/Configuration_adv.h | 16 + Marlin/src/config/default/Configuration.h | 11 - Marlin/src/config/default/Configuration_adv.h | 16 + .../AlephObjects/TAZ4/Configuration_adv.h | 16 + .../AliExpress/CL-260/Configuration.h | 11 - .../config/examples/Anet/A6/Configuration.h | 11 +- .../examples/Anet/A6/Configuration_adv.h | 16 + .../config/examples/Anet/A8/Configuration.h | 13 - .../examples/Anet/A8/Configuration_adv.h | 16 + .../examples/Azteeg/X5GT/Configuration_adv.h | 16 + .../examples/BIBO/TouchX/Configuration_adv.h | 16 + .../BIBO/TouchX/cyclops/Configuration.h | 11 - .../BIBO/TouchX/default/Configuration.h | 11 - .../examples/BQ/Hephestos/Configuration_adv.h | 16 + .../BQ/Hephestos_2/Configuration_adv.h | 16 + .../examples/BQ/WITBOX/Configuration_adv.h | 16 + .../examples/Cartesio/Configuration_adv.h | 16 + .../Creality/CR-10/Configuration_adv.h | 16 + .../Creality/CR-10S/Configuration_adv.h | 16 + .../Creality/Ender/Configuration_adv.h | 16 + .../config/examples/Felix/Configuration_adv.h | 16 + .../FolgerTech/i3-2020/Configuration.h | 11 - .../FolgerTech/i3-2020/Configuration_adv.h | 16 + .../examples/Infitary/i3-M508/Configuration.h | 11 - .../Infitary/i3-M508/Configuration_adv.h | 16 + .../examples/JGAurora/A5/Configuration.h | 11 - .../examples/JGAurora/A5/Configuration_adv.h | 16 + .../examples/MakerParts/Configuration_adv.h | 16 + .../examples/Malyan/M150/Configuration_adv.h | 16 + .../examples/Malyan/M200/Configuration_adv.h | 16 + .../Micromake/C1/enhanced/Configuration_adv.h | 16 + .../examples/Mks/Sbase/Configuration_adv.h | 16 + .../config/examples/RigidBot/Configuration.h | 12 - .../examples/RigidBot/Configuration_adv.h | 16 + .../config/examples/SCARA/Configuration_adv.h | 16 + .../config/examples/STM32F10/Configuration.h | 11 - .../examples/Sanguinololu/Configuration.h | 11 - .../examples/Sanguinololu/Configuration_adv.h | 16 + .../examples/TheBorg/Configuration_adv.h | 16 + .../examples/TinyBoy2/Configuration_adv.h | 16 + .../config/examples/Tronxy/X1/Configuration.h | 11 - .../examples/Tronxy/X5S/Configuration.h | 11 - .../UltiMachine/Archim2/Configuration_adv.h | 16 + .../examples/Velleman/K8200/Configuration.h | 11 - .../Velleman/K8200/Configuration_adv.h | 16 + .../examples/Velleman/K8400/Configuration.h | 11 - .../Velleman/K8400/Configuration_adv.h | 16 + .../Velleman/K8400/Dual-head/Configuration.h | 11 - .../Wanhao/Duplicator 6/Configuration_adv.h | 16 + .../FLSUN/auto_calibrate/Configuration_adv.h | 16 + .../delta/FLSUN/kossel/Configuration_adv.h | 16 + .../FLSUN/kossel_mini/Configuration_adv.h | 16 + .../delta/generic/Configuration_adv.h | 16 + .../delta/kossel_mini/Configuration.h | 11 - .../delta/kossel_mini/Configuration_adv.h | 16 + .../delta/kossel_pro/Configuration_adv.h | 16 + .../delta/kossel_xl/Configuration_adv.h | 16 + .../examples/gCreate/gMax1.5+/Configuration.h | 11 - .../gCreate/gMax1.5+/Configuration_adv.h | 16 + .../config/examples/makibox/Configuration.h | 11 - .../examples/makibox/Configuration_adv.h | 16 + .../tvrrug/Round2/Configuration_adv.h | 16 + .../config/examples/wt150/Configuration_adv.h | 16 + Marlin/src/lcd/dogm/status_screen_DOGM.h | 442 ++++++++++++ ...een_impl.h => status_screen_lite_ST7920.h} | 643 ++++++++++-------- .../dogm/status_screen_lite_ST7920_class.h | 108 +++ ..._spi.h => status_screen_lite_ST7920_spi.h} | 10 +- .../ultralcd_impl_st7920_lite_status_screen.h | 247 ------- .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 6 +- Marlin/src/lcd/ultralcd.cpp | 20 +- Marlin/src/lcd/ultralcd_impl_DOGM.h | 429 +----------- 73 files changed, 1631 insertions(+), 1198 deletions(-) create mode 100644 Marlin/src/lcd/dogm/status_screen_DOGM.h rename Marlin/src/lcd/dogm/{ultralcd_impl_st7920_lite_status_screen_impl.h => status_screen_lite_ST7920.h} (50%) create mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h rename Marlin/src/lcd/dogm/{ultralcd_impl_st7920_lite_status_screen_impl_spi.h => status_screen_lite_ST7920_spi.h} (86%) delete mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h diff --git a/.travis.yml b/.travis.yml index fd0a767e3..e81f0f4cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -236,7 +236,7 @@ script: # - restore_configs - opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT - - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES + - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES LIGHTWEIGHT_UI - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # # REPRAPWORLD_KEYPAD diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 126fdc089..906765503 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1513,18 +1513,7 @@ // 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/Configuration_adv.h b/Marlin/Configuration_adv.h index 243ad3297..1ab6214bb 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index 126fdc089..906765503 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -1513,18 +1513,7 @@ // 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_adv.h b/Marlin/src/config/default/Configuration_adv.h index 243ad3297..1ab6214bb 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index 00c700343..927288cfa 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index 56ae68867..629a2373a 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -1513,18 +1513,7 @@ // 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 e1c3ac694..2a4365b24 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -1661,18 +1661,9 @@ // 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. +// Note: Details on connecting to the Anet V1.0 controller are in the file pins_ANET_10.h // -// 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_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index c3520aee1..84f2c0a7d 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index b303b158f..21f94a4ae 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -1516,7 +1516,6 @@ // //#define G3D_PANEL - // // RepRapDiscount FULL GRAPHIC Smart Controller // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller @@ -1525,18 +1524,6 @@ // //#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/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 912b64d6a..1379230a4 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h index d3bd3b2ed..90935abff 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h @@ -646,6 +646,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h index bb8eb5dec..06a42b3a4 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h index 0df628236..b8712d93e 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -1513,18 +1513,7 @@ 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 ca6c4ca7c..0c3da3940 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -1513,18 +1513,7 @@ 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/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 06994aae2..f332cd5a1 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 5eb03d180..30fdc7fc9 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 06994aae2..f332cd5a1 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 9be79050b..979681706 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index b3e8b8c55..ceaf22f75 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h index fcc9afd7e..860085868 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h index f16433f92..18ae13b91 100644 --- a/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index a3dae02c6..7d85152c5 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index 2848e71fe..35f1f8585 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -1519,18 +1519,7 @@ // 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_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 8e490f853..3850fd08d 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h index 77bd20aa6..555e22fe1 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -1517,18 +1517,7 @@ // 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_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index bdb8798bd..46bd9efcc 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/Marlin/src/config/examples/JGAurora/A5/Configuration.h index ce0d3e69b..077733ca9 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h @@ -1524,18 +1524,7 @@ // 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_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h index 5f7bd9dc9..658c8957d 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 37aa8bf65..2b948f11c 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 04a8f7b0e..dcbeb42e8 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index d5fa7ef2d..48defd391 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index b406b99d8..2af049577 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index 750336556..0c65886be 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -653,6 +653,22 @@ #define DOGLCD_MOSI MOSI_PIN #endif + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index 09d4837c5..376c94977 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -1515,18 +1515,6 @@ // //#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/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index f7aabe342..b0518f809 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index f6dea0622..8f4924336 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/Marlin/src/config/examples/STM32F10/Configuration.h index 04282211b..affc79667 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/Configuration.h @@ -1516,18 +1516,7 @@ // 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 40d6d4c9f..239cf8d65 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -1544,18 +1544,7 @@ // 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_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 82fad3d16..0bd42f352 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h index 51f416d03..4edeea36c 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h @@ -642,6 +642,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index cf1be79b7..d9a05677f 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/Marlin/src/config/examples/Tronxy/X1/Configuration.h index 3e6554299..e74543b69 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -1498,18 +1498,7 @@ // 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 aa562a5a5..38a6a31d1 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h @@ -1513,18 +1513,7 @@ // 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/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index 756dada7b..669fcbcb4 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index 108ee285e..ecc36d717 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -1546,18 +1546,7 @@ // 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_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index bcd42279b..30a2f2907 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h index 7d5038c78..5e6092b26 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -1513,18 +1513,7 @@ // 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_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index af6773c93..fa6f23485 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety 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 662b1ba1c..2e0c436c2 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -1507,18 +1507,7 @@ // 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/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 28ae6c3a9..cd507f206 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 3aac73b8f..af0badc32 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h index 7b10f7e1e..bd46e9ebf 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index daadd5efd..9528ec9b4 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index daadd5efd..9528ec9b4 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index 976a2bac4..6ebfebf86 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -1637,18 +1637,7 @@ // 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_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index daadd5efd..9528ec9b4 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index a9f5d4fa8..a04bb552a 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -652,6 +652,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index 232b8d6e5..11d29b9c5 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -647,6 +647,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h index d52ab8a2f..9053afb07 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -1527,18 +1527,7 @@ // 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_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 01afd6b77..eb7ba293c 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h index 6ec77ec43..d063628ea 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -1516,18 +1516,7 @@ // 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_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index a5b15b437..c5d4bc089 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index 5b1ae96d9..c957dad00 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -645,6 +645,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 9c7ea6d35..70c37335b 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -646,6 +646,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.h b/Marlin/src/lcd/dogm/status_screen_DOGM.h new file mode 100644 index 000000000..3d9fa0123 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.h @@ -0,0 +1,442 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * status_screen_DOGM.h + * + * Standard Status Screen for Graphical Display + */ + +#ifndef ULTRALCD_IMPL_STATUS_SCREEN_DOGM_H +#define ULTRALCD_IMPL_STATUS_SCREEN_DOGM_H + +FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { + const char * const str = itostr3(temp); + u8g.setPrintPos(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y); + lcd_print(str); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); +} + +#ifndef HEAT_INDICATOR_X + #define HEAT_INDICATOR_X 8 +#endif + +FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) { + #if !HEATER_IDLE_HANDLER + UNUSED(blink); + #endif + + #if HAS_TEMP_BED + const bool isBed = heater < 0; + #else + constexpr bool isBed = false; + #endif + + if (PAGE_UNDER(7)) { + #if HEATER_IDLE_HANDLER + const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : + #if HAS_TEMP_BED + thermalManager.is_bed_idle() + #else + false + #endif + ); + + if (blink || !is_idle) + #endif + _draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); } + + if (PAGE_CONTAINS(21, 28)) + _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28); + + if (PAGE_CONTAINS(17, 20)) { + const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X, + y = isBed ? 18 : 17; + if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) { + u8g.setColorIndex(0); // white on black + u8g.drawBox(x + h, y, 2, 2); + u8g.setColorIndex(1); // black on white + } + else { + u8g.drawBox(x + h, y, 2, 2); + } + } +} + +FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) { + if (blink) + lcd_printPGM(pstr); + else { + if (!axis_homed[axis]) + u8g.print('?'); + else { + #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + if (!axis_known_position[axis]) + u8g.print(' '); + else + #endif + lcd_printPGM(pstr); + } + } +} + +inline void lcd_implementation_status_message(const bool blink) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + static bool last_blink = false; + const uint8_t slen = lcd_strlen(lcd_status_message); + const char *stat = lcd_status_message + status_scroll_pos; + if (slen <= LCD_WIDTH) + lcd_print_utf(stat); // The string isn't scrolling + else { + if (status_scroll_pos <= slen - LCD_WIDTH) + lcd_print_utf(stat); // The string fills the screen + else { + uint8_t chars = LCD_WIDTH; + if (status_scroll_pos < slen) { // First string still visible + lcd_print_utf(stat); // The string leaves space + chars -= slen - status_scroll_pos; // Amount of space left + } + u8g.print('.'); // Always at 1+ spaces left, draw a dot + if (--chars) { + if (status_scroll_pos < slen + 1) // Draw a second dot if there's space + --chars, u8g.print('.'); + if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message + } + } + if (last_blink != blink) { + last_blink = blink; + // Skip any non-printing bytes + if (status_scroll_pos < slen) while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++; + if (++status_scroll_pos >= slen + 2) status_scroll_pos = 0; + } + } + #else + UNUSED(blink); + lcd_print_utf(lcd_status_message); + #endif +} + +static void lcd_implementation_status_screen() { + + const bool blink = lcd_blink(); + + #if FAN_ANIM_FRAMES > 2 + static bool old_blink; + static uint8_t fan_frame; + if (old_blink != blink) { + old_blink = blink; + if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; + } + #endif + + // Status Menu Font + lcd_setFont(FONT_STATUSMENU); + + // + // Fan Animation + // + // Draws the whole heading image as a B/W bitmap rather than + // drawing the elements separately. + // This was done as an optimization, as it was slower to draw + // multiple parts compared to a single bitmap. + // + // The bitmap: + // - May be offset in X + // - Includes all nozzle(s), bed(s), and the fan. + // + // TODO: + // + // - Only draw the whole header on the first + // entry to the status screen. Nozzle, bed, and + // fan outline bits don't change. + // + if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { + + u8g.drawBitmapP( + STATUS_SCREEN_X, STATUS_SCREEN_Y, + (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, + #if HAS_FAN0 + #if FAN_ANIM_FRAMES > 2 + fan_frame == 1 ? status_screen1_bmp : + fan_frame == 2 ? status_screen2_bmp : + #if FAN_ANIM_FRAMES > 3 + fan_frame == 3 ? status_screen3_bmp : + #endif + #else + blink && fanSpeeds[0] ? status_screen1_bmp : + #endif + #endif + status_screen0_bmp + ); + + } + + // + // Temperature Graphics and Info + // + + if (PAGE_UNDER(28)) { + // Extruders + HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); + + // Heated bed + #if HOTENDS < 4 && HAS_TEMP_BED + _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); + #endif + + #if HAS_FAN0 + if (PAGE_CONTAINS(20, 27)) { + // Fan + const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256; + if (per) { + u8g.setPrintPos(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y); + lcd_print(itostr3(per)); + u8g.print('%'); + } + } + #endif + } + + #if ENABLED(SDSUPPORT) + // + // SD Card Symbol + // + if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { + // Upper box + u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) + // Right edge + u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47) + // Bottom hollow box + u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51) + // Corner pixel + u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42) + } + #endif // SDSUPPORT + + #if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) + // + // Progress bar frame + // + #define PROGRESS_BAR_X 54 + #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) + + if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51) + u8g.drawFrame( + PROGRESS_BAR_X, 49, + PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) + ); + + #if DISABLED(LCD_SET_PROGRESS_MANUALLY) + const uint8_t progress_bar_percent = card.percentDone(); + #endif + + if (progress_bar_percent > 1) { + + // + // Progress bar solid part + // + + if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) + u8g.drawBox( + PROGRESS_BAR_X + 1, 50, + (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) + ); + + // + // SD Percent Complete + // + + #if ENABLED(DOGM_SD_PERCENT) + if (PAGE_CONTAINS(41, 48)) { + // Percent complete + u8g.setPrintPos(55, 48); + u8g.print(itostr3(progress_bar_percent)); + u8g.print('%'); + } + #endif + } + + // + // Elapsed Time + // + + #if DISABLED(DOGM_SD_PERCENT) + #define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2)) + #else + #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH) + #endif + + if (PAGE_CONTAINS(41, 48)) { + char buffer[10]; + duration_t elapsed = print_job_timer.duration(); + bool has_days = (elapsed.value >= 60*60*24L); + uint8_t len = elapsed.toDigital(buffer, has_days); + u8g.setPrintPos(SD_DURATION_X, 48); + lcd_print(buffer); + } + + #endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY + + // + // XYZ Coordinates + // + + #if ENABLED(USE_SMALL_INFOFONT) + #define INFO_FONT_HEIGHT 7 + #else + #define INFO_FONT_HEIGHT 8 + #endif + + #define XYZ_BASELINE (30 + INFO_FONT_HEIGHT) + + #define X_LABEL_POS 3 + #define X_VALUE_POS 11 + #define XYZ_SPACING 40 + + #if ENABLED(XYZ_HOLLOW_FRAME) + #define XYZ_FRAME_TOP 29 + #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3 + #else + #define XYZ_FRAME_TOP 30 + #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1 + #endif + + // Before homing the axis letters are blinking 'X' <-> '?'. + // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '. + // When everything is ok you see a constant 'X'. + + static char xstring[5], ystring[5], zstring[7]; + #if ENABLED(FILAMENT_LCD_DISPLAY) + static char wstring[5], mstring[4]; + #endif + + // At the first page, regenerate the XYZ strings + if (page.page == 0) { + strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); + strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); + strcpy(zstring, ftostr52sp(FIXFLOAT(LOGICAL_Z_POSITION(current_position[Z_AXIS])))); + #if ENABLED(FILAMENT_LCD_DISPLAY) + strcpy(wstring, ftostr12ns(filament_width_meas)); + strcpy(mstring, itostr3(100.0 * ( + parser.volumetric_enabled + ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] + : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] + ) + )); + #endif + } + + if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { + + #if ENABLED(XYZ_HOLLOW_FRAME) + u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39 + #else + u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37 + #endif + + if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) { + + #if DISABLED(XYZ_HOLLOW_FRAME) + u8g.setColorIndex(0); // white on black + #endif + + u8g.setPrintPos(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + _draw_axis_label(X_AXIS, PSTR(MSG_X), blink); + u8g.setPrintPos(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + lcd_print(xstring); + + u8g.setPrintPos(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); + u8g.setPrintPos(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + lcd_print(ystring); + + u8g.setPrintPos(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); + u8g.setPrintPos(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + lcd_print(zstring); + + #if DISABLED(XYZ_HOLLOW_FRAME) + u8g.setColorIndex(1); // black on white + #endif + } + } + + // + // Feedrate + // + + if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) { + lcd_setFont(FONT_MENU); + u8g.setPrintPos(3, 50); + lcd_print(LCD_STR_FEEDRATE[0]); + + lcd_setFont(FONT_STATUSMENU); + u8g.setPrintPos(12, 50); + lcd_print(itostr3(feedrate_percentage)); + u8g.print('%'); + + // + // Filament sensor display if SD is disabled + // + #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) + u8g.setPrintPos(56, 50); + lcd_print(wstring); + u8g.setPrintPos(102, 50); + lcd_print(mstring); + u8g.print('%'); + lcd_setFont(FONT_MENU); + u8g.setPrintPos(47, 50); + lcd_print(LCD_STR_FILAM_DIA); + u8g.setPrintPos(93, 50); + lcd_print(LCD_STR_FILAM_MUL); + #endif + } + + // + // Status line + // + + #define STATUS_BASELINE (55 + INFO_FONT_HEIGHT) + + if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) { + u8g.setPrintPos(0, STATUS_BASELINE); + + #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line + lcd_implementation_status_message(blink); + } + else { + lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); + u8g.print(':'); + lcd_print(wstring); + lcd_printPGM(PSTR(" " LCD_STR_FILAM_MUL)); + u8g.print(':'); + lcd_print(mstring); + u8g.print('%'); + } + #else + lcd_implementation_status_message(blink); + #endif + } +} + +#endif // ULTRALCD_IMPL_STATUS_SCREEN_DOGM_H \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h similarity index 50% rename from Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h rename to Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index db66fc12f..cb38585ed 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -1,4 +1,4 @@ -/* +/** * Lightweight Status Screen for the RepRapDiscount Full * Graphics Smart Controller (ST7920-based 128x64 LCD) * @@ -14,33 +14,32 @@ * */ - /* This is an implementation of a status screen for the RepRapDiscount - * Full Graphics Smart Controller using native ST7920 commands rather - * than using U8Glib. - * - * This alternative status screen makes use of the built-in character - * generation capabilities of the ST7920 to update the status screen - * with less SPI traffic and CPU use. In particular: - * - * - The fan and bed animations are handled using custom characters - * that are stored in CGRAM. This allows for the animation to be - * updated by writing a single character to the text-buffer (DDRAM). - * - * - All the information in the status screen is text that is written - * to DDRAM, so the work of generating the bitmaps is offloaded to - * the ST7920 rather than being render by U8Glib on the MCU. - * - * - The graphics buffer (GDRAM) is only used for static graphics - * elements (nozzle and feedrate bitmaps) and for the progress - * bar, so updates are sporadic. - */ +/** + * Implementation of a Status Screen for the RepRapDiscount + * Full Graphics Smart Controller using native ST7920 commands + * instead of U8Glib. + * + * This alternative Status Screen makes use of the built-in character + * generation capabilities of the ST7920 to update the Status Screen + * with less SPI traffic and CPU use. In particular: + * + * - The fan and bed animations are handled using custom characters + * that are stored in CGRAM. This allows for the animation to be + * updated by writing a single character to the text-buffer (DDRAM). + * + * - All the information in the Status Screen is text that is written + * to DDRAM, so the work of generating the bitmaps is offloaded to + * the ST7920 rather than being render by U8Glib on the MCU. + * + * - The graphics buffer (GDRAM) is only used for static graphics + * elements (nozzle and feedrate bitmaps) and for the progress + * bar, so updates are sporadic. + */ + +#include "status_screen_lite_ST7920_class.h" #include "../../libs/duration_t.h" -typedef const __FlashStringHelper *progmem_str; - -#include "ultralcd_impl_st7920_lite_status_screen.h" - #define BUFFER_WIDTH 256 #define BUFFER_HEIGHT 32 @@ -51,8 +50,8 @@ typedef const __FlashStringHelper *progmem_str; ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; -void ST7920_Lite_Status_Screen::cmd(uint8_t cmd) { - if(!current_bits.synced || !current_bits.cmd) { +void ST7920_Lite_Status_Screen::cmd(const uint8_t cmd) { + if (!current_bits.synced || !current_bits.cmd) { current_bits.synced = true; current_bits.cmd = true; sync_cmd(); @@ -62,47 +61,34 @@ void ST7920_Lite_Status_Screen::cmd(uint8_t cmd) { void ST7920_Lite_Status_Screen::begin_data() { extended_function_set(false); - if(!current_bits.synced || current_bits.cmd) { + if (!current_bits.synced || current_bits.cmd) { current_bits.synced = true; current_bits.cmd = false; sync_dat(); } } -void ST7920_Lite_Status_Screen::write_word(uint16_t w) { - write_byte((w >> 8) & 0xFF); - write_byte((w >> 0) & 0xFF); -} - void ST7920_Lite_Status_Screen::write_str(const char *str) { - while(*str) { - write_byte(*str++); - } + while (*str) write_byte(*str++); } void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { - while(*str && len--) { - write_byte(*str++); - } + while (*str && len--) write_byte(*str++); } -void ST7920_Lite_Status_Screen::write_str_P(const char *str) { +void ST7920_Lite_Status_Screen::write_str_P(const char * const str) { const char *p_str = (const char *)str; - char c = pgm_read_byte_near(p_str++); - while(c) { - write_byte(c); - c = pgm_read_byte_near(p_str++); - } + while (char c = pgm_read_byte_near(p_str++)) write_byte(c); } void ST7920_Lite_Status_Screen::write_str(progmem_str str) { write_str_P((const char*)str); } -void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits) { - char str[7]; +void ST7920_Lite_Status_Screen::write_number(const uint8_t value, const uint8_t digits/*=3*/) { + char str[7]; const char *fmt; - switch(digits) { + switch (digits) { case 6: fmt = PSTR("%6d"); break; case 5: fmt = PSTR("%5d"); break; case 4: fmt = PSTR("%4d"); break; @@ -110,11 +96,11 @@ void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits) { case 2: fmt = PSTR("%2d"); break; case 1: fmt = PSTR("%1d"); break; } - sprintf_P(str,fmt,value); + sprintf_P(str, fmt, value); write_str(str); } -void ST7920_Lite_Status_Screen::display_status(bool display_on, bool cursor_on, bool blink_on) { +void ST7920_Lite_Status_Screen::display_status(const bool display_on, const bool cursor_on, const bool blink_on) { extended_function_set(false); cmd(0b00001000 | (display_on ? 0b0100 : 0) | @@ -126,7 +112,7 @@ void ST7920_Lite_Status_Screen::display_status(bool display_on, bool cursor_on, // Sets the extended and graphics bits simultaneously, regardless of // the current state. This is a helper function for extended_function_set() // and graphics() -void ST7920_Lite_Status_Screen::_extended_function_set(bool extended, bool graphics) { +void ST7920_Lite_Status_Screen::_extended_function_set(const bool extended, const bool graphics) { cmd( 0b00100000 | (extended ? 0b00000100 : 0) | (graphics ? 0b00000010 : 0) @@ -135,19 +121,17 @@ void ST7920_Lite_Status_Screen::_extended_function_set(bool extended, bool graph current_bits.graphics = graphics; } -void ST7920_Lite_Status_Screen::extended_function_set(bool extended) { - if(extended != current_bits.extended) { +void ST7920_Lite_Status_Screen::extended_function_set(const bool extended) { + if (extended != current_bits.extended) _extended_function_set(extended, current_bits.graphics); - } } -void ST7920_Lite_Status_Screen::graphics(bool graphics) { - if(graphics != current_bits.graphics) { +void ST7920_Lite_Status_Screen::graphics(const bool graphics) { + if (graphics != current_bits.graphics) _extended_function_set(current_bits.extended, graphics); - } } -void ST7920_Lite_Status_Screen::entry_mode_select(bool ac_increase, bool shift) { +void ST7920_Lite_Status_Screen::entry_mode_select(const bool ac_increase, const bool shift) { extended_function_set(false); cmd(0b00000100 | (ac_increase ? 0b00000010 : 0) | @@ -157,7 +141,7 @@ void ST7920_Lite_Status_Screen::entry_mode_select(bool ac_increase, bool shift) // Sets the sa bit regardless of the current state. This is a helper // function for scroll_or_addr_select() -void ST7920_Lite_Status_Screen::_scroll_or_addr_select(bool sa) { +void ST7920_Lite_Status_Screen::_scroll_or_addr_select(const bool sa) { extended_function_set(true); cmd(0b00100010 | (sa ? 0b000001 : 0) @@ -165,23 +149,22 @@ void ST7920_Lite_Status_Screen::_scroll_or_addr_select(bool sa) { current_bits.sa = sa; } -void ST7920_Lite_Status_Screen::scroll_or_addr_select(bool sa) { - if(sa != current_bits.sa) { +void ST7920_Lite_Status_Screen::scroll_or_addr_select(const bool sa) { + if (sa != current_bits.sa) _scroll_or_addr_select(sa); - } } -void ST7920_Lite_Status_Screen::set_ddram_address(uint8_t addr) { +void ST7920_Lite_Status_Screen::set_ddram_address(const uint8_t addr) { extended_function_set(false); cmd(0b10000000 | (addr & 0b00111111)); } -void ST7920_Lite_Status_Screen::set_cgram_address(uint8_t addr) { +void ST7920_Lite_Status_Screen::set_cgram_address(const uint8_t addr) { extended_function_set(false); cmd(0b01000000 | (addr & 0b00111111)); } -void ST7920_Lite_Status_Screen::set_gdram_address(uint8_t x, uint8_t y) { +void ST7920_Lite_Status_Screen::set_gdram_address(const uint8_t x, const uint8_t y) { extended_function_set(true); cmd(0b10000000 | (y & 0b01111111)); cmd(0b10000000 | (x & 0b00001111)); @@ -199,60 +182,193 @@ void ST7920_Lite_Status_Screen::home() { } /* This fills the entire text buffer with spaces */ -void ST7920_Lite_Status_Screen::clear_ddram() -{ +void ST7920_Lite_Status_Screen::clear_ddram() { set_ddram_address(DDRAM_LINE_1); begin_data(); - for(int i=0; i < 64;i++) { - write_byte(' '); - } + for (uint8_t i = 64; i--;) write_byte(' '); } /* This fills the entire graphics buffer with zeros */ -void ST7920_Lite_Status_Screen::clear_gdram() -{ - for(int y = 0; y < BUFFER_HEIGHT; y++) { - set_gdram_address(0,y); +void ST7920_Lite_Status_Screen::clear_gdram() { + for (uint8_t y = 0; y < BUFFER_HEIGHT; y++) { + set_gdram_address(0, y); begin_data(); - for(int i = 0; i < (BUFFER_WIDTH / 16); i++) { - write_byte(0); - write_byte(0); - } + for (uint8_t i = (BUFFER_WIDTH) / 16; i--;) write_word(0); } } -void ST7920_Lite_Status_Screen::load_cgram_icon(uint16_t addr, const void *data) { +void ST7920_Lite_Status_Screen::load_cgram_icon(const uint16_t addr, const void *data) { const uint16_t *p_word = (const uint16_t *)data; set_cgram_address(addr); begin_data(); - for(int i = 0; i < 16; i++) { - uint16_t word = pgm_read_word_near(p_word++); - write_byte((word & 0xFF00) >> 8); - write_byte((word & 0x00FF) >> 0); - } + for (uint8_t i = 16; i--;) + write_word(pgm_read_word_near(p_word++)); } -/* Draws an icon in GDRAM. The position is specified in - as if they were DDRAM coordinates, i.e. the x position - is [1-8], while the y position is [1-4] */ +/** + * Draw an icon in GDRAM. Position specified in DDRAM + * coordinates. i.e., X from 1 to 8, Y from 1 to 4. + */ void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { const uint16_t *p_word = (const uint16_t *)data; - if(y > 2) { - // Handle display folding + if (y > 2) { // Handle display folding y -= 2; x += 8; } - x -= 1; - y -= 1; - for(int i = 0; i < 16; i++) { - uint16_t word = pgm_read_word_near(p_word++); - set_gdram_address(x,i+y*16); + --x; + --y; + for (int i = 0; i < 16; i++) { + set_gdram_address(x, i + y * 16); begin_data(); - write_byte((word & 0xFF00) >> 8); - write_byte((word & 0x00FF) >> 0); + write_word(pgm_read_word_near(p_word++)); } } +/************************** ICON DEFINITIONS *************************************/ + +#define CGRAM_ICON_1_ADDR 0x00 +#define CGRAM_ICON_2_ADDR 0x10 +#define CGRAM_ICON_3_ADDR 0x20 +#define CGRAM_ICON_4_ADDR 0x30 + +#define CGRAM_ICON_1_WORD 0x00 +#define CGRAM_ICON_2_WORD 0x02 +#define CGRAM_ICON_3_WORD 0x04 +#define CGRAM_ICON_4_WORD 0x06 + +const uint16_t nozzle_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000111111110000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000011111100000, + 0b0000001111000000, + 0b0000000110000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t bed_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0111111111111110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t heat1_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t heat2_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t fan1_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110001111000110, + 0b0100001111000010, + 0b0100000110000010, + 0b0101100000011010, + 0b0101110110111010, + 0b0101100000011010, + 0b0100000110000010, + 0b0100001111000010, + 0b0110001111000110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t fan2_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110010000100110, + 0b0100111001110010, + 0b0101111001111010, + 0b0100110000110010, + 0b0100000110000010, + 0b0100110000110010, + 0b0101111001111010, + 0b0100111001110010, + 0b0110010000100110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t feedrate_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0111111011111000, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000011111000, + 0b0000000010001000, + 0b0000000010000100, + 0b0000000010000100, + 0b0000000010000010, + 0b0000000000000000, + 0b0000000000000000 +}; + /************************** MAIN SCREEN *************************************/ void ST7920_Lite_Status_Screen::draw_static_elements() { @@ -265,102 +381,100 @@ void ST7920_Lite_Status_Screen::draw_static_elements() { load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); // Draw the static icons in GDRAM - draw_gdram_icon(1,1,nozzle_icon); + draw_gdram_icon(1, 1, nozzle_icon); #if EXTRUDERS == 2 - draw_gdram_icon(1,2,nozzle_icon); + draw_gdram_icon(1, 2, nozzle_icon); #endif - draw_gdram_icon(6,2,feedrate_icon); - draw_gdram_icon(1,2,bed_icon); + draw_gdram_icon(6, 2, feedrate_icon); + draw_gdram_icon(1, 2, bed_icon); // Draw the initial fan icon draw_fan_icon(false); } -/* Although this is undocumented, the ST7920 allows the character +/** + * Although this is undocumented, the ST7920 allows the character * data buffer (DDRAM) to be used in conjunction with the graphics * bitmap buffer (CGRAM). The contents of the graphics buffer is * XORed with the data from the character generator. This allows * us to make the progess bar out of graphical data (the bar) and * text data (the percentage). */ -void ST7920_Lite_Status_Screen::draw_progress_bar(uint8_t value) { +void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) { #if EXTRUDERS == 1 // If we have only one extruder, draw a long progress bar on the third line - const int top = 1; // Top in pixels - const int bottom = 13; // Bottom in pixels - const int left = 8; // Left edge, in 16-bit words - const int width = 5; // Width of progress bar, in 16-bit words + const uint8_t top = 1, // Top in pixels + bottom = 13, // Bottom in pixels + left = 8, // Left edge, in 16-bit words + width = 5; // Width of progress bar, in 16-bit words #else - const int top = 16 + 1; // Top in pixels - const int bottom = 16 + 13; // Bottom in pixels - const int left = 5; // Left edge, in 16-bit words - const int width = 3; // Width of progress bar, in 16-bit words + const uint8_t top = 16 + 1, // Top in pixels + bottom = 16 + 13, // Bottom in pixels + left = 5, // Left edge, in 16-bit words + width = 3; // Width of progress bar, in 16-bit words #endif - const int char_pcnt = 100/width; // How many percent does each 16-bit word represent? + const uint8_t char_pcnt = 100 / width; // How many percent does each 16-bit word represent? // Draw the progress bar as a bitmap in CGRAM - - for(int y = top; y <= bottom; y++) { - set_gdram_address(left,y); + for (uint8_t y = top; y <= bottom; y++) { + set_gdram_address(left, y); begin_data(); - for(int x = 0; x < width; x++) { + for (uint8_t x = 0; x < width; x++) { uint16_t gfx_word = 0x0000; - if((x+1)*char_pcnt <= value) { - // Draw completely filled bytes - gfx_word = 0xFFFF; - } else if((x*char_pcnt) < value) { - // Draw partially filled bytes - gfx_word = int(0x8000) >> (value % char_pcnt)*16/char_pcnt; - } + if ((x + 1) * char_pcnt <= value) + gfx_word = 0xFFFF; // Draw completely filled bytes + else if ((x * char_pcnt) < value) + gfx_word = int(0x8000) >> (value % char_pcnt) * 16 / char_pcnt; // Draw partially filled bytes + // Draw the frame around the progress bar - if(y == top || y == bottom) { - // Draw top/bottom border - gfx_word = 0xFFFF; - } else if (x == (width-1)) { - // Draw right border - gfx_word |= 0x0001; - } else if (x == 0) { - // Draw left border - gfx_word |= 0x8000; - } + if (y == top || y == bottom) + gfx_word = 0xFFFF; // Draw top/bottom border + else if (x == width - 1) + gfx_word |= 0x0001; // Draw right border + else if (x == 0) + gfx_word |= 0x8000; // Draw left border write_word(gfx_word); } } // Draw the percentage as text in DDRAM - - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_3 + 1); - #else - set_ddram_address(DDRAM_LINE_2 + left); - #endif + set_ddram_address( + #if EXTRUDERS == 1 + DDRAM_LINE_3 + 1 + #else + DDRAM_LINE_2 + left + #endif + ); begin_data(); - if(value > 9) { - write_number(value,4); + if (value > 9) { + write_number(value, 4); write_str(F("% ")); - } else { - write_number(value,3); + } + else { + write_number(value, 3); write_str(F("% ")); } } -void ST7920_Lite_Status_Screen::draw_fan_icon(bool whichIcon) { - set_ddram_address(DDRAM_LINE_1+5); +void ST7920_Lite_Status_Screen::draw_fan_icon(const bool whichIcon) { + set_ddram_address(DDRAM_LINE_1 + 5); begin_data(); write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); } -void ST7920_Lite_Status_Screen::draw_heat_icon(bool whichIcon, bool heating) { - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2); - #else - set_ddram_address(DDRAM_LINE_3); - #endif +void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) { + set_ddram_address( + #if EXTRUDERS == 1 + DDRAM_LINE_2 + #else + DDRAM_LINE_3 + #endif + ); begin_data(); - if(heating) { + if (heating) write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); - } else { + else { write_byte(' '); write_byte(' '); } @@ -368,70 +482,72 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(bool whichIcon, bool heating) { #define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 1) -void ST7920_Lite_Status_Screen::draw_extruder_1_temp(uint8_t temp, uint8_t target) { - set_ddram_address(DDRAM_LINE_1+1); +void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const uint8_t temp, const uint8_t target) { + set_ddram_address(DDRAM_LINE_1 + 1); begin_data(); write_number(temp); - if(target && FAR(temp, target)) { + if (target && FAR(temp, target)) { write_str(F("\x1A")); write_number(target); - } else { - write_str(F(" ")); } + else + write_str(F(" ")); } -void ST7920_Lite_Status_Screen::draw_extruder_2_temp(uint8_t temp, uint8_t target) { - set_ddram_address(DDRAM_LINE_2+1); +void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const uint8_t temp, const uint8_t target) { + set_ddram_address(DDRAM_LINE_2 + 1); begin_data(); write_number(temp); - if(target && FAR(temp, target)) { + if (target && FAR(temp, target)) { write_str(F("\x1A")); write_number(target); - } else { - write_str(F(" ")); } + else + write_str(F(" ")); } -void ST7920_Lite_Status_Screen::draw_bed_temp(uint8_t temp, uint8_t target) { - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2+1); - #else - set_ddram_address(DDRAM_LINE_3+1); - #endif +void ST7920_Lite_Status_Screen::draw_bed_temp(const uint8_t temp, const uint8_t target) { + set_ddram_address( + #if EXTRUDERS == 1 + DDRAM_LINE_2 + 1 + #else + DDRAM_LINE_3 + 1 + #endif + ); begin_data(); write_number(temp); - if(target && FAR(temp, target)) { + if (target && FAR(temp, target)) { write_str(F("\x1A")); write_number(target); - } else { - write_str(F(" ")); } + else + write_str(F(" ")); } -void ST7920_Lite_Status_Screen::draw_fan_speed(uint8_t value) { - set_ddram_address(DDRAM_LINE_1+6); +void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) { + set_ddram_address(DDRAM_LINE_1 + 6); begin_data(); - write_number(value,4); + write_number(value, 4); } -void ST7920_Lite_Status_Screen::draw_print_time(uint32_t elapsed) { - const uint8_t hrs = elapsed/3600; - const uint8_t min = (elapsed/60)%60; - char str[7]; - sprintf_P(str,hrs > 99 ? PSTR("%03d:%02d") : PSTR(" %02d:%02d"),hrs,min); +void ST7920_Lite_Status_Screen::draw_print_time(const uint32_t elapsed) { + const uint8_t hrs = elapsed / 3600, + min = (elapsed / 60) % 60; + char str[7]; + sprintf_P(str, hrs > 99 ? PSTR("%03d:%02d") : PSTR(" %02d:%02d"), hrs, min); - set_ddram_address(DDRAM_LINE_3+5); + set_ddram_address(DDRAM_LINE_3 + 5); begin_data(); write_str(str); } -void ST7920_Lite_Status_Screen::draw_feedrate_percentage(uint8_t percentage) { +void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint8_t percentage) { // We only have enough room for the feedrate when // we have one extruder #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2+6); + set_ddram_address(DDRAM_LINE_2 + 6); begin_data(); - write_number(percentage,4); + write_number(percentage, 4); #endif } @@ -445,28 +561,26 @@ void ST7920_Lite_Status_Screen::draw_status_message(const char *str) { // Trim whitespace at the end of the str, as for some reason // messages like "Card Inserted" are padded with many spaces - while(str_len > 0 && str[str_len-1] == ' ') { - str_len--; - } + while (str_len > 0 && str[str_len - 1] == ' ') str_len--; - if(str_len <= lcd_len) { + if (str_len <= lcd_len) { // It all fits on the LCD without scrolling write_str(str); - } else { + } + else { // Print the message repeatedly until covering the LCD uint8_t c = status_scroll_pos; - for(uint8_t n = 0; n < lcd_len; n++) { + for (uint8_t n = 0; n < lcd_len; n++) { write_byte(c < str_len ? str[c] : ' '); c++; c %= str_len + padding; // Wrap around } // Scroll the message - if(status_scroll_pos == str_len + padding) { + if (status_scroll_pos == str_len + padding) status_scroll_pos = 0; - } else { + else status_scroll_pos++; - } } #else write_str(str, 16); @@ -503,7 +617,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; const float extruder_1_target = thermalManager.degTargetHotend(0); #if EXTRUDERS == 2 - const float extruder_2_target = thermalManager.degTargetHotend(1); + const float extruder_2_target = thermalManager.degTargetHotend(1); #endif const float bed_target = thermalManager.degTargetBed(); @@ -514,21 +628,19 @@ bool ST7920_Lite_Status_Screen::indicators_changed() { uint8_t(feedrate_perc) ^ uint8_t(fan_speed) ^ uint8_t(extruder_1_target) ^ -#if EXTRUDERS == 2 - uint8_t(extruder_2_target) ^ -#endif + #if EXTRUDERS == 2 + uint8_t(extruder_2_target) ^ + #endif uint8_t(bed_target); - if(last_checksum == checksum) { - return false; - } else { - last_checksum = checksum; - return true; - } + if (last_checksum == checksum) return false; + + last_checksum = checksum; + return true; } -void ST7920_Lite_Status_Screen::update_indicators(bool forceUpdate) { - if(forceUpdate || indicators_changed()) { +void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { + if (forceUpdate || indicators_changed()) { const bool blink = lcd_blink(); const duration_t elapsed = print_job_timer.duration(); const uint32_t seconds_elapsed = elapsed.value; @@ -537,15 +649,15 @@ void ST7920_Lite_Status_Screen::update_indicators(bool forceUpdate) { const float extruder_1_temp = thermalManager.degHotend(0); const float extruder_1_target = thermalManager.degTargetHotend(0); #if EXTRUDERS == 2 - const float extruder_2_temp = thermalManager.degHotend(1); - const float extruder_2_target = thermalManager.degTargetHotend(1); + const float extruder_2_temp = thermalManager.degHotend(1); + const float extruder_2_target = thermalManager.degTargetHotend(1); #endif const float bed_temp = thermalManager.degBed(); const float bed_target = thermalManager.degTargetBed(); draw_extruder_1_temp(extruder_1_temp, extruder_1_target); #if EXTRUDERS == 2 - draw_extruder_2_temp(extruder_2_temp, extruder_2_target); + draw_extruder_2_temp(extruder_2_temp, extruder_2_target); #endif draw_bed_temp(bed_temp, bed_target); draw_fan_speed(fan_speed); @@ -553,63 +665,49 @@ void ST7920_Lite_Status_Screen::update_indicators(bool forceUpdate) { draw_feedrate_percentage(feedrate_perc); // Update the fan and bed animations - if(fan_speed > 0) { - draw_fan_icon(blink); - } - if(bed_target > 0) { + if (fan_speed > 0) draw_fan_icon(blink); + if (bed_target > 0) draw_heat_icon(blink, true); - } else { + else draw_heat_icon(false, false); - } } } bool ST7920_Lite_Status_Screen::position_changed() { - const float x_pos = current_position[X_AXIS]; - const float y_pos = current_position[Y_AXIS]; - const float z_pos = current_position[Z_AXIS]; + const float x_pos = current_position[X_AXIS], + y_pos = current_position[Y_AXIS], + z_pos = current_position[Z_AXIS]; const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); static uint8_t last_checksum = 0; - if(last_checksum == checksum) { - return false; - } else { - last_checksum = checksum; - return true; - } + if (last_checksum == checksum) return false; + last_checksum = checksum; + return true; } bool ST7920_Lite_Status_Screen::status_changed() { uint8_t checksum = 0; - for(const char *p = lcd_status_message; *p; p++) { - checksum ^= *p; - } + for (const char *p = lcd_status_message; *p; p++) checksum ^= *p; static uint8_t last_checksum = 0; - if(last_checksum == checksum) { - return false; - } else { - last_checksum = checksum; - return true; - } + if (last_checksum == checksum) return false; + last_checksum = checksum; + return true; } bool ST7920_Lite_Status_Screen::blink_changed() { static uint8_t last_blink = 0; - const bool blink = lcd_blink(); - if(last_blink == blink) { - return false; - } else { - last_blink = blink; - return true; - } + if (last_blink == blink) return false; + last_blink = blink; + return true; } void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { static uint8_t countdown = 0; - /* There is only enough room in the display for either the + /** + * There is only enough room in the display for either the * status message or the position, not both, so we choose * one or another. Whenever the status message changes, * we show it for a number of consecutive seconds, but @@ -620,36 +718,35 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { * countdown = 1 -- Show status, until movement * countdown = 0 -- Show position */ - if( forceUpdate || status_changed() ) { + if (forceUpdate || status_changed()) { #if ENABLED(STATUS_MESSAGE_SCROLLING) status_scroll_pos = 0; #endif - if(lcd_strlen(lcd_status_message)) { - countdown = DELAY_TO_SHOW_POSITION; - } else { - countdown = 0; - } + #ifndef STATUS_EXPIRE_SECONDS + #define STATUS_EXPIRE_SECONDS 20 + #endif + countdown = lcd_strlen(lcd_status_message) ? STATUS_EXPIRE_SECONDS : 0; draw_status_message(lcd_status_message); blink_changed(); // Clear changed flag } - else if(countdown > 1 && blink_changed() ) { + else if (countdown > 1 && blink_changed()) { countdown--; #if ENABLED(STATUS_MESSAGE_SCROLLING) - draw_status_message(lcd_status_message); + draw_status_message(lcd_status_message); #endif } - else if(countdown > 0 && blink_changed() ) { - if(position_changed()) { + else if (countdown > 0 && blink_changed()) { + if (position_changed()) { countdown--; forceUpdate = true; } #if ENABLED(STATUS_MESSAGE_SCROLLING) - draw_status_message(lcd_status_message); + draw_status_message(lcd_status_message); #endif } - if(countdown == 0 && (forceUpdate || position_changed() || + if (countdown == 0 && (forceUpdate || position_changed() || #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - blink_changed() + blink_changed() #endif )) { draw_position( @@ -667,26 +764,27 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { } } -void ST7920_Lite_Status_Screen::update_progress(bool forceUpdate) { - #if ENABLED(SDSUPPORT) - const uint8_t percent_done = card.percentDone(); - #else - const uint8_t percent_done = 0; - #endif +void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { + const uint8_t percent_done = + #if ENABLED(SDSUPPORT) + card.percentDone() + #else + 0 + #endif + ; // Since the progress bar involves writing // quite a few bytes to GDRAM, only do this // when an update is actually necessary. static uint8_t last_progress = 0; - if(!forceUpdate && last_progress == percent_done) - return; + if (!forceUpdate && last_progress == percent_done) return; last_progress = percent_done; draw_progress_bar(percent_done); } -void ST7920_Lite_Status_Screen::update(bool forceUpdate) { +void ST7920_Lite_Status_Screen::update(const bool forceUpdate) { cs(); update_indicators(forceUpdate); update_status_or_position(forceUpdate); @@ -732,26 +830,23 @@ static void lcd_implementation_status_screen() { ST7920_Lite_Status_Screen::update(false); } -/* In order to properly update the lite status screen, +/** + * In order to properly update the lite Status Screen, * we must know when we have entered and left the - * status screen. Since the ultralcd code is not + * Status Screen. Since the ultralcd code is not * set up for doing this, we call this function before * each update indicating whether the current screen - * is the status screen. + * is the Status Screen. * * This function keeps track of whether we have left or - * entered the status screen and calls the on_entry() + * entered the Status Screen and calls the on_entry() * and on_exit() methods for cleanup. */ - -static void lcd_in_status(bool inStatus) { +static void lcd_in_status(const bool inStatus) { static bool lastInStatus = false; - if(!lastInStatus && inStatus) { + if (lastInStatus == inStatus) return; + if ((lastInStatus = inStatus)) ST7920_Lite_Status_Screen::on_entry(); - lastInStatus = true; - } - if(lastInStatus && !inStatus) { + else ST7920_Lite_Status_Screen::on_exit(); - lastInStatus = false; - } -} \ No newline at end of file +} diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h new file mode 100644 index 000000000..464f2f635 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h @@ -0,0 +1,108 @@ +/** + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#ifndef STATUS_SCREEN_LITE_ST7920_CLASS_H +#define STATUS_SCREEN_LITE_ST7920_CLASS_H + +#include "../../core/macros.h" + +typedef const __FlashStringHelper *progmem_str; + +class ST7920_Lite_Status_Screen { + private: + static struct st7920_state_t { + uint8_t synced : 1; // Whether a sync has been sent + uint8_t cmd : 1; // Whether the sync was cmd or data + uint8_t extended : 1; + uint8_t graphics : 1; + uint8_t sa : 1; + } current_bits; + + static void cs(); + static void ncs(); + static void sync_cmd(); + static void sync_dat(); + static void write_byte(const uint8_t w); + + FORCE_INLINE static void write_word(const uint16_t w) { + write_byte((w >> 8) & 0xFF); + write_byte((w >> 0) & 0xFF); + } + + static void cmd(const uint8_t cmd); + static void begin_data(); + + static void write_str(const char *str); + static void write_str(const char *str, const uint8_t len); + static void write_str_P(const char * const str); + static void write_str(progmem_str str); + static void write_number(const uint8_t value, const uint8_t digits=3); + + static void _extended_function_set(const bool extended, const bool graphics); + static void _scroll_or_addr_select(const bool sa); + static void reset_state_from_unknown(); + + static void home(); + static void display_status(const bool display_on, const bool cursor_on, const bool blink_on); + static void extended_function_set(const bool extended); + static void graphics(const bool graphics); + static void entry_mode_select(const bool ac_increase, const bool shift); + static void scroll_or_addr_select(const bool sa); + static void set_ddram_address(const uint8_t addr); + static void set_cgram_address(const uint8_t addr); + static void set_gdram_address(const uint8_t x, const uint8_t y); + + static void clear(); + static void clear_ddram(); + static void clear_gdram(); + + static void load_cgram_icon(const uint16_t addr, const void *data); + static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); + + static uint8_t string_checksum(const char *str); + + protected: + static void draw_static_elements(); + static void draw_progress_bar(const uint8_t value); + static void draw_fan_icon(const bool whichIcon); + static void draw_heat_icon(const bool whichIcon, const bool heating); + static void draw_extruder_1_temp(const uint8_t temp, const uint8_t target); + static void draw_extruder_2_temp(const uint8_t temp, const uint8_t target); + static void draw_bed_temp(const uint8_t temp, const uint8_t target); + static void draw_fan_speed(const uint8_t value); + static void draw_print_time(const uint32_t elapsed); + static void draw_feedrate_percentage(const uint8_t percentage); + static void draw_status_message(const char *str); + static void draw_position(const float x, const float y, const float z, bool position_known = true); + + static bool indicators_changed(); + static bool position_changed(); + static bool blink_changed(); + static bool status_changed(); + + static void update_indicators(const bool forceUpdate); + static void update_position(const bool forceUpdate, bool resetChecksum); + static void update_status_or_position(bool forceUpdate); + static void update_progress(const bool forceUpdate); + + public: + static void update(const bool forceUpdate); + static void on_entry(); + static void on_exit(); + static void clear_text_buffer(); +}; + +#endif // STATUS_SCREEN_LITE_ST7920_CLASS_H diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h similarity index 86% rename from Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h rename to Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h index 1a0a33be4..9c59068f4 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h @@ -1,4 +1,4 @@ -/* +/** * Lightweight Status Screen for the RepRapDiscount Full * Graphics Smart Controller (ST7920-based 128x64 LCD) * @@ -14,7 +14,7 @@ * */ -#include "ultralcd_impl_st7920_lite_status_screen.h" +#include "status_screen_lite_ST7920_class.h" void ST7920_Lite_Status_Screen::cs() { ST7920_CS(); @@ -34,6 +34,6 @@ void ST7920_Lite_Status_Screen::sync_dat() { ST7920_SET_DAT(); } -void ST7920_Lite_Status_Screen::write_byte(uint8_t data) { - ST7920_WRITE_NIBBLES(data); -} \ No newline at end of file +void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { + ST7920_WRITE_BYTE(data); +} diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h deleted file mode 100644 index dd3c71a1e..000000000 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Lightweight Status Screen for the RepRapDiscount Full - * Graphics Smart Controller (ST7920-based 128x64 LCD) - * - * (c) 2017 Aleph Objects, Inc. - * - * The code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - */ - -#ifndef ULTRALCD_ST7920_LITE_STATUS_H -#define ULTRALCD_ST7920_LITE_STATUS_H - -class ST7920_Lite_Status_Screen { - private: - static struct st7920_state_t { - uint8_t synced : 1; // Whether a sync has been sent - uint8_t cmd : 1; // Whether the sync was cmd or data - uint8_t extended : 1; - uint8_t graphics : 1; - uint8_t sa : 1; - } current_bits; - - static void cs(); - static void ncs(); - static void sync_cmd(); - static void sync_dat(); - static void write_byte(uint8_t w); - - static void cmd(uint8_t cmd); - static void begin_data(); - static void write_word(uint16_t w); - static void write_str(const char *str); - static void write_str(const char *str, uint8_t len); - static void write_str_P(const char *str); - static void write_str(progmem_str str); - static void write_number(uint8_t value, uint8_t digits=3); - - static void _extended_function_set(bool extended, bool graphics); - static void _scroll_or_addr_select(bool sa); - static void reset_state_from_unknown(); - - static void home(); - static void display_status(bool display_on, bool cursor_on, bool blink_on); - static void extended_function_set(bool extended); - static void graphics(bool graphics); - static void entry_mode_select(bool ac_increase, bool shift); - static void scroll_or_addr_select(bool sa); - static void set_ddram_address(uint8_t addr); - static void set_cgram_address(uint8_t addr); - static void set_gdram_address(uint8_t x, uint8_t y); - - static void clear(); - static void clear_ddram(); - static void clear_gdram(); - - static void load_cgram_icon(uint16_t addr, const void *data); - static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); - - static uint8_t string_checksum(const char *str); - - protected: - static void draw_static_elements(); - static void draw_progress_bar(uint8_t value); - static void draw_fan_icon(bool whichIcon); - static void draw_heat_icon(bool whichIcon, bool heating); - static void draw_extruder_1_temp(uint8_t temp, uint8_t target); - static void draw_extruder_2_temp(uint8_t temp, uint8_t target); - static void draw_bed_temp(uint8_t temp, uint8_t target); - static void draw_fan_speed(uint8_t value); - static void draw_print_time(uint32_t elapsed); - static void draw_feedrate_percentage(uint8_t percentage); - static void draw_status_message(const char *str); - static void draw_position(const float x, const float y, const float z, bool position_known = true); - - static bool indicators_changed(); - static bool position_changed(); - static bool blink_changed(); - static bool status_changed(); - - static void update_indicators(bool forceUpdate); - static void update_position(bool forceUpdate, bool resetChecksum); - static void update_status_or_position(bool forceUpdate); - static void update_progress(bool forceUpdate); - - public: - static void update(bool forceUpdate); - static void on_entry(); - static void on_exit(); - static void clear_text_buffer(); -}; - -/************************** ICON DEFINITIONS *************************************/ - -#define CGRAM_ICON_1_ADDR 0x00 -#define CGRAM_ICON_2_ADDR 0x10 -#define CGRAM_ICON_3_ADDR 0x20 -#define CGRAM_ICON_4_ADDR 0x30 - -#define CGRAM_ICON_1_WORD 0x00 -#define CGRAM_ICON_2_WORD 0x02 -#define CGRAM_ICON_3_WORD 0x04 -#define CGRAM_ICON_4_WORD 0x06 - -PROGMEM const uint16_t nozzle_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000111111110000, - 0b0001111111111000, - 0b0001111111111000, - 0b0001111111111000, - 0b0000111111110000, - 0b0000111111110000, - 0b0001111111111000, - 0b0001111111111000, - 0b0001111111111000, - 0b0000011111100000, - 0b0000001111000000, - 0b0000000110000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t bed_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0111111111111110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t heat1_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t heat2_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t fan1_icon[] = { - 0b0000000000000000, - 0b0111111111111110, - 0b0111000000001110, - 0b0110001111000110, - 0b0100001111000010, - 0b0100000110000010, - 0b0101100000011010, - 0b0101110110111010, - 0b0101100000011010, - 0b0100000110000010, - 0b0100001111000010, - 0b0110001111000110, - 0b0111000000001110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t fan2_icon[] = { - 0b0000000000000000, - 0b0111111111111110, - 0b0111000000001110, - 0b0110010000100110, - 0b0100111001110010, - 0b0101111001111010, - 0b0100110000110010, - 0b0100000110000010, - 0b0100110000110010, - 0b0101111001111010, - 0b0100111001110010, - 0b0110010000100110, - 0b0111000000001110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t feedrate_icon[] = { - 0b0000000000000000, - 0b0111111000000000, - 0b0100000000000000, - 0b0100000000000000, - 0b0100000000000000, - 0b0111111011111000, - 0b0100000010000100, - 0b0100000010000100, - 0b0100000010000100, - 0b0100000011111000, - 0b0000000010001000, - 0b0000000010000100, - 0b0000000010000100, - 0b0000000010000010, - 0b0000000000000000, - 0b0000000000000000 -}; - -static void lcd_implementation_status_screen(); -static void lcd_in_status(bool inStatus); - -#endif // ULTRALCD_ST7920_LITE_STATUS_H \ No newline at end of file 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 39a3cc17a..c1bc4a2fc 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -183,12 +183,10 @@ 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; - +#if ENABLED(LIGHTWEIGHT_UI) // 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" + #include "status_screen_lite_ST7920_spi.h" #endif #pragma GCC reset_options diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index b7a66e894..db13c3c3f 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -5116,23 +5116,19 @@ void lcd_update() { #endif #if ENABLED(DOGLCD) - #if defined(USE_ST7920_LIGHTWEIGHT_UI) + #if ENABLED(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; - } + const bool in_status = currentScreen == lcd_status_screen; #else - const bool do_U8G_loop = false; - lcd_in_status(true); - lcd_status_screen(); + 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 - const bool do_U8G_loop = true; + constexpr bool do_u8g_loop = true; #endif - if(do_U8G_loop) { + 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 diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h index 2ec7432c5..1be6084ed 100644 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ b/Marlin/src/lcd/ultralcd_impl_DOGM.h @@ -54,11 +54,6 @@ #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 @@ -348,6 +343,12 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { #endif // SHOW_BOOTSCREEN +#if ENABLED(LIGHTWEIGHT_UI) + #include "dogm/status_screen_lite_ST7920.h" +#else + #include "dogm/status_screen_DOGM.h" +#endif + // Initialize or re-initialize the LCD static void lcd_implementation_init() { @@ -378,7 +379,7 @@ static void lcd_implementation_init() { // The kill screen is displayed for unrecoverable conditions void lcd_kill_screen() { - #if ENABLED(USE_ST7920_LIGHTWEIGHT_UI) + #if ENABLED(LIGHTWEIGHT_UI) ST7920_Lite_Status_Screen::clear_text_buffer(); #endif const uint8_t h4 = u8g.getHeight() / 4; @@ -396,422 +397,6 @@ void lcd_kill_screen() { void lcd_implementation_clear() { } // Automatically cleared by Picture Loop -// -// Status Screen -// - -FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { - const char * const str = itostr3(temp); - u8g.setPrintPos(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y); - lcd_print(str); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); -} - -#ifndef HEAT_INDICATOR_X - #define HEAT_INDICATOR_X 8 -#endif - -FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) { - #if !HEATER_IDLE_HANDLER - UNUSED(blink); - #endif - - #if HAS_TEMP_BED - const bool isBed = heater < 0; - #else - constexpr bool isBed = false; - #endif - - if (PAGE_UNDER(7)) { - #if HEATER_IDLE_HANDLER - const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : - #if HAS_TEMP_BED - thermalManager.is_bed_idle() - #else - false - #endif - ); - - if (blink || !is_idle) - #endif - _draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); } - - if (PAGE_CONTAINS(21, 28)) - _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28); - - if (PAGE_CONTAINS(17, 20)) { - const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X, - y = isBed ? 18 : 17; - if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) { - u8g.setColorIndex(0); // white on black - u8g.drawBox(x + h, y, 2, 2); - u8g.setColorIndex(1); // black on white - } - else { - u8g.drawBox(x + h, y, 2, 2); - } - } -} - -FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) { - if (blink) - lcd_printPGM(pstr); - else { - if (!axis_homed[axis]) - u8g.print('?'); - else { - #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[axis]) - u8g.print(' '); - else - #endif - lcd_printPGM(pstr); - } - } -} - -inline void lcd_implementation_status_message(const bool blink) { - #if ENABLED(STATUS_MESSAGE_SCROLLING) - static bool last_blink = false; - const uint8_t slen = lcd_strlen(lcd_status_message); - const char *stat = lcd_status_message + status_scroll_pos; - if (slen <= LCD_WIDTH) - lcd_print_utf(stat); // The string isn't scrolling - else { - if (status_scroll_pos <= slen - LCD_WIDTH) - lcd_print_utf(stat); // The string fills the screen - else { - uint8_t chars = LCD_WIDTH; - if (status_scroll_pos < slen) { // First string still visible - lcd_print_utf(stat); // The string leaves space - chars -= slen - status_scroll_pos; // Amount of space left - } - u8g.print('.'); // Always at 1+ spaces left, draw a dot - if (--chars) { - if (status_scroll_pos < slen + 1) // Draw a second dot if there's space - --chars, u8g.print('.'); - if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message - } - } - if (last_blink != blink) { - last_blink = blink; - // Skip any non-printing bytes - if (status_scroll_pos < slen) while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++; - if (++status_scroll_pos >= slen + 2) status_scroll_pos = 0; - } - } - #else - UNUSED(blink); - lcd_print_utf(lcd_status_message); - #endif -} - -#if !ENABLED(USE_ST7920_LIGHTWEIGHT_UI) -static void lcd_implementation_status_screen() { - - const bool blink = lcd_blink(); - - #if FAN_ANIM_FRAMES > 2 - static bool old_blink; - static uint8_t fan_frame; - if (old_blink != blink) { - old_blink = blink; - if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; - } - #endif - - // Status Menu Font - lcd_setFont(FONT_STATUSMENU); - - // - // Fan Animation - // - // Draws the whole heading image as a B/W bitmap rather than - // drawing the elements separately. - // This was done as an optimization, as it was slower to draw - // multiple parts compared to a single bitmap. - // - // The bitmap: - // - May be offset in X - // - Includes all nozzle(s), bed(s), and the fan. - // - // TODO: - // - // - Only draw the whole header on the first - // entry to the status screen. Nozzle, bed, and - // fan outline bits don't change. - // - if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { - - u8g.drawBitmapP( - STATUS_SCREEN_X, STATUS_SCREEN_Y, - (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, - #if HAS_FAN0 - #if FAN_ANIM_FRAMES > 2 - fan_frame == 1 ? status_screen1_bmp : - fan_frame == 2 ? status_screen2_bmp : - #if FAN_ANIM_FRAMES > 3 - fan_frame == 3 ? status_screen3_bmp : - #endif - #else - blink && fanSpeeds[0] ? status_screen1_bmp : - #endif - #endif - status_screen0_bmp - ); - - } - - // - // Temperature Graphics and Info - // - - if (PAGE_UNDER(28)) { - // Extruders - HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); - - // Heated bed - #if HOTENDS < 4 && HAS_TEMP_BED - _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); - #endif - - #if HAS_FAN0 - if (PAGE_CONTAINS(20, 27)) { - // Fan - const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256; - if (per) { - u8g.setPrintPos(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y); - lcd_print(itostr3(per)); - u8g.print('%'); - } - } - #endif - } - - #if ENABLED(SDSUPPORT) - // - // SD Card Symbol - // - if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { - // Upper box - u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) - // Right edge - u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47) - // Bottom hollow box - u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51) - // Corner pixel - u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42) - } - #endif // SDSUPPORT - - #if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) - // - // Progress bar frame - // - #define PROGRESS_BAR_X 54 - #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) - - if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51) - u8g.drawFrame( - PROGRESS_BAR_X, 49, - PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) - ); - - #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - const uint8_t progress_bar_percent = card.percentDone(); - #endif - - if (progress_bar_percent > 1) { - - // - // Progress bar solid part - // - - if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) - u8g.drawBox( - PROGRESS_BAR_X + 1, 50, - (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) - ); - - // - // SD Percent Complete - // - - #if ENABLED(DOGM_SD_PERCENT) - if (PAGE_CONTAINS(41, 48)) { - // Percent complete - u8g.setPrintPos(55, 48); - u8g.print(itostr3(progress_bar_percent)); - u8g.print('%'); - } - #endif - } - - // - // Elapsed Time - // - - #if DISABLED(DOGM_SD_PERCENT) - #define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2)) - #else - #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH) - #endif - - if (PAGE_CONTAINS(41, 48)) { - char buffer[10]; - duration_t elapsed = print_job_timer.duration(); - bool has_days = (elapsed.value >= 60*60*24L); - uint8_t len = elapsed.toDigital(buffer, has_days); - u8g.setPrintPos(SD_DURATION_X, 48); - lcd_print(buffer); - } - - #endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY - - // - // XYZ Coordinates - // - - #if ENABLED(USE_SMALL_INFOFONT) - #define INFO_FONT_HEIGHT 7 - #else - #define INFO_FONT_HEIGHT 8 - #endif - - #define XYZ_BASELINE (30 + INFO_FONT_HEIGHT) - - #define X_LABEL_POS 3 - #define X_VALUE_POS 11 - #define XYZ_SPACING 40 - - #if ENABLED(XYZ_HOLLOW_FRAME) - #define XYZ_FRAME_TOP 29 - #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3 - #else - #define XYZ_FRAME_TOP 30 - #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1 - #endif - - // Before homing the axis letters are blinking 'X' <-> '?'. - // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '. - // When everything is ok you see a constant 'X'. - - static char xstring[5], ystring[5], zstring[7]; - #if ENABLED(FILAMENT_LCD_DISPLAY) - static char wstring[5], mstring[4]; - #endif - - // At the first page, regenerate the XYZ strings - if (page.page == 0) { - strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); - strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); - strcpy(zstring, ftostr52sp(FIXFLOAT(LOGICAL_Z_POSITION(current_position[Z_AXIS])))); - #if ENABLED(FILAMENT_LCD_DISPLAY) - strcpy(wstring, ftostr12ns(filament_width_meas)); - strcpy(mstring, itostr3(100.0 * ( - parser.volumetric_enabled - ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] - : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] - ) - )); - #endif - } - - if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { - - #if ENABLED(XYZ_HOLLOW_FRAME) - u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39 - #else - u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37 - #endif - - if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) { - - #if DISABLED(XYZ_HOLLOW_FRAME) - u8g.setColorIndex(0); // white on black - #endif - - u8g.setPrintPos(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - _draw_axis_label(X_AXIS, PSTR(MSG_X), blink); - u8g.setPrintPos(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - lcd_print(xstring); - - u8g.setPrintPos(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); - u8g.setPrintPos(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - lcd_print(ystring); - - u8g.setPrintPos(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); - u8g.setPrintPos(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - lcd_print(zstring); - - #if DISABLED(XYZ_HOLLOW_FRAME) - u8g.setColorIndex(1); // black on white - #endif - } - } - - // - // Feedrate - // - - if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) { - lcd_setFont(FONT_MENU); - u8g.setPrintPos(3, 50); - lcd_print(LCD_STR_FEEDRATE[0]); - - lcd_setFont(FONT_STATUSMENU); - u8g.setPrintPos(12, 50); - lcd_print(itostr3(feedrate_percentage)); - u8g.print('%'); - - // - // Filament sensor display if SD is disabled - // - #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) - u8g.setPrintPos(56, 50); - lcd_print(wstring); - u8g.setPrintPos(102, 50); - lcd_print(mstring); - u8g.print('%'); - lcd_setFont(FONT_MENU); - u8g.setPrintPos(47, 50); - lcd_print(LCD_STR_FILAM_DIA); - u8g.setPrintPos(93, 50); - lcd_print(LCD_STR_FILAM_MUL); - #endif - } - - // - // Status line - // - - #define STATUS_BASELINE (55 + INFO_FONT_HEIGHT) - - if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) { - u8g.setPrintPos(0, STATUS_BASELINE); - - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line - lcd_implementation_status_message(blink); - } - else { - lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); - u8g.print(':'); - lcd_print(wstring); - lcd_printPGM(PSTR(" " LCD_STR_FILAM_MUL)); - u8g.print(':'); - lcd_print(mstring); - u8g.print('%'); - } - #else - lcd_implementation_status_message(blink); - #endif - } -} -#endif - #if ENABLED(ULTIPANEL) uint8_t row_y1, row_y2; From aada1e698fe35abdf341f6a1f5abc622a70d44a9 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Mon, 19 Feb 2018 16:14:33 -0700 Subject: [PATCH 06/12] Removed unused configuration options. --- Marlin/Configuration.h | 13 ++----------- Marlin/src/config/default/Configuration.h | 11 ----------- .../examples/AliExpress/CL-260/Configuration.h | 11 ----------- Marlin/src/config/examples/Anet/A6/Configuration.h | 11 ----------- Marlin/src/config/examples/Anet/A8/Configuration.h | 12 ------------ .../examples/BIBO/TouchX/cyclops/Configuration.h | 11 ----------- .../examples/BIBO/TouchX/default/Configuration.h | 11 ----------- .../examples/FolgerTech/i3-2020/Configuration.h | 12 +----------- .../examples/Infitary/i3-M508/Configuration.h | 11 ----------- .../src/config/examples/JGAurora/A5/Configuration.h | 11 ----------- Marlin/src/config/examples/RigidBot/Configuration.h | 12 ------------ Marlin/src/config/examples/STM32F10/Configuration.h | 11 ----------- .../config/examples/Sanguinololu/Configuration.h | 11 ----------- .../src/config/examples/Tronxy/X1/Configuration.h | 11 ----------- .../src/config/examples/Tronxy/X5S/Configuration.h | 11 ----------- .../config/examples/Velleman/K8200/Configuration.h | 11 ----------- .../config/examples/Velleman/K8400/Configuration.h | 11 ----------- .../Velleman/K8400/Dual-head/Configuration.h | 11 ----------- .../examples/delta/kossel_mini/Configuration.h | 11 ----------- .../examples/gCreate/gMax1.5+/Configuration.h | 11 ----------- Marlin/src/config/examples/makibox/Configuration.h | 11 ----------- 21 files changed, 3 insertions(+), 233 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 126fdc089..457fdccf5 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1513,18 +1513,9 @@ // 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 +#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER + // // MakerLab Mini Panel with graphic diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index 126fdc089..906765503 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -1513,18 +1513,7 @@ // 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 56ae68867..629a2373a 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -1513,18 +1513,7 @@ // 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 e1c3ac694..a477a1c41 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -1661,18 +1661,7 @@ // 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/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index b303b158f..5cf5e3ac2 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -1525,18 +1525,6 @@ // //#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 0df628236..b8712d93e 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -1513,18 +1513,7 @@ 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 ca6c4ca7c..0c3da3940 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -1513,18 +1513,7 @@ 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 2848e71fe..046b1c75c 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -1519,18 +1519,8 @@ // 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 77bd20aa6..555e22fe1 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -1517,18 +1517,7 @@ // 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 ce0d3e69b..077733ca9 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h @@ -1524,18 +1524,7 @@ // 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 09d4837c5..376c94977 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -1515,18 +1515,6 @@ // //#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 04282211b..affc79667 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/Configuration.h @@ -1516,18 +1516,7 @@ // 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 40d6d4c9f..239cf8d65 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -1544,18 +1544,7 @@ // 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 3e6554299..e74543b69 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -1498,18 +1498,7 @@ // 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 aa562a5a5..38a6a31d1 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h @@ -1513,18 +1513,7 @@ // 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 108ee285e..ecc36d717 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -1546,18 +1546,7 @@ // 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 7d5038c78..5e6092b26 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -1513,18 +1513,7 @@ // 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 662b1ba1c..2e0c436c2 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -1507,18 +1507,7 @@ // 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 976a2bac4..6ebfebf86 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -1637,18 +1637,7 @@ // 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 d52ab8a2f..9053afb07 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -1527,18 +1527,7 @@ // 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 6ec77ec43..d063628ea 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -1516,18 +1516,7 @@ // 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 From 9d5968e8ecc70e4c54d5d3833d2d5be638dcfc91 Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Tue, 20 Feb 2018 13:34:34 -0700 Subject: [PATCH 07/12] Fixed dual-extruder in Lightweight UI. - Moved bed icon down when the machine is configured with two nozzles. --- .../lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h index db66fc12f..92a6cf593 100644 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h +++ b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h @@ -268,9 +268,11 @@ void ST7920_Lite_Status_Screen::draw_static_elements() { draw_gdram_icon(1,1,nozzle_icon); #if EXTRUDERS == 2 draw_gdram_icon(1,2,nozzle_icon); + draw_gdram_icon(1,3,bed_icon); + #else + draw_gdram_icon(1,2,bed_icon); #endif draw_gdram_icon(6,2,feedrate_icon); - draw_gdram_icon(1,2,bed_icon); // Draw the initial fan icon draw_fan_icon(false); From 716a22498f31f0fedf45d5d69587e8e0c4e8f70f Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 21 Feb 2018 10:15:55 -0700 Subject: [PATCH 08/12] Changed temp type from uint8_t to int16_t - Also deleted old implementation files which had been renamed. --- Marlin/Configuration.h | 2 +- .../src/lcd/dogm/status_screen_lite_ST7920.h | 8 +- .../dogm/status_screen_lite_ST7920_class.h | 8 +- .../ultralcd_impl_st7920_lite_status_screen.h | 247 ------ ...alcd_impl_st7920_lite_status_screen_impl.h | 759 ------------------ ..._impl_st7920_lite_status_screen_impl_spi.h | 39 - 6 files changed, 9 insertions(+), 1054 deletions(-) delete mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h delete mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h delete mode 100644 Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 457fdccf5..a20937436 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1514,7 +1514,7 @@ // http://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller // -#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +//#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER // diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index cb38585ed..ccc046e7d 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -85,7 +85,7 @@ void ST7920_Lite_Status_Screen::write_str(progmem_str str) { write_str_P((const char*)str); } -void ST7920_Lite_Status_Screen::write_number(const uint8_t value, const uint8_t digits/*=3*/) { +void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) { char str[7]; const char *fmt; switch (digits) { @@ -482,7 +482,7 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool #define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 1) -void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const uint8_t temp, const uint8_t target) { +void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const int16_t temp, const int16_t target) { set_ddram_address(DDRAM_LINE_1 + 1); begin_data(); write_number(temp); @@ -494,7 +494,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const uint8_t temp, const u write_str(F(" ")); } -void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const uint8_t temp, const uint8_t target) { +void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const int16_t target) { set_ddram_address(DDRAM_LINE_2 + 1); begin_data(); write_number(temp); @@ -506,7 +506,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const uint8_t temp, const u write_str(F(" ")); } -void ST7920_Lite_Status_Screen::draw_bed_temp(const uint8_t temp, const uint8_t target) { +void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target) { set_ddram_address( #if EXTRUDERS == 1 DDRAM_LINE_2 + 1 diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h index 464f2f635..5812e4751 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h @@ -49,7 +49,7 @@ class ST7920_Lite_Status_Screen { static void write_str(const char *str, const uint8_t len); static void write_str_P(const char * const str); static void write_str(progmem_str str); - static void write_number(const uint8_t value, const uint8_t digits=3); + static void write_number(const int16_t value, const uint8_t digits=3); static void _extended_function_set(const bool extended, const bool graphics); static void _scroll_or_addr_select(const bool sa); @@ -79,9 +79,9 @@ class ST7920_Lite_Status_Screen { static void draw_progress_bar(const uint8_t value); static void draw_fan_icon(const bool whichIcon); static void draw_heat_icon(const bool whichIcon, const bool heating); - static void draw_extruder_1_temp(const uint8_t temp, const uint8_t target); - static void draw_extruder_2_temp(const uint8_t temp, const uint8_t target); - static void draw_bed_temp(const uint8_t temp, const uint8_t target); + static void draw_extruder_1_temp(const int16_t temp, const int16_t target); + static void draw_extruder_2_temp(const int16_t temp, const int16_t target); + static void draw_bed_temp(const int16_t temp, const int16_t target); static void draw_fan_speed(const uint8_t value); static void draw_print_time(const uint32_t elapsed); static void draw_feedrate_percentage(const uint8_t percentage); diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h deleted file mode 100644 index dd3c71a1e..000000000 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Lightweight Status Screen for the RepRapDiscount Full - * Graphics Smart Controller (ST7920-based 128x64 LCD) - * - * (c) 2017 Aleph Objects, Inc. - * - * The code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - */ - -#ifndef ULTRALCD_ST7920_LITE_STATUS_H -#define ULTRALCD_ST7920_LITE_STATUS_H - -class ST7920_Lite_Status_Screen { - private: - static struct st7920_state_t { - uint8_t synced : 1; // Whether a sync has been sent - uint8_t cmd : 1; // Whether the sync was cmd or data - uint8_t extended : 1; - uint8_t graphics : 1; - uint8_t sa : 1; - } current_bits; - - static void cs(); - static void ncs(); - static void sync_cmd(); - static void sync_dat(); - static void write_byte(uint8_t w); - - static void cmd(uint8_t cmd); - static void begin_data(); - static void write_word(uint16_t w); - static void write_str(const char *str); - static void write_str(const char *str, uint8_t len); - static void write_str_P(const char *str); - static void write_str(progmem_str str); - static void write_number(uint8_t value, uint8_t digits=3); - - static void _extended_function_set(bool extended, bool graphics); - static void _scroll_or_addr_select(bool sa); - static void reset_state_from_unknown(); - - static void home(); - static void display_status(bool display_on, bool cursor_on, bool blink_on); - static void extended_function_set(bool extended); - static void graphics(bool graphics); - static void entry_mode_select(bool ac_increase, bool shift); - static void scroll_or_addr_select(bool sa); - static void set_ddram_address(uint8_t addr); - static void set_cgram_address(uint8_t addr); - static void set_gdram_address(uint8_t x, uint8_t y); - - static void clear(); - static void clear_ddram(); - static void clear_gdram(); - - static void load_cgram_icon(uint16_t addr, const void *data); - static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); - - static uint8_t string_checksum(const char *str); - - protected: - static void draw_static_elements(); - static void draw_progress_bar(uint8_t value); - static void draw_fan_icon(bool whichIcon); - static void draw_heat_icon(bool whichIcon, bool heating); - static void draw_extruder_1_temp(uint8_t temp, uint8_t target); - static void draw_extruder_2_temp(uint8_t temp, uint8_t target); - static void draw_bed_temp(uint8_t temp, uint8_t target); - static void draw_fan_speed(uint8_t value); - static void draw_print_time(uint32_t elapsed); - static void draw_feedrate_percentage(uint8_t percentage); - static void draw_status_message(const char *str); - static void draw_position(const float x, const float y, const float z, bool position_known = true); - - static bool indicators_changed(); - static bool position_changed(); - static bool blink_changed(); - static bool status_changed(); - - static void update_indicators(bool forceUpdate); - static void update_position(bool forceUpdate, bool resetChecksum); - static void update_status_or_position(bool forceUpdate); - static void update_progress(bool forceUpdate); - - public: - static void update(bool forceUpdate); - static void on_entry(); - static void on_exit(); - static void clear_text_buffer(); -}; - -/************************** ICON DEFINITIONS *************************************/ - -#define CGRAM_ICON_1_ADDR 0x00 -#define CGRAM_ICON_2_ADDR 0x10 -#define CGRAM_ICON_3_ADDR 0x20 -#define CGRAM_ICON_4_ADDR 0x30 - -#define CGRAM_ICON_1_WORD 0x00 -#define CGRAM_ICON_2_WORD 0x02 -#define CGRAM_ICON_3_WORD 0x04 -#define CGRAM_ICON_4_WORD 0x06 - -PROGMEM const uint16_t nozzle_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000111111110000, - 0b0001111111111000, - 0b0001111111111000, - 0b0001111111111000, - 0b0000111111110000, - 0b0000111111110000, - 0b0001111111111000, - 0b0001111111111000, - 0b0001111111111000, - 0b0000011111100000, - 0b0000001111000000, - 0b0000000110000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t bed_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0111111111111110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t heat1_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t heat2_icon[] = { - 0b0000000000000000, - 0b0000000000000000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t fan1_icon[] = { - 0b0000000000000000, - 0b0111111111111110, - 0b0111000000001110, - 0b0110001111000110, - 0b0100001111000010, - 0b0100000110000010, - 0b0101100000011010, - 0b0101110110111010, - 0b0101100000011010, - 0b0100000110000010, - 0b0100001111000010, - 0b0110001111000110, - 0b0111000000001110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t fan2_icon[] = { - 0b0000000000000000, - 0b0111111111111110, - 0b0111000000001110, - 0b0110010000100110, - 0b0100111001110010, - 0b0101111001111010, - 0b0100110000110010, - 0b0100000110000010, - 0b0100110000110010, - 0b0101111001111010, - 0b0100111001110010, - 0b0110010000100110, - 0b0111000000001110, - 0b0111111111111110, - 0b0000000000000000, - 0b0000000000000000 -}; - -PROGMEM const uint16_t feedrate_icon[] = { - 0b0000000000000000, - 0b0111111000000000, - 0b0100000000000000, - 0b0100000000000000, - 0b0100000000000000, - 0b0111111011111000, - 0b0100000010000100, - 0b0100000010000100, - 0b0100000010000100, - 0b0100000011111000, - 0b0000000010001000, - 0b0000000010000100, - 0b0000000010000100, - 0b0000000010000010, - 0b0000000000000000, - 0b0000000000000000 -}; - -static void lcd_implementation_status_screen(); -static void lcd_in_status(bool inStatus); - -#endif // ULTRALCD_ST7920_LITE_STATUS_H \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h deleted file mode 100644 index 92a6cf593..000000000 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl.h +++ /dev/null @@ -1,759 +0,0 @@ -/* - * Lightweight Status Screen for the RepRapDiscount Full - * Graphics Smart Controller (ST7920-based 128x64 LCD) - * - * (c) 2017 Aleph Objects, Inc. - * - * The code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - */ - - /* This is an implementation of a status screen for the RepRapDiscount - * Full Graphics Smart Controller using native ST7920 commands rather - * than using U8Glib. - * - * This alternative status screen makes use of the built-in character - * generation capabilities of the ST7920 to update the status screen - * with less SPI traffic and CPU use. In particular: - * - * - The fan and bed animations are handled using custom characters - * that are stored in CGRAM. This allows for the animation to be - * updated by writing a single character to the text-buffer (DDRAM). - * - * - All the information in the status screen is text that is written - * to DDRAM, so the work of generating the bitmaps is offloaded to - * the ST7920 rather than being render by U8Glib on the MCU. - * - * - The graphics buffer (GDRAM) is only used for static graphics - * elements (nozzle and feedrate bitmaps) and for the progress - * bar, so updates are sporadic. - */ - -#include "../../libs/duration_t.h" - -typedef const __FlashStringHelper *progmem_str; - -#include "ultralcd_impl_st7920_lite_status_screen.h" - -#define BUFFER_WIDTH 256 -#define BUFFER_HEIGHT 32 - -#define DDRAM_LINE_1 0x00 -#define DDRAM_LINE_2 0x10 -#define DDRAM_LINE_3 0x08 -#define DDRAM_LINE_4 0x18 - -ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; - -void ST7920_Lite_Status_Screen::cmd(uint8_t cmd) { - if(!current_bits.synced || !current_bits.cmd) { - current_bits.synced = true; - current_bits.cmd = true; - sync_cmd(); - } - write_byte(cmd); -} - -void ST7920_Lite_Status_Screen::begin_data() { - extended_function_set(false); - if(!current_bits.synced || current_bits.cmd) { - current_bits.synced = true; - current_bits.cmd = false; - sync_dat(); - } -} - -void ST7920_Lite_Status_Screen::write_word(uint16_t w) { - write_byte((w >> 8) & 0xFF); - write_byte((w >> 0) & 0xFF); -} - -void ST7920_Lite_Status_Screen::write_str(const char *str) { - while(*str) { - write_byte(*str++); - } -} - -void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { - while(*str && len--) { - write_byte(*str++); - } -} - -void ST7920_Lite_Status_Screen::write_str_P(const char *str) { - const char *p_str = (const char *)str; - char c = pgm_read_byte_near(p_str++); - while(c) { - write_byte(c); - c = pgm_read_byte_near(p_str++); - } -} - -void ST7920_Lite_Status_Screen::write_str(progmem_str str) { - write_str_P((const char*)str); -} - -void ST7920_Lite_Status_Screen::write_number(uint8_t value, uint8_t digits) { - char str[7]; - const char *fmt; - switch(digits) { - case 6: fmt = PSTR("%6d"); break; - case 5: fmt = PSTR("%5d"); break; - case 4: fmt = PSTR("%4d"); break; - case 3: fmt = PSTR("%3d"); break; - case 2: fmt = PSTR("%2d"); break; - case 1: fmt = PSTR("%1d"); break; - } - sprintf_P(str,fmt,value); - write_str(str); -} - -void ST7920_Lite_Status_Screen::display_status(bool display_on, bool cursor_on, bool blink_on) { - extended_function_set(false); - cmd(0b00001000 | - (display_on ? 0b0100 : 0) | - (cursor_on ? 0b0010 : 0) | - (blink_on ? 0b0001 : 0) - ); -} - -// Sets the extended and graphics bits simultaneously, regardless of -// the current state. This is a helper function for extended_function_set() -// and graphics() -void ST7920_Lite_Status_Screen::_extended_function_set(bool extended, bool graphics) { - cmd( 0b00100000 | - (extended ? 0b00000100 : 0) | - (graphics ? 0b00000010 : 0) - ); - current_bits.extended = extended; - current_bits.graphics = graphics; -} - -void ST7920_Lite_Status_Screen::extended_function_set(bool extended) { - if(extended != current_bits.extended) { - _extended_function_set(extended, current_bits.graphics); - } -} - -void ST7920_Lite_Status_Screen::graphics(bool graphics) { - if(graphics != current_bits.graphics) { - _extended_function_set(current_bits.extended, graphics); - } -} - -void ST7920_Lite_Status_Screen::entry_mode_select(bool ac_increase, bool shift) { - extended_function_set(false); - cmd(0b00000100 | - (ac_increase ? 0b00000010 : 0) | - (shift ? 0b00000001 : 0) - ); -} - -// Sets the sa bit regardless of the current state. This is a helper -// function for scroll_or_addr_select() -void ST7920_Lite_Status_Screen::_scroll_or_addr_select(bool sa) { - extended_function_set(true); - cmd(0b00100010 | - (sa ? 0b000001 : 0) - ); - current_bits.sa = sa; -} - -void ST7920_Lite_Status_Screen::scroll_or_addr_select(bool sa) { - if(sa != current_bits.sa) { - _scroll_or_addr_select(sa); - } -} - -void ST7920_Lite_Status_Screen::set_ddram_address(uint8_t addr) { - extended_function_set(false); - cmd(0b10000000 | (addr & 0b00111111)); -} - -void ST7920_Lite_Status_Screen::set_cgram_address(uint8_t addr) { - extended_function_set(false); - cmd(0b01000000 | (addr & 0b00111111)); -} - -void ST7920_Lite_Status_Screen::set_gdram_address(uint8_t x, uint8_t y) { - extended_function_set(true); - cmd(0b10000000 | (y & 0b01111111)); - cmd(0b10000000 | (x & 0b00001111)); -} - -void ST7920_Lite_Status_Screen::clear() { - extended_function_set(false); - cmd(0x00000001); - delay(15); //delay for CGRAM clear -} - -void ST7920_Lite_Status_Screen::home() { - extended_function_set(false); - cmd(0x00000010); -} - -/* This fills the entire text buffer with spaces */ -void ST7920_Lite_Status_Screen::clear_ddram() -{ - set_ddram_address(DDRAM_LINE_1); - begin_data(); - for(int i=0; i < 64;i++) { - write_byte(' '); - } -} - -/* This fills the entire graphics buffer with zeros */ -void ST7920_Lite_Status_Screen::clear_gdram() -{ - for(int y = 0; y < BUFFER_HEIGHT; y++) { - set_gdram_address(0,y); - begin_data(); - for(int i = 0; i < (BUFFER_WIDTH / 16); i++) { - write_byte(0); - write_byte(0); - } - } -} - -void ST7920_Lite_Status_Screen::load_cgram_icon(uint16_t addr, const void *data) { - const uint16_t *p_word = (const uint16_t *)data; - set_cgram_address(addr); - begin_data(); - for(int i = 0; i < 16; i++) { - uint16_t word = pgm_read_word_near(p_word++); - write_byte((word & 0xFF00) >> 8); - write_byte((word & 0x00FF) >> 0); - } -} - -/* Draws an icon in GDRAM. The position is specified in - as if they were DDRAM coordinates, i.e. the x position - is [1-8], while the y position is [1-4] */ -void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { - const uint16_t *p_word = (const uint16_t *)data; - if(y > 2) { - // Handle display folding - y -= 2; - x += 8; - } - x -= 1; - y -= 1; - for(int i = 0; i < 16; i++) { - uint16_t word = pgm_read_word_near(p_word++); - set_gdram_address(x,i+y*16); - begin_data(); - write_byte((word & 0xFF00) >> 8); - write_byte((word & 0x00FF) >> 0); - } -} - -/************************** MAIN SCREEN *************************************/ - -void ST7920_Lite_Status_Screen::draw_static_elements() { - scroll_or_addr_select(0); - - // Load the animated bed and fan icons - load_cgram_icon(CGRAM_ICON_1_ADDR, heat1_icon); - load_cgram_icon(CGRAM_ICON_2_ADDR, heat2_icon); - load_cgram_icon(CGRAM_ICON_3_ADDR, fan1_icon); - load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); - - // Draw the static icons in GDRAM - draw_gdram_icon(1,1,nozzle_icon); - #if EXTRUDERS == 2 - draw_gdram_icon(1,2,nozzle_icon); - draw_gdram_icon(1,3,bed_icon); - #else - draw_gdram_icon(1,2,bed_icon); - #endif - draw_gdram_icon(6,2,feedrate_icon); - - // Draw the initial fan icon - draw_fan_icon(false); -} - -/* Although this is undocumented, the ST7920 allows the character - * data buffer (DDRAM) to be used in conjunction with the graphics - * bitmap buffer (CGRAM). The contents of the graphics buffer is - * XORed with the data from the character generator. This allows - * us to make the progess bar out of graphical data (the bar) and - * text data (the percentage). - */ -void ST7920_Lite_Status_Screen::draw_progress_bar(uint8_t value) { - #if EXTRUDERS == 1 - // If we have only one extruder, draw a long progress bar on the third line - const int top = 1; // Top in pixels - const int bottom = 13; // Bottom in pixels - const int left = 8; // Left edge, in 16-bit words - const int width = 5; // Width of progress bar, in 16-bit words - #else - const int top = 16 + 1; // Top in pixels - const int bottom = 16 + 13; // Bottom in pixels - const int left = 5; // Left edge, in 16-bit words - const int width = 3; // Width of progress bar, in 16-bit words - #endif - const int char_pcnt = 100/width; // How many percent does each 16-bit word represent? - - // Draw the progress bar as a bitmap in CGRAM - - for(int y = top; y <= bottom; y++) { - set_gdram_address(left,y); - begin_data(); - for(int x = 0; x < width; x++) { - uint16_t gfx_word = 0x0000; - if((x+1)*char_pcnt <= value) { - // Draw completely filled bytes - gfx_word = 0xFFFF; - } else if((x*char_pcnt) < value) { - // Draw partially filled bytes - gfx_word = int(0x8000) >> (value % char_pcnt)*16/char_pcnt; - } - // Draw the frame around the progress bar - if(y == top || y == bottom) { - // Draw top/bottom border - gfx_word = 0xFFFF; - } else if (x == (width-1)) { - // Draw right border - gfx_word |= 0x0001; - } else if (x == 0) { - // Draw left border - gfx_word |= 0x8000; - } - write_word(gfx_word); - } - } - - // Draw the percentage as text in DDRAM - - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_3 + 1); - #else - set_ddram_address(DDRAM_LINE_2 + left); - #endif - - begin_data(); - if(value > 9) { - write_number(value,4); - write_str(F("% ")); - } else { - write_number(value,3); - write_str(F("% ")); - } -} - -void ST7920_Lite_Status_Screen::draw_fan_icon(bool whichIcon) { - set_ddram_address(DDRAM_LINE_1+5); - begin_data(); - write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); -} - -void ST7920_Lite_Status_Screen::draw_heat_icon(bool whichIcon, bool heating) { - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2); - #else - set_ddram_address(DDRAM_LINE_3); - #endif - begin_data(); - if(heating) { - write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); - } else { - write_byte(' '); - write_byte(' '); - } -} - -#define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 1) - -void ST7920_Lite_Status_Screen::draw_extruder_1_temp(uint8_t temp, uint8_t target) { - set_ddram_address(DDRAM_LINE_1+1); - begin_data(); - write_number(temp); - if(target && FAR(temp, target)) { - write_str(F("\x1A")); - write_number(target); - } else { - write_str(F(" ")); - } -} - -void ST7920_Lite_Status_Screen::draw_extruder_2_temp(uint8_t temp, uint8_t target) { - set_ddram_address(DDRAM_LINE_2+1); - begin_data(); - write_number(temp); - if(target && FAR(temp, target)) { - write_str(F("\x1A")); - write_number(target); - } else { - write_str(F(" ")); - } -} - -void ST7920_Lite_Status_Screen::draw_bed_temp(uint8_t temp, uint8_t target) { - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2+1); - #else - set_ddram_address(DDRAM_LINE_3+1); - #endif - begin_data(); - write_number(temp); - if(target && FAR(temp, target)) { - write_str(F("\x1A")); - write_number(target); - } else { - write_str(F(" ")); - } -} - -void ST7920_Lite_Status_Screen::draw_fan_speed(uint8_t value) { - set_ddram_address(DDRAM_LINE_1+6); - begin_data(); - write_number(value,4); -} - -void ST7920_Lite_Status_Screen::draw_print_time(uint32_t elapsed) { - const uint8_t hrs = elapsed/3600; - const uint8_t min = (elapsed/60)%60; - char str[7]; - sprintf_P(str,hrs > 99 ? PSTR("%03d:%02d") : PSTR(" %02d:%02d"),hrs,min); - - set_ddram_address(DDRAM_LINE_3+5); - begin_data(); - write_str(str); -} - -void ST7920_Lite_Status_Screen::draw_feedrate_percentage(uint8_t percentage) { - // We only have enough room for the feedrate when - // we have one extruder - #if EXTRUDERS == 1 - set_ddram_address(DDRAM_LINE_2+6); - begin_data(); - write_number(percentage,4); - #endif -} - -void ST7920_Lite_Status_Screen::draw_status_message(const char *str) { - set_ddram_address(DDRAM_LINE_4); - begin_data(); - #if ENABLED(STATUS_MESSAGE_SCROLLING) - const uint8_t lcd_len = 16; - const uint8_t padding = 2; - uint8_t str_len = strlen(str); - - // Trim whitespace at the end of the str, as for some reason - // messages like "Card Inserted" are padded with many spaces - while(str_len > 0 && str[str_len-1] == ' ') { - str_len--; - } - - if(str_len <= lcd_len) { - // It all fits on the LCD without scrolling - write_str(str); - } else { - // Print the message repeatedly until covering the LCD - uint8_t c = status_scroll_pos; - for(uint8_t n = 0; n < lcd_len; n++) { - write_byte(c < str_len ? str[c] : ' '); - c++; - c %= str_len + padding; // Wrap around - } - - // Scroll the message - if(status_scroll_pos == str_len + padding) { - status_scroll_pos = 0; - } else { - status_scroll_pos++; - } - } - #else - write_str(str, 16); - #endif -} - -void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, const float z, bool position_known) { - char str[7]; - set_ddram_address(DDRAM_LINE_4); - begin_data(); - - // If position is unknown, flash the labels. - const unsigned char alt_label = position_known ? 0 : (lcd_blink() ? ' ' : 0); - - dtostrf(x, -4, 0, str); - write_byte(alt_label ? alt_label : 'X'); - write_str(str, 4); - - dtostrf(y, -4, 0, str); - write_byte(alt_label ? alt_label : 'Y'); - write_str(str, 4); - - dtostrf(z, -5, 1, str); - write_byte(alt_label ? alt_label : 'Z'); - write_str(str, 5); -} - -bool ST7920_Lite_Status_Screen::indicators_changed() { - // We only add the target temperatures to the checksum - // because the actual temps fluctuate so by updating - // them only during blinks we gain a bit of stability. - const bool blink = lcd_blink(); - const uint8_t feedrate_perc = feedrate_percentage; - const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; - const float extruder_1_target = thermalManager.degTargetHotend(0); - #if EXTRUDERS == 2 - const float extruder_2_target = thermalManager.degTargetHotend(1); - #endif - const float bed_target = thermalManager.degTargetBed(); - - static uint8_t last_checksum = 0; - - const uint8_t checksum = - uint8_t(blink) ^ - uint8_t(feedrate_perc) ^ - uint8_t(fan_speed) ^ - uint8_t(extruder_1_target) ^ -#if EXTRUDERS == 2 - uint8_t(extruder_2_target) ^ -#endif - uint8_t(bed_target); - - if(last_checksum == checksum) { - return false; - } else { - last_checksum = checksum; - return true; - } -} - -void ST7920_Lite_Status_Screen::update_indicators(bool forceUpdate) { - if(forceUpdate || indicators_changed()) { - const bool blink = lcd_blink(); - const duration_t elapsed = print_job_timer.duration(); - const uint32_t seconds_elapsed = elapsed.value; - const uint8_t feedrate_perc = feedrate_percentage; - const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; - const float extruder_1_temp = thermalManager.degHotend(0); - const float extruder_1_target = thermalManager.degTargetHotend(0); - #if EXTRUDERS == 2 - const float extruder_2_temp = thermalManager.degHotend(1); - const float extruder_2_target = thermalManager.degTargetHotend(1); - #endif - const float bed_temp = thermalManager.degBed(); - const float bed_target = thermalManager.degTargetBed(); - - draw_extruder_1_temp(extruder_1_temp, extruder_1_target); - #if EXTRUDERS == 2 - draw_extruder_2_temp(extruder_2_temp, extruder_2_target); - #endif - draw_bed_temp(bed_temp, bed_target); - draw_fan_speed(fan_speed); - draw_print_time(seconds_elapsed); - draw_feedrate_percentage(feedrate_perc); - - // Update the fan and bed animations - if(fan_speed > 0) { - draw_fan_icon(blink); - } - if(bed_target > 0) { - draw_heat_icon(blink, true); - } else { - draw_heat_icon(false, false); - } - } -} - -bool ST7920_Lite_Status_Screen::position_changed() { - const float x_pos = current_position[X_AXIS]; - const float y_pos = current_position[Y_AXIS]; - const float z_pos = current_position[Z_AXIS]; - const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); - - static uint8_t last_checksum = 0; - if(last_checksum == checksum) { - return false; - } else { - last_checksum = checksum; - return true; - } -} - -bool ST7920_Lite_Status_Screen::status_changed() { - uint8_t checksum = 0; - for(const char *p = lcd_status_message; *p; p++) { - checksum ^= *p; - } - - static uint8_t last_checksum = 0; - if(last_checksum == checksum) { - return false; - } else { - last_checksum = checksum; - return true; - } -} - -bool ST7920_Lite_Status_Screen::blink_changed() { - static uint8_t last_blink = 0; - - const bool blink = lcd_blink(); - if(last_blink == blink) { - return false; - } else { - last_blink = blink; - return true; - } -} - -void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { - static uint8_t countdown = 0; - - /* There is only enough room in the display for either the - * status message or the position, not both, so we choose - * one or another. Whenever the status message changes, - * we show it for a number of consecutive seconds, but - * then go back to showing the position as soon as the - * head moves, i.e: - * - * countdown > 1 -- Show status - * countdown = 1 -- Show status, until movement - * countdown = 0 -- Show position - */ - if( forceUpdate || status_changed() ) { - #if ENABLED(STATUS_MESSAGE_SCROLLING) - status_scroll_pos = 0; - #endif - if(lcd_strlen(lcd_status_message)) { - countdown = DELAY_TO_SHOW_POSITION; - } else { - countdown = 0; - } - draw_status_message(lcd_status_message); - blink_changed(); // Clear changed flag - } - else if(countdown > 1 && blink_changed() ) { - countdown--; - #if ENABLED(STATUS_MESSAGE_SCROLLING) - draw_status_message(lcd_status_message); - #endif - } - else if(countdown > 0 && blink_changed() ) { - if(position_changed()) { - countdown--; - forceUpdate = true; - } - #if ENABLED(STATUS_MESSAGE_SCROLLING) - draw_status_message(lcd_status_message); - #endif - } - if(countdown == 0 && (forceUpdate || position_changed() || - #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - blink_changed() - #endif - )) { - draw_position( - current_position[X_AXIS], - current_position[Y_AXIS], - current_position[Z_AXIS], - #if ENABLED(DISABLE_REDUCED_ACCURACY_WARNING) - true - #else - axis_known_position[X_AXIS] && - axis_known_position[Y_AXIS] && - axis_known_position[Z_AXIS] - #endif - ); - } -} - -void ST7920_Lite_Status_Screen::update_progress(bool forceUpdate) { - #if ENABLED(SDSUPPORT) - const uint8_t percent_done = card.percentDone(); - #else - const uint8_t percent_done = 0; - #endif - - // Since the progress bar involves writing - // quite a few bytes to GDRAM, only do this - // when an update is actually necessary. - - static uint8_t last_progress = 0; - if(!forceUpdate && last_progress == percent_done) - return; - last_progress = percent_done; - - draw_progress_bar(percent_done); -} - -void ST7920_Lite_Status_Screen::update(bool forceUpdate) { - cs(); - update_indicators(forceUpdate); - update_status_or_position(forceUpdate); - update_progress(forceUpdate); - ncs(); -} - -void ST7920_Lite_Status_Screen::reset_state_from_unknown() { - _extended_function_set(true, true); // Do it twice as only one bit - _extended_function_set(true, true); // get set at a time. - _scroll_or_addr_select(false); -} - -void ST7920_Lite_Status_Screen::on_entry() { - cs(); - reset_state_from_unknown(); - clear(); - clear_gdram(); - draw_static_elements(); - update(true); - ncs(); -} - -void ST7920_Lite_Status_Screen::on_exit() { - cs(); - clear(); - _extended_function_set(true, true); // Restore state to what u8g expects. - ncs(); -} - -// This is called prior to the KILL screen to -// clear the screen so we don't end up with a -// garbled display. -void ST7920_Lite_Status_Screen::clear_text_buffer() { - cs(); - reset_state_from_unknown(); - clear(); - _extended_function_set(true, true); // Restore state to what u8g expects. - ncs(); -} - -static void lcd_implementation_status_screen() { - ST7920_Lite_Status_Screen::update(false); -} - -/* In order to properly update the lite status screen, - * we must know when we have entered and left the - * status screen. Since the ultralcd code is not - * set up for doing this, we call this function before - * each update indicating whether the current screen - * is the status screen. - * - * This function keeps track of whether we have left or - * entered the status screen and calls the on_entry() - * and on_exit() methods for cleanup. - */ - -static void lcd_in_status(bool inStatus) { - static bool lastInStatus = false; - if(!lastInStatus && inStatus) { - ST7920_Lite_Status_Screen::on_entry(); - lastInStatus = true; - } - if(lastInStatus && !inStatus) { - ST7920_Lite_Status_Screen::on_exit(); - lastInStatus = false; - } -} \ No newline at end of file diff --git a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h b/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h deleted file mode 100644 index 1a0a33be4..000000000 --- a/Marlin/src/lcd/dogm/ultralcd_impl_st7920_lite_status_screen_impl_spi.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Lightweight Status Screen for the RepRapDiscount Full - * Graphics Smart Controller (ST7920-based 128x64 LCD) - * - * (c) 2017 Aleph Objects, Inc. - * - * The code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - */ - -#include "ultralcd_impl_st7920_lite_status_screen.h" - -void ST7920_Lite_Status_Screen::cs() { - ST7920_CS(); - current_bits.synced = false; -} - -void ST7920_Lite_Status_Screen::ncs() { - ST7920_NCS(); - current_bits.synced = false; -} - -void ST7920_Lite_Status_Screen::sync_cmd() { - ST7920_SET_CMD(); -} - -void ST7920_Lite_Status_Screen::sync_dat() { - ST7920_SET_DAT(); -} - -void ST7920_Lite_Status_Screen::write_byte(uint8_t data) { - ST7920_WRITE_NIBBLES(data); -} \ No newline at end of file From e84a5545e13db63bcc4f5f5513b58226ad37275c Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 21 Feb 2018 15:12:11 -0700 Subject: [PATCH 09/12] Removed unnecessary extended mode switch. - This will slightly reduce the SPI requirements for updating the progress bar. --- Marlin/src/lcd/dogm/status_screen_lite_ST7920.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index ccc046e7d..2c40e6443 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -60,7 +60,6 @@ void ST7920_Lite_Status_Screen::cmd(const uint8_t cmd) { } void ST7920_Lite_Status_Screen::begin_data() { - extended_function_set(false); if (!current_bits.synced || current_bits.cmd) { current_bits.synced = true; current_bits.cmd = false; From e7f329edb297407d6995a4a8d8bf850ec3989f8e Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 21 Feb 2018 15:31:56 -0700 Subject: [PATCH 10/12] Added bed corners to bed icon. - This makes it look less like a dash (idea stolen from cjsoong). --- .../src/lcd/dogm/status_screen_lite_ST7920.h | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index 2c40e6443..8a73f1ac9 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -266,25 +266,25 @@ const uint16_t bed_icon[] PROGMEM = { 0b0000000000000000, 0b0000000000000000, 0b0000000000000000, - 0b0000000000000000, 0b0111111111111110, 0b0111111111111110, + 0b0110000000000110, 0b0000000000000000, 0b0000000000000000 }; const uint16_t heat1_icon[] PROGMEM = { 0b0000000000000000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, 0b0000000000000000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, 0b0000000000000000, 0b0000000000000000, 0b0000000000000000, @@ -294,16 +294,16 @@ const uint16_t heat1_icon[] PROGMEM = { const uint16_t heat2_icon[] PROGMEM = { 0b0000000000000000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, 0b0000000000000000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, - 0b0010001000100000, - 0b0010001000100000, - 0b0001000100010000, - 0b0000100010001000, - 0b0000100010001000, - 0b0001000100010000, 0b0000000000000000, 0b0000000000000000, 0b0000000000000000, From 532bb3aaa119d2d6ac6f5c31d33d5cc1aecd357b Mon Sep 17 00:00:00 2001 From: Marcio Teixeira Date: Wed, 14 Feb 2018 14:43:54 -0700 Subject: [PATCH 11/12] 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. --- .travis.yml | 2 +- Marlin/Configuration_adv.h | 16 + Marlin/src/config/default/Configuration_adv.h | 16 + Marlin/src/lcd/dogm/status_screen_DOGM.h | 442 +++++++++ .../src/lcd/dogm/status_screen_lite_ST7920.h | 853 ++++++++++++++++++ .../dogm/status_screen_lite_ST7920_class.h | 108 +++ .../lcd/dogm/status_screen_lite_ST7920_spi.h | 39 + .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 14 +- Marlin/src/lcd/ultralcd.cpp | 40 +- Marlin/src/lcd/ultralcd_impl_DOGM.h | 423 +-------- 10 files changed, 1522 insertions(+), 431 deletions(-) create mode 100644 Marlin/src/lcd/dogm/status_screen_DOGM.h create mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920.h create mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h create mode 100644 Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h diff --git a/.travis.yml b/.travis.yml index 7c7e71252..2048b649f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -236,7 +236,7 @@ script: # - restore_configs - opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT - - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES + - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING SCROLL_LONG_FILENAMES LIGHTWEIGHT_UI - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # # REPRAPWORLD_KEYPAD diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 5b873abdf..a52880266 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 5b873abdf..a52880266 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.h b/Marlin/src/lcd/dogm/status_screen_DOGM.h new file mode 100644 index 000000000..478cbf846 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.h @@ -0,0 +1,442 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * status_screen_DOGM.h + * + * Standard Status Screen for Graphical Display + */ + +#ifndef _STATUS_SCREEN_DOGM_H_ +#define _STATUS_SCREEN_DOGM_H_ + +FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { + const char * const str = itostr3(temp); + u8g.setPrintPos(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y); + lcd_print(str); + lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); +} + +#ifndef HEAT_INDICATOR_X + #define HEAT_INDICATOR_X 8 +#endif + +FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) { + #if !HEATER_IDLE_HANDLER + UNUSED(blink); + #endif + + #if HAS_TEMP_BED + const bool isBed = heater < 0; + #else + constexpr bool isBed = false; + #endif + + if (PAGE_UNDER(7)) { + #if HEATER_IDLE_HANDLER + const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : + #if HAS_TEMP_BED + thermalManager.is_bed_idle() + #else + false + #endif + ); + + if (blink || !is_idle) + #endif + _draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); } + + if (PAGE_CONTAINS(21, 28)) + _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28); + + if (PAGE_CONTAINS(17, 20)) { + const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X, + y = isBed ? 18 : 17; + if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) { + u8g.setColorIndex(0); // white on black + u8g.drawBox(x + h, y, 2, 2); + u8g.setColorIndex(1); // black on white + } + else { + u8g.drawBox(x + h, y, 2, 2); + } + } +} + +FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) { + if (blink) + lcd_printPGM(pstr); + else { + if (!axis_homed[axis]) + u8g.print('?'); + else { + #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + if (!axis_known_position[axis]) + u8g.print(' '); + else + #endif + lcd_printPGM(pstr); + } + } +} + +inline void lcd_implementation_status_message(const bool blink) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + static bool last_blink = false; + const uint8_t slen = lcd_strlen(lcd_status_message); + const char *stat = lcd_status_message + status_scroll_pos; + if (slen <= LCD_WIDTH) + lcd_print_utf(stat); // The string isn't scrolling + else { + if (status_scroll_pos <= slen - LCD_WIDTH) + lcd_print_utf(stat); // The string fills the screen + else { + uint8_t chars = LCD_WIDTH; + if (status_scroll_pos < slen) { // First string still visible + lcd_print_utf(stat); // The string leaves space + chars -= slen - status_scroll_pos; // Amount of space left + } + u8g.print('.'); // Always at 1+ spaces left, draw a dot + if (--chars) { + if (status_scroll_pos < slen + 1) // Draw a second dot if there's space + --chars, u8g.print('.'); + if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message + } + } + if (last_blink != blink) { + last_blink = blink; + // Skip any non-printing bytes + if (status_scroll_pos < slen) while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++; + if (++status_scroll_pos >= slen + 2) status_scroll_pos = 0; + } + } + #else + UNUSED(blink); + lcd_print_utf(lcd_status_message); + #endif +} + +static void lcd_implementation_status_screen() { + + const bool blink = lcd_blink(); + + #if FAN_ANIM_FRAMES > 2 + static bool old_blink; + static uint8_t fan_frame; + if (old_blink != blink) { + old_blink = blink; + if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; + } + #endif + + // Status Menu Font + lcd_setFont(FONT_STATUSMENU); + + // + // Fan Animation + // + // Draws the whole heading image as a B/W bitmap rather than + // drawing the elements separately. + // This was done as an optimization, as it was slower to draw + // multiple parts compared to a single bitmap. + // + // The bitmap: + // - May be offset in X + // - Includes all nozzle(s), bed(s), and the fan. + // + // TODO: + // + // - Only draw the whole header on the first + // entry to the status screen. Nozzle, bed, and + // fan outline bits don't change. + // + if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { + + u8g.drawBitmapP( + STATUS_SCREEN_X, STATUS_SCREEN_Y, + (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, + #if HAS_FAN0 + #if FAN_ANIM_FRAMES > 2 + fan_frame == 1 ? status_screen1_bmp : + fan_frame == 2 ? status_screen2_bmp : + #if FAN_ANIM_FRAMES > 3 + fan_frame == 3 ? status_screen3_bmp : + #endif + #else + blink && fanSpeeds[0] ? status_screen1_bmp : + #endif + #endif + status_screen0_bmp + ); + + } + + // + // Temperature Graphics and Info + // + + if (PAGE_UNDER(28)) { + // Extruders + HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); + + // Heated bed + #if HOTENDS < 4 && HAS_TEMP_BED + _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); + #endif + + #if HAS_FAN0 + if (PAGE_CONTAINS(20, 27)) { + // Fan + const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256; + if (per) { + u8g.setPrintPos(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y); + lcd_print(itostr3(per)); + u8g.print('%'); + } + } + #endif + } + + #if ENABLED(SDSUPPORT) + // + // SD Card Symbol + // + if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { + // Upper box + u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) + // Right edge + u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47) + // Bottom hollow box + u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51) + // Corner pixel + u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42) + } + #endif // SDSUPPORT + + #if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) + // + // Progress bar frame + // + #define PROGRESS_BAR_X 54 + #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) + + if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51) + u8g.drawFrame( + PROGRESS_BAR_X, 49, + PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) + ); + + #if DISABLED(LCD_SET_PROGRESS_MANUALLY) + const uint8_t progress_bar_percent = card.percentDone(); + #endif + + if (progress_bar_percent > 1) { + + // + // Progress bar solid part + // + + if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) + u8g.drawBox( + PROGRESS_BAR_X + 1, 50, + (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) + ); + + // + // SD Percent Complete + // + + #if ENABLED(DOGM_SD_PERCENT) + if (PAGE_CONTAINS(41, 48)) { + // Percent complete + u8g.setPrintPos(55, 48); + u8g.print(itostr3(progress_bar_percent)); + u8g.print('%'); + } + #endif + } + + // + // Elapsed Time + // + + #if DISABLED(DOGM_SD_PERCENT) + #define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2)) + #else + #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH) + #endif + + if (PAGE_CONTAINS(41, 48)) { + char buffer[10]; + duration_t elapsed = print_job_timer.duration(); + bool has_days = (elapsed.value >= 60*60*24L); + uint8_t len = elapsed.toDigital(buffer, has_days); + u8g.setPrintPos(SD_DURATION_X, 48); + lcd_print(buffer); + } + + #endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY + + // + // XYZ Coordinates + // + + #if ENABLED(USE_SMALL_INFOFONT) + #define INFO_FONT_HEIGHT 7 + #else + #define INFO_FONT_HEIGHT 8 + #endif + + #define XYZ_BASELINE (30 + INFO_FONT_HEIGHT) + + #define X_LABEL_POS 3 + #define X_VALUE_POS 11 + #define XYZ_SPACING 40 + + #if ENABLED(XYZ_HOLLOW_FRAME) + #define XYZ_FRAME_TOP 29 + #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3 + #else + #define XYZ_FRAME_TOP 30 + #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1 + #endif + + // Before homing the axis letters are blinking 'X' <-> '?'. + // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '. + // When everything is ok you see a constant 'X'. + + static char xstring[5], ystring[5], zstring[7]; + #if ENABLED(FILAMENT_LCD_DISPLAY) + static char wstring[5], mstring[4]; + #endif + + // At the first page, regenerate the XYZ strings + if (page.page == 0) { + strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); + strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); + strcpy(zstring, ftostr52sp(FIXFLOAT(LOGICAL_Z_POSITION(current_position[Z_AXIS])))); + #if ENABLED(FILAMENT_LCD_DISPLAY) + strcpy(wstring, ftostr12ns(filament_width_meas)); + strcpy(mstring, itostr3(100.0 * ( + parser.volumetric_enabled + ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] + : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] + ) + )); + #endif + } + + if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { + + #if ENABLED(XYZ_HOLLOW_FRAME) + u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39 + #else + u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37 + #endif + + if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) { + + #if DISABLED(XYZ_HOLLOW_FRAME) + u8g.setColorIndex(0); // white on black + #endif + + u8g.setPrintPos(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + _draw_axis_label(X_AXIS, PSTR(MSG_X), blink); + u8g.setPrintPos(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + lcd_print(xstring); + + u8g.setPrintPos(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); + u8g.setPrintPos(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + lcd_print(ystring); + + u8g.setPrintPos(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); + _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); + u8g.setPrintPos(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); + lcd_print(zstring); + + #if DISABLED(XYZ_HOLLOW_FRAME) + u8g.setColorIndex(1); // black on white + #endif + } + } + + // + // Feedrate + // + + if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) { + lcd_setFont(FONT_MENU); + u8g.setPrintPos(3, 50); + lcd_print(LCD_STR_FEEDRATE[0]); + + lcd_setFont(FONT_STATUSMENU); + u8g.setPrintPos(12, 50); + lcd_print(itostr3(feedrate_percentage)); + u8g.print('%'); + + // + // Filament sensor display if SD is disabled + // + #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) + u8g.setPrintPos(56, 50); + lcd_print(wstring); + u8g.setPrintPos(102, 50); + lcd_print(mstring); + u8g.print('%'); + lcd_setFont(FONT_MENU); + u8g.setPrintPos(47, 50); + lcd_print(LCD_STR_FILAM_DIA); + u8g.setPrintPos(93, 50); + lcd_print(LCD_STR_FILAM_MUL); + #endif + } + + // + // Status line + // + + #define STATUS_BASELINE (55 + INFO_FONT_HEIGHT) + + if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) { + u8g.setPrintPos(0, STATUS_BASELINE); + + #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) + if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line + lcd_implementation_status_message(blink); + } + else { + lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); + u8g.print(':'); + lcd_print(wstring); + lcd_printPGM(PSTR(" " LCD_STR_FILAM_MUL)); + u8g.print(':'); + lcd_print(mstring); + u8g.print('%'); + } + #else + lcd_implementation_status_message(blink); + #endif + } +} + +#endif // _STATUS_SCREEN_DOGM_H_ diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h new file mode 100644 index 000000000..e05d58749 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -0,0 +1,853 @@ +/** + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +/** + * Implementation of a Status Screen for the RepRapDiscount + * Full Graphics Smart Controller using native ST7920 commands + * instead of U8Glib. + * + * This alternative Status Screen makes use of the built-in character + * generation capabilities of the ST7920 to update the Status Screen + * with less SPI traffic and CPU use. In particular: + * + * - The fan and bed animations are handled using custom characters + * that are stored in CGRAM. This allows for the animation to be + * updated by writing a single character to the text-buffer (DDRAM). + * + * - All the information in the Status Screen is text that is written + * to DDRAM, so the work of generating the bitmaps is offloaded to + * the ST7920 rather than being render by U8Glib on the MCU. + * + * - The graphics buffer (GDRAM) is only used for static graphics + * elements (nozzle and feedrate bitmaps) and for the progress + * bar, so updates are sporadic. + */ + +#include "status_screen_lite_ST7920_class.h" + +#include "../../libs/duration_t.h" + +#define BUFFER_WIDTH 256 +#define BUFFER_HEIGHT 32 + +#define DDRAM_LINE_1 0x00 +#define DDRAM_LINE_2 0x10 +#define DDRAM_LINE_3 0x08 +#define DDRAM_LINE_4 0x18 + +ST7920_Lite_Status_Screen::st7920_state_t ST7920_Lite_Status_Screen::current_bits; + +void ST7920_Lite_Status_Screen::cmd(const uint8_t cmd) { + if (!current_bits.synced || !current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = true; + sync_cmd(); + } + write_byte(cmd); +} + +void ST7920_Lite_Status_Screen::begin_data() { + if (!current_bits.synced || current_bits.cmd) { + current_bits.synced = true; + current_bits.cmd = false; + sync_dat(); + } +} + +void ST7920_Lite_Status_Screen::write_str(const char *str) { + while (*str) write_byte(*str++); +} + +void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) { + while (*str && len--) write_byte(*str++); +} + +void ST7920_Lite_Status_Screen::write_str_P(const char * const str) { + const char *p_str = (const char *)str; + while (char c = pgm_read_byte_near(p_str++)) write_byte(c); +} + +void ST7920_Lite_Status_Screen::write_str(progmem_str str) { + write_str_P((const char*)str); +} + +void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) { + char str[7]; + const char *fmt; + switch (digits) { + case 6: fmt = PSTR("%6d"); break; + case 5: fmt = PSTR("%5d"); break; + case 4: fmt = PSTR("%4d"); break; + case 3: fmt = PSTR("%3d"); break; + case 2: fmt = PSTR("%2d"); break; + case 1: fmt = PSTR("%1d"); break; + } + sprintf_P(str, fmt, value); + write_str(str); +} + +void ST7920_Lite_Status_Screen::display_status(const bool display_on, const bool cursor_on, const bool blink_on) { + extended_function_set(false); + cmd(0b00001000 | + (display_on ? 0b0100 : 0) | + (cursor_on ? 0b0010 : 0) | + (blink_on ? 0b0001 : 0) + ); +} + +// Sets the extended and graphics bits simultaneously, regardless of +// the current state. This is a helper function for extended_function_set() +// and graphics() +void ST7920_Lite_Status_Screen::_extended_function_set(const bool extended, const bool graphics) { + cmd( 0b00100000 | + (extended ? 0b00000100 : 0) | + (graphics ? 0b00000010 : 0) + ); + current_bits.extended = extended; + current_bits.graphics = graphics; +} + +void ST7920_Lite_Status_Screen::extended_function_set(const bool extended) { + if (extended != current_bits.extended) + _extended_function_set(extended, current_bits.graphics); +} + +void ST7920_Lite_Status_Screen::graphics(const bool graphics) { + if (graphics != current_bits.graphics) + _extended_function_set(current_bits.extended, graphics); +} + +void ST7920_Lite_Status_Screen::entry_mode_select(const bool ac_increase, const bool shift) { + extended_function_set(false); + cmd(0b00000100 | + (ac_increase ? 0b00000010 : 0) | + (shift ? 0b00000001 : 0) + ); +} + +// Sets the sa bit regardless of the current state. This is a helper +// function for scroll_or_addr_select() +void ST7920_Lite_Status_Screen::_scroll_or_addr_select(const bool sa) { + extended_function_set(true); + cmd(0b00100010 | + (sa ? 0b000001 : 0) + ); + current_bits.sa = sa; +} + +void ST7920_Lite_Status_Screen::scroll_or_addr_select(const bool sa) { + if (sa != current_bits.sa) + _scroll_or_addr_select(sa); +} + +void ST7920_Lite_Status_Screen::set_ddram_address(const uint8_t addr) { + extended_function_set(false); + cmd(0b10000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_cgram_address(const uint8_t addr) { + extended_function_set(false); + cmd(0b01000000 | (addr & 0b00111111)); +} + +void ST7920_Lite_Status_Screen::set_gdram_address(const uint8_t x, const uint8_t y) { + extended_function_set(true); + cmd(0b10000000 | (y & 0b01111111)); + cmd(0b10000000 | (x & 0b00001111)); +} + +void ST7920_Lite_Status_Screen::clear() { + extended_function_set(false); + cmd(0x00000001); + delay(15); //delay for CGRAM clear +} + +void ST7920_Lite_Status_Screen::home() { + extended_function_set(false); + cmd(0x00000010); +} + +/* This fills the entire text buffer with spaces */ +void ST7920_Lite_Status_Screen::clear_ddram() { + set_ddram_address(DDRAM_LINE_1); + begin_data(); + for (uint8_t i = 64; i--;) write_byte(' '); +} + +/* This fills the entire graphics buffer with zeros */ +void ST7920_Lite_Status_Screen::clear_gdram() { + for (uint8_t y = 0; y < BUFFER_HEIGHT; y++) { + set_gdram_address(0, y); + begin_data(); + for (uint8_t i = (BUFFER_WIDTH) / 16; i--;) write_word(0); + } +} + +void ST7920_Lite_Status_Screen::load_cgram_icon(const uint16_t addr, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + set_cgram_address(addr); + begin_data(); + for (uint8_t i = 16; i--;) + write_word(pgm_read_word_near(p_word++)); +} + +/** + * Draw an icon in GDRAM. Position specified in DDRAM + * coordinates. i.e., X from 1 to 8, Y from 1 to 4. + */ +void ST7920_Lite_Status_Screen::draw_gdram_icon(uint8_t x, uint8_t y, const void *data) { + const uint16_t *p_word = (const uint16_t *)data; + if (y > 2) { // Handle display folding + y -= 2; + x += 8; + } + --x; + --y; + for (int i = 0; i < 16; i++) { + set_gdram_address(x, i + y * 16); + begin_data(); + write_word(pgm_read_word_near(p_word++)); + } +} + +/************************** ICON DEFINITIONS *************************************/ + +#define CGRAM_ICON_1_ADDR 0x00 +#define CGRAM_ICON_2_ADDR 0x10 +#define CGRAM_ICON_3_ADDR 0x20 +#define CGRAM_ICON_4_ADDR 0x30 + +#define CGRAM_ICON_1_WORD 0x00 +#define CGRAM_ICON_2_WORD 0x02 +#define CGRAM_ICON_3_WORD 0x04 +#define CGRAM_ICON_4_WORD 0x06 + +const uint16_t nozzle_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000111111110000, + 0b0000111111110000, + 0b0001111111111000, + 0b0001111111111000, + 0b0001111111111000, + 0b0000011111100000, + 0b0000001111000000, + 0b0000000110000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t bed_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0111111111111110, + 0b0111111111111110, + 0b0110000000000110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t heat1_icon[] PROGMEM = { + 0b0000000000000000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t heat2_icon[] PROGMEM = { + 0b0000000000000000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0010001000100000, + 0b0010001000100000, + 0b0001000100010000, + 0b0000100010001000, + 0b0000100010001000, + 0b0001000100010000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t fan1_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110001111000110, + 0b0100001111000010, + 0b0100000110000010, + 0b0101100000011010, + 0b0101110110111010, + 0b0101100000011010, + 0b0100000110000010, + 0b0100001111000010, + 0b0110001111000110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t fan2_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111111111110, + 0b0111000000001110, + 0b0110010000100110, + 0b0100111001110010, + 0b0101111001111010, + 0b0100110000110010, + 0b0100000110000010, + 0b0100110000110010, + 0b0101111001111010, + 0b0100111001110010, + 0b0110010000100110, + 0b0111000000001110, + 0b0111111111111110, + 0b0000000000000000, + 0b0000000000000000 +}; + +const uint16_t feedrate_icon[] PROGMEM = { + 0b0000000000000000, + 0b0111111000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0100000000000000, + 0b0111111011111000, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000010000100, + 0b0100000011111000, + 0b0000000010001000, + 0b0000000010000100, + 0b0000000010000100, + 0b0000000010000010, + 0b0000000000000000, + 0b0000000000000000 +}; + +/************************** MAIN SCREEN *************************************/ + +void ST7920_Lite_Status_Screen::draw_static_elements() { + scroll_or_addr_select(0); + + // Load the animated bed and fan icons + load_cgram_icon(CGRAM_ICON_1_ADDR, heat1_icon); + load_cgram_icon(CGRAM_ICON_2_ADDR, heat2_icon); + load_cgram_icon(CGRAM_ICON_3_ADDR, fan1_icon); + load_cgram_icon(CGRAM_ICON_4_ADDR, fan2_icon); + + // Draw the static icons in GDRAM + draw_gdram_icon(1, 1, nozzle_icon); + #if EXTRUDERS == 2 + draw_gdram_icon(1,2,nozzle_icon); + draw_gdram_icon(1,3,bed_icon); + #else + draw_gdram_icon(1,2,bed_icon); + #endif + draw_gdram_icon(6,2,feedrate_icon); + + // Draw the initial fan icon + draw_fan_icon(false); +} + +/** + * Although this is undocumented, the ST7920 allows the character + * data buffer (DDRAM) to be used in conjunction with the graphics + * bitmap buffer (CGRAM). The contents of the graphics buffer is + * XORed with the data from the character generator. This allows + * us to make the progess bar out of graphical data (the bar) and + * text data (the percentage). + */ +void ST7920_Lite_Status_Screen::draw_progress_bar(const uint8_t value) { + #if EXTRUDERS == 1 + // If we have only one extruder, draw a long progress bar on the third line + const uint8_t top = 1, // Top in pixels + bottom = 13, // Bottom in pixels + left = 8, // Left edge, in 16-bit words + width = 5; // Width of progress bar, in 16-bit words + #else + const uint8_t top = 16 + 1, // Top in pixels + bottom = 16 + 13, // Bottom in pixels + left = 5, // Left edge, in 16-bit words + width = 3; // Width of progress bar, in 16-bit words + #endif + const uint8_t char_pcnt = 100 / width; // How many percent does each 16-bit word represent? + + // Draw the progress bar as a bitmap in CGRAM + for (uint8_t y = top; y <= bottom; y++) { + set_gdram_address(left, y); + begin_data(); + for (uint8_t x = 0; x < width; x++) { + uint16_t gfx_word = 0x0000; + if ((x + 1) * char_pcnt <= value) + gfx_word = 0xFFFF; // Draw completely filled bytes + else if ((x * char_pcnt) < value) + gfx_word = int(0x8000) >> (value % char_pcnt) * 16 / char_pcnt; // Draw partially filled bytes + + // Draw the frame around the progress bar + if (y == top || y == bottom) + gfx_word = 0xFFFF; // Draw top/bottom border + else if (x == width - 1) + gfx_word |= 0x0001; // Draw right border + else if (x == 0) + gfx_word |= 0x8000; // Draw left border + write_word(gfx_word); + } + } + + // Draw the percentage as text in DDRAM + set_ddram_address( + #if EXTRUDERS == 1 + DDRAM_LINE_3 + 1 + #else + DDRAM_LINE_2 + left + #endif + ); + + begin_data(); + if (value > 9) { + write_number(value, 4); + write_str(F("% ")); + } + else { + write_number(value, 3); + write_str(F("% ")); + } +} + +void ST7920_Lite_Status_Screen::draw_fan_icon(const bool whichIcon) { + set_ddram_address(DDRAM_LINE_1 + 5); + begin_data(); + write_word(whichIcon ? CGRAM_ICON_3_WORD : CGRAM_ICON_4_WORD); +} + +void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool heating) { + set_ddram_address( + #if EXTRUDERS == 1 + DDRAM_LINE_2 + #else + DDRAM_LINE_3 + #endif + ); + begin_data(); + if (heating) + write_word(whichIcon ? CGRAM_ICON_1_WORD : CGRAM_ICON_2_WORD); + else { + write_byte(' '); + write_byte(' '); + } +} + +#define FAR(a,b) (((a > b) ? (a-b) : (b-a)) > 1) + +void ST7920_Lite_Status_Screen::draw_extruder_1_temp(const int16_t temp, const int16_t target) { + set_ddram_address(DDRAM_LINE_1 + 1); + begin_data(); + write_number(temp); + if (target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } + else + write_str(F(" ")); +} + +void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const int16_t target) { + set_ddram_address(DDRAM_LINE_2 + 1); + begin_data(); + write_number(temp); + if (target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } + else + write_str(F(" ")); +} + +void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target) { + set_ddram_address( + #if EXTRUDERS == 1 + DDRAM_LINE_2 + 1 + #else + DDRAM_LINE_3 + 1 + #endif + ); + begin_data(); + write_number(temp); + if (target && FAR(temp, target)) { + write_str(F("\x1A")); + write_number(target); + } + else + write_str(F(" ")); +} + +void ST7920_Lite_Status_Screen::draw_fan_speed(const uint8_t value) { + set_ddram_address(DDRAM_LINE_1 + 6); + begin_data(); + write_number(value, 4); +} + +void ST7920_Lite_Status_Screen::draw_print_time(const uint32_t elapsed) { + const uint8_t hrs = elapsed / 3600, + min = (elapsed / 60) % 60; + char str[7]; + sprintf_P(str, hrs > 99 ? PSTR("%03d:%02d") : PSTR(" %02d:%02d"), hrs, min); + + set_ddram_address(DDRAM_LINE_3 + 5); + begin_data(); + write_str(str); +} + +void ST7920_Lite_Status_Screen::draw_feedrate_percentage(const uint8_t percentage) { + // We only have enough room for the feedrate when + // we have one extruder + #if EXTRUDERS == 1 + set_ddram_address(DDRAM_LINE_2 + 6); + begin_data(); + write_number(percentage, 4); + #endif +} + +void ST7920_Lite_Status_Screen::draw_status_message(const char *str) { + set_ddram_address(DDRAM_LINE_4); + begin_data(); + #if ENABLED(STATUS_MESSAGE_SCROLLING) + const uint8_t lcd_len = 16; + const uint8_t padding = 2; + uint8_t str_len = strlen(str); + + // Trim whitespace at the end of the str, as for some reason + // messages like "Card Inserted" are padded with many spaces + while (str_len > 0 && str[str_len - 1] == ' ') str_len--; + + if (str_len <= lcd_len) { + // It all fits on the LCD without scrolling + write_str(str); + } + else { + // Print the message repeatedly until covering the LCD + uint8_t c = status_scroll_pos; + for (uint8_t n = 0; n < lcd_len; n++) { + write_byte(c < str_len ? str[c] : ' '); + c++; + c %= str_len + padding; // Wrap around + } + + // Scroll the message + if (status_scroll_pos == str_len + padding) + status_scroll_pos = 0; + else + status_scroll_pos++; + } + #else + write_str(str, 16); + #endif +} + +void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, const float z, bool position_known) { + char str[7]; + set_ddram_address(DDRAM_LINE_4); + begin_data(); + + // If position is unknown, flash the labels. + const unsigned char alt_label = position_known ? 0 : (lcd_blink() ? ' ' : 0); + + dtostrf(x, -4, 0, str); + write_byte(alt_label ? alt_label : 'X'); + write_str(str, 4); + + dtostrf(y, -4, 0, str); + write_byte(alt_label ? alt_label : 'Y'); + write_str(str, 4); + + dtostrf(z, -5, 1, str); + write_byte(alt_label ? alt_label : 'Z'); + write_str(str, 5); +} + +bool ST7920_Lite_Status_Screen::indicators_changed() { + // We only add the target temperatures to the checksum + // because the actual temps fluctuate so by updating + // them only during blinks we gain a bit of stability. + const bool blink = lcd_blink(); + const uint8_t feedrate_perc = feedrate_percentage; + const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; + const float extruder_1_target = thermalManager.degTargetHotend(0); + #if EXTRUDERS == 2 + const float extruder_2_target = thermalManager.degTargetHotend(1); + #endif + const float bed_target = thermalManager.degTargetBed(); + + static uint8_t last_checksum = 0; + + const uint8_t checksum = + uint8_t(blink) ^ + uint8_t(feedrate_perc) ^ + uint8_t(fan_speed) ^ + uint8_t(extruder_1_target) ^ + #if EXTRUDERS == 2 + uint8_t(extruder_2_target) ^ + #endif + uint8_t(bed_target); + + if (last_checksum == checksum) return false; + + last_checksum = checksum; + return true; +} + +void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) { + if (forceUpdate || indicators_changed()) { + const bool blink = lcd_blink(); + const duration_t elapsed = print_job_timer.duration(); + const uint32_t seconds_elapsed = elapsed.value; + const uint8_t feedrate_perc = feedrate_percentage; + const uint8_t fan_speed = ((fanSpeeds[0] + 1) * 100) / 256; + const float extruder_1_temp = thermalManager.degHotend(0); + const float extruder_1_target = thermalManager.degTargetHotend(0); + #if EXTRUDERS == 2 + const float extruder_2_temp = thermalManager.degHotend(1); + const float extruder_2_target = thermalManager.degTargetHotend(1); + #endif + const float bed_temp = thermalManager.degBed(); + const float bed_target = thermalManager.degTargetBed(); + + draw_extruder_1_temp(extruder_1_temp, extruder_1_target); + #if EXTRUDERS == 2 + draw_extruder_2_temp(extruder_2_temp, extruder_2_target); + #endif + draw_bed_temp(bed_temp, bed_target); + draw_fan_speed(fan_speed); + draw_print_time(seconds_elapsed); + draw_feedrate_percentage(feedrate_perc); + + // Update the fan and bed animations + if (fan_speed > 0) draw_fan_icon(blink); + if (bed_target > 0) + draw_heat_icon(blink, true); + else + draw_heat_icon(false, false); + } +} + +bool ST7920_Lite_Status_Screen::position_changed() { + const float x_pos = current_position[X_AXIS], + y_pos = current_position[Y_AXIS], + z_pos = current_position[Z_AXIS]; + const uint8_t checksum = uint8_t(x_pos) ^ uint8_t(y_pos) ^ uint8_t(z_pos); + + static uint8_t last_checksum = 0; + if (last_checksum == checksum) return false; + last_checksum = checksum; + return true; +} + +bool ST7920_Lite_Status_Screen::status_changed() { + uint8_t checksum = 0; + for (const char *p = lcd_status_message; *p; p++) checksum ^= *p; + + static uint8_t last_checksum = 0; + if (last_checksum == checksum) return false; + last_checksum = checksum; + return true; +} + +bool ST7920_Lite_Status_Screen::blink_changed() { + static uint8_t last_blink = 0; + const bool blink = lcd_blink(); + if (last_blink == blink) return false; + last_blink = blink; + return true; +} + +void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { + static uint8_t countdown = 0; + + /** + * There is only enough room in the display for either the + * status message or the position, not both, so we choose + * one or another. Whenever the status message changes, + * we show it for a number of consecutive seconds, but + * then go back to showing the position as soon as the + * head moves, i.e: + * + * countdown > 1 -- Show status + * countdown = 1 -- Show status, until movement + * countdown = 0 -- Show position + */ + if (forceUpdate || status_changed()) { + #if ENABLED(STATUS_MESSAGE_SCROLLING) + status_scroll_pos = 0; + #endif + #ifndef STATUS_EXPIRE_SECONDS + #define STATUS_EXPIRE_SECONDS 20 + #endif + countdown = lcd_strlen(lcd_status_message) ? STATUS_EXPIRE_SECONDS : 0; + draw_status_message(lcd_status_message); + blink_changed(); // Clear changed flag + } + else if (countdown > 1 && blink_changed()) { + countdown--; + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(lcd_status_message); + #endif + } + else if (countdown > 0 && blink_changed()) { + if (position_changed()) { + countdown--; + forceUpdate = true; + } + #if ENABLED(STATUS_MESSAGE_SCROLLING) + draw_status_message(lcd_status_message); + #endif + } + if (countdown == 0 && (forceUpdate || position_changed() || + #if DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) + blink_changed() + #endif + )) { + draw_position( + current_position[X_AXIS], + current_position[Y_AXIS], + current_position[Z_AXIS], + #if ENABLED(DISABLE_REDUCED_ACCURACY_WARNING) + true + #else + axis_known_position[X_AXIS] && + axis_known_position[Y_AXIS] && + axis_known_position[Z_AXIS] + #endif + ); + } +} + +void ST7920_Lite_Status_Screen::update_progress(const bool forceUpdate) { + const uint8_t percent_done = + #if ENABLED(SDSUPPORT) + card.percentDone() + #else + 0 + #endif + ; + + // Since the progress bar involves writing + // quite a few bytes to GDRAM, only do this + // when an update is actually necessary. + + static uint8_t last_progress = 0; + if (!forceUpdate && last_progress == percent_done) return; + last_progress = percent_done; + + draw_progress_bar(percent_done); +} + +void ST7920_Lite_Status_Screen::update(const bool forceUpdate) { + cs(); + update_indicators(forceUpdate); + update_status_or_position(forceUpdate); + update_progress(forceUpdate); + ncs(); +} + +void ST7920_Lite_Status_Screen::reset_state_from_unknown() { + _extended_function_set(true, true); // Do it twice as only one bit + _extended_function_set(true, true); // get set at a time. + _scroll_or_addr_select(false); +} + +void ST7920_Lite_Status_Screen::on_entry() { + cs(); + reset_state_from_unknown(); + clear(); + clear_gdram(); + draw_static_elements(); + update(true); + ncs(); +} + +void ST7920_Lite_Status_Screen::on_exit() { + cs(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +// This is called prior to the KILL screen to +// clear the screen so we don't end up with a +// garbled display. +void ST7920_Lite_Status_Screen::clear_text_buffer() { + cs(); + reset_state_from_unknown(); + clear(); + _extended_function_set(true, true); // Restore state to what u8g expects. + ncs(); +} + +static void lcd_implementation_status_screen() { + ST7920_Lite_Status_Screen::update(false); +} + +/** + * In order to properly update the lite Status Screen, + * we must know when we have entered and left the + * Status Screen. Since the ultralcd code is not + * set up for doing this, we call this function before + * each update indicating whether the current screen + * is the Status Screen. + * + * This function keeps track of whether we have left or + * entered the Status Screen and calls the on_entry() + * and on_exit() methods for cleanup. + */ +static void lcd_in_status(const bool inStatus) { + static bool lastInStatus = false; + if (lastInStatus == inStatus) return; + if ((lastInStatus = inStatus)) + ST7920_Lite_Status_Screen::on_entry(); + else + ST7920_Lite_Status_Screen::on_exit(); +} diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h new file mode 100644 index 000000000..5812e4751 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_class.h @@ -0,0 +1,108 @@ +/** + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#ifndef STATUS_SCREEN_LITE_ST7920_CLASS_H +#define STATUS_SCREEN_LITE_ST7920_CLASS_H + +#include "../../core/macros.h" + +typedef const __FlashStringHelper *progmem_str; + +class ST7920_Lite_Status_Screen { + private: + static struct st7920_state_t { + uint8_t synced : 1; // Whether a sync has been sent + uint8_t cmd : 1; // Whether the sync was cmd or data + uint8_t extended : 1; + uint8_t graphics : 1; + uint8_t sa : 1; + } current_bits; + + static void cs(); + static void ncs(); + static void sync_cmd(); + static void sync_dat(); + static void write_byte(const uint8_t w); + + FORCE_INLINE static void write_word(const uint16_t w) { + write_byte((w >> 8) & 0xFF); + write_byte((w >> 0) & 0xFF); + } + + static void cmd(const uint8_t cmd); + static void begin_data(); + + static void write_str(const char *str); + static void write_str(const char *str, const uint8_t len); + static void write_str_P(const char * const str); + static void write_str(progmem_str str); + static void write_number(const int16_t value, const uint8_t digits=3); + + static void _extended_function_set(const bool extended, const bool graphics); + static void _scroll_or_addr_select(const bool sa); + static void reset_state_from_unknown(); + + static void home(); + static void display_status(const bool display_on, const bool cursor_on, const bool blink_on); + static void extended_function_set(const bool extended); + static void graphics(const bool graphics); + static void entry_mode_select(const bool ac_increase, const bool shift); + static void scroll_or_addr_select(const bool sa); + static void set_ddram_address(const uint8_t addr); + static void set_cgram_address(const uint8_t addr); + static void set_gdram_address(const uint8_t x, const uint8_t y); + + static void clear(); + static void clear_ddram(); + static void clear_gdram(); + + static void load_cgram_icon(const uint16_t addr, const void *data); + static void draw_gdram_icon(uint8_t x, uint8_t y, const void *data); + + static uint8_t string_checksum(const char *str); + + protected: + static void draw_static_elements(); + static void draw_progress_bar(const uint8_t value); + static void draw_fan_icon(const bool whichIcon); + static void draw_heat_icon(const bool whichIcon, const bool heating); + static void draw_extruder_1_temp(const int16_t temp, const int16_t target); + static void draw_extruder_2_temp(const int16_t temp, const int16_t target); + static void draw_bed_temp(const int16_t temp, const int16_t target); + static void draw_fan_speed(const uint8_t value); + static void draw_print_time(const uint32_t elapsed); + static void draw_feedrate_percentage(const uint8_t percentage); + static void draw_status_message(const char *str); + static void draw_position(const float x, const float y, const float z, bool position_known = true); + + static bool indicators_changed(); + static bool position_changed(); + static bool blink_changed(); + static bool status_changed(); + + static void update_indicators(const bool forceUpdate); + static void update_position(const bool forceUpdate, bool resetChecksum); + static void update_status_or_position(bool forceUpdate); + static void update_progress(const bool forceUpdate); + + public: + static void update(const bool forceUpdate); + static void on_entry(); + static void on_exit(); + static void clear_text_buffer(); +}; + +#endif // STATUS_SCREEN_LITE_ST7920_CLASS_H diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h new file mode 100644 index 000000000..9c59068f4 --- /dev/null +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920_spi.h @@ -0,0 +1,39 @@ +/** + * Lightweight Status Screen for the RepRapDiscount Full + * Graphics Smart Controller (ST7920-based 128x64 LCD) + * + * (c) 2017 Aleph Objects, Inc. + * + * The code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + */ + +#include "status_screen_lite_ST7920_class.h" + +void ST7920_Lite_Status_Screen::cs() { + ST7920_CS(); + current_bits.synced = false; +} + +void ST7920_Lite_Status_Screen::ncs() { + ST7920_NCS(); + current_bits.synced = false; +} + +void ST7920_Lite_Status_Screen::sync_cmd() { + ST7920_SET_CMD(); +} + +void ST7920_Lite_Status_Screen::sync_dat() { + ST7920_SET_DAT(); +} + +void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { + ST7920_WRITE_BYTE(data); +} 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 58d99e594..91692eb62 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -125,10 +125,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_BYTE(0x20); //non-extended mode ST7920_WRITE_BYTE(0x08); //display off, cursor+blink off - ST7920_WRITE_BYTE(0x01); //clear CGRAM ram - u8g_Delay(15); //delay for CGRAM clear - ST7920_WRITE_BYTE(0x3E); //extended mode + GDRAM active + ST7920_WRITE_BYTE(0x01); //clear DDRAM ram + u8g_Delay(15); //delay for DDRAM clear + ST7920_WRITE_BYTE(0x24); //extended mode + ST7920_WRITE_BYTE(0x26); //extended mode + GDRAM active for (y = 0; y < (LCD_PIXEL_HEIGHT) / 2; y++) { //clear GDRAM ST7920_WRITE_BYTE(0x80 | y); //set y ST7920_WRITE_BYTE(0x80); //set x = 0 @@ -182,6 +184,12 @@ 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(LIGHTWEIGHT_UI) + // We have to include the code for the lightweight UI here + // as it relies on macros that are only defined in this file. + #include "status_screen_lite_ST7920_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 5bf308d3c..d72e69919 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -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(); diff --git a/Marlin/src/lcd/ultralcd_impl_DOGM.h b/Marlin/src/lcd/ultralcd_impl_DOGM.h index a03bd4873..24565a832 100644 --- a/Marlin/src/lcd/ultralcd_impl_DOGM.h +++ b/Marlin/src/lcd/ultralcd_impl_DOGM.h @@ -353,6 +353,12 @@ void lcd_printPGM_utf(const char *str, uint8_t n=LCD_WIDTH) { #endif // SHOW_BOOTSCREEN +#if ENABLED(LIGHTWEIGHT_UI) + #include "dogm/status_screen_lite_ST7920.h" +#else + #include "dogm/status_screen_DOGM.h" +#endif + // Initialize or re-initialize the LCD static void lcd_implementation_init() { @@ -383,6 +389,9 @@ static void lcd_implementation_init() { // The kill screen is displayed for unrecoverable conditions void lcd_kill_screen() { + #if ENABLED(LIGHTWEIGHT_UI) + ST7920_Lite_Status_Screen::clear_text_buffer(); + #endif const uint8_t h4 = u8g.getHeight() / 4; u8g.firstPage(); do { @@ -398,420 +407,6 @@ void lcd_kill_screen() { void lcd_implementation_clear() { } // Automatically cleared by Picture Loop -// -// Status Screen -// - -FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t x, const uint8_t y) { - const char * const str = itostr3(temp); - u8g.setPrintPos(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y); - lcd_print(str); - lcd_printPGM(PSTR(LCD_STR_DEGREE " ")); -} - -#ifndef HEAT_INDICATOR_X - #define HEAT_INDICATOR_X 8 -#endif - -FORCE_INLINE void _draw_heater_status(const uint8_t x, const int8_t heater, const bool blink) { - #if !HEATER_IDLE_HANDLER - UNUSED(blink); - #endif - - #if HAS_TEMP_BED - const bool isBed = heater < 0; - #else - constexpr bool isBed = false; - #endif - - if (PAGE_UNDER(7)) { - #if HEATER_IDLE_HANDLER - const bool is_idle = (!isBed ? thermalManager.is_heater_idle(heater) : - #if HAS_TEMP_BED - thermalManager.is_bed_idle() - #else - false - #endif - ); - - if (blink || !is_idle) - #endif - _draw_centered_temp((isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)) + 0.5, x, 7); } - - if (PAGE_CONTAINS(21, 28)) - _draw_centered_temp((isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)) + 0.5, x, 28); - - if (PAGE_CONTAINS(17, 20)) { - const uint8_t h = isBed ? 7 : HEAT_INDICATOR_X, - y = isBed ? 18 : 17; - if (isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater)) { - u8g.setColorIndex(0); // white on black - u8g.drawBox(x + h, y, 2, 2); - u8g.setColorIndex(1); // black on white - } - else { - u8g.drawBox(x + h, y, 2, 2); - } - } -} - -FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) { - if (blink) - lcd_printPGM(pstr); - else { - if (!axis_homed[axis]) - u8g.print('?'); - else { - #if DISABLED(HOME_AFTER_DEACTIVATE) && DISABLED(DISABLE_REDUCED_ACCURACY_WARNING) - if (!axis_known_position[axis]) - u8g.print(' '); - else - #endif - lcd_printPGM(pstr); - } - } -} - -inline void lcd_implementation_status_message(const bool blink) { - #if ENABLED(STATUS_MESSAGE_SCROLLING) - static bool last_blink = false; - const uint8_t slen = lcd_strlen(lcd_status_message); - const char *stat = lcd_status_message + status_scroll_pos; - if (slen <= LCD_WIDTH) - lcd_print_utf(stat); // The string isn't scrolling - else { - if (status_scroll_pos <= slen - LCD_WIDTH) - lcd_print_utf(stat); // The string fills the screen - else { - uint8_t chars = LCD_WIDTH; - if (status_scroll_pos < slen) { // First string still visible - lcd_print_utf(stat); // The string leaves space - chars -= slen - status_scroll_pos; // Amount of space left - } - u8g.print('.'); // Always at 1+ spaces left, draw a dot - if (--chars) { - if (status_scroll_pos < slen + 1) // Draw a second dot if there's space - --chars, u8g.print('.'); - if (chars) lcd_print_utf(lcd_status_message, chars); // Print a second copy of the message - } - } - if (last_blink != blink) { - last_blink = blink; - // Skip any non-printing bytes - if (status_scroll_pos < slen) while (!PRINTABLE(lcd_status_message[status_scroll_pos])) status_scroll_pos++; - if (++status_scroll_pos >= slen + 2) status_scroll_pos = 0; - } - } - #else - UNUSED(blink); - lcd_print_utf(lcd_status_message); - #endif -} - -static void lcd_implementation_status_screen() { - - const bool blink = lcd_blink(); - - #if FAN_ANIM_FRAMES > 2 - static bool old_blink; - static uint8_t fan_frame; - if (old_blink != blink) { - old_blink = blink; - if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0; - } - #endif - - // Status Menu Font - lcd_setFont(FONT_STATUSMENU); - - // - // Fan Animation - // - // Draws the whole heading image as a B/W bitmap rather than - // drawing the elements separately. - // This was done as an optimization, as it was slower to draw - // multiple parts compared to a single bitmap. - // - // The bitmap: - // - May be offset in X - // - Includes all nozzle(s), bed(s), and the fan. - // - // TODO: - // - // - Only draw the whole header on the first - // entry to the status screen. Nozzle, bed, and - // fan outline bits don't change. - // - if (PAGE_UNDER(STATUS_SCREENHEIGHT + 1)) { - - u8g.drawBitmapP( - STATUS_SCREEN_X, STATUS_SCREEN_Y, - (STATUS_SCREENWIDTH + 7) / 8, STATUS_SCREENHEIGHT, - #if HAS_FAN0 - #if FAN_ANIM_FRAMES > 2 - fan_frame == 1 ? status_screen1_bmp : - fan_frame == 2 ? status_screen2_bmp : - #if FAN_ANIM_FRAMES > 3 - fan_frame == 3 ? status_screen3_bmp : - #endif - #else - blink && fanSpeeds[0] ? status_screen1_bmp : - #endif - #endif - status_screen0_bmp - ); - - } - - // - // Temperature Graphics and Info - // - - if (PAGE_UNDER(28)) { - // Extruders - HOTEND_LOOP() _draw_heater_status(STATUS_SCREEN_HOTEND_TEXT_X(e), e, blink); - - // Heated bed - #if HOTENDS < 4 && HAS_TEMP_BED - _draw_heater_status(STATUS_SCREEN_BED_TEXT_X, -1, blink); - #endif - - #if HAS_FAN0 - if (PAGE_CONTAINS(20, 27)) { - // Fan - const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256; - if (per) { - u8g.setPrintPos(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y); - lcd_print(itostr3(per)); - u8g.print('%'); - } - } - #endif - } - - #if ENABLED(SDSUPPORT) - // - // SD Card Symbol - // - if (card.isFileOpen() && PAGE_CONTAINS(42 - (TALL_FONT_CORRECTION), 51 - (TALL_FONT_CORRECTION))) { - // Upper box - u8g.drawBox(42, 42 - (TALL_FONT_CORRECTION), 8, 7); // 42-48 (or 41-47) - // Right edge - u8g.drawBox(50, 44 - (TALL_FONT_CORRECTION), 2, 5); // 44-48 (or 43-47) - // Bottom hollow box - u8g.drawFrame(42, 49 - (TALL_FONT_CORRECTION), 10, 4); // 49-52 (or 48-51) - // Corner pixel - u8g.drawPixel(50, 43 - (TALL_FONT_CORRECTION)); // 43 (or 42) - } - #endif // SDSUPPORT - - #if ENABLED(SDSUPPORT) || ENABLED(LCD_SET_PROGRESS_MANUALLY) - // - // Progress bar frame - // - #define PROGRESS_BAR_X 54 - #define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X) - - if (PAGE_CONTAINS(49, 52 - (TALL_FONT_CORRECTION))) // 49-52 (or 49-51) - u8g.drawFrame( - PROGRESS_BAR_X, 49, - PROGRESS_BAR_WIDTH, 4 - (TALL_FONT_CORRECTION) - ); - - #if DISABLED(LCD_SET_PROGRESS_MANUALLY) - const uint8_t progress_bar_percent = card.percentDone(); - #endif - - if (progress_bar_percent > 1) { - - // - // Progress bar solid part - // - - if (PAGE_CONTAINS(50, 51 - (TALL_FONT_CORRECTION))) // 50-51 (or just 50) - u8g.drawBox( - PROGRESS_BAR_X + 1, 50, - (uint16_t)((PROGRESS_BAR_WIDTH - 2) * progress_bar_percent * 0.01), 2 - (TALL_FONT_CORRECTION) - ); - - // - // SD Percent Complete - // - - #if ENABLED(DOGM_SD_PERCENT) - if (PAGE_CONTAINS(41, 48)) { - // Percent complete - u8g.setPrintPos(55, 48); - u8g.print(itostr3(progress_bar_percent)); - u8g.print('%'); - } - #endif - } - - // - // Elapsed Time - // - - #if DISABLED(DOGM_SD_PERCENT) - #define SD_DURATION_X (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH / 2) - len * (DOG_CHAR_WIDTH / 2)) - #else - #define SD_DURATION_X (LCD_PIXEL_WIDTH - len * DOG_CHAR_WIDTH) - #endif - - if (PAGE_CONTAINS(41, 48)) { - char buffer[10]; - duration_t elapsed = print_job_timer.duration(); - bool has_days = (elapsed.value >= 60*60*24L); - uint8_t len = elapsed.toDigital(buffer, has_days); - u8g.setPrintPos(SD_DURATION_X, 48); - lcd_print(buffer); - } - - #endif // SDSUPPORT || LCD_SET_PROGRESS_MANUALLY - - // - // XYZ Coordinates - // - - #if ENABLED(USE_SMALL_INFOFONT) - #define INFO_FONT_HEIGHT 7 - #else - #define INFO_FONT_HEIGHT 8 - #endif - - #define XYZ_BASELINE (30 + INFO_FONT_HEIGHT) - - #define X_LABEL_POS 3 - #define X_VALUE_POS 11 - #define XYZ_SPACING 40 - - #if ENABLED(XYZ_HOLLOW_FRAME) - #define XYZ_FRAME_TOP 29 - #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 3 - #else - #define XYZ_FRAME_TOP 30 - #define XYZ_FRAME_HEIGHT INFO_FONT_HEIGHT + 1 - #endif - - // Before homing the axis letters are blinking 'X' <-> '?'. - // When axis is homed but axis_known_position is false the axis letters are blinking 'X' <-> ' '. - // When everything is ok you see a constant 'X'. - - static char xstring[5], ystring[5], zstring[7]; - #if ENABLED(FILAMENT_LCD_DISPLAY) - static char wstring[5], mstring[4]; - #endif - - // At the first page, regenerate the XYZ strings - if (page.page == 0) { - strcpy(xstring, ftostr4sign(LOGICAL_X_POSITION(current_position[X_AXIS]))); - strcpy(ystring, ftostr4sign(LOGICAL_Y_POSITION(current_position[Y_AXIS]))); - strcpy(zstring, ftostr52sp(FIXFLOAT(LOGICAL_Z_POSITION(current_position[Z_AXIS])))); - #if ENABLED(FILAMENT_LCD_DISPLAY) - strcpy(wstring, ftostr12ns(filament_width_meas)); - strcpy(mstring, itostr3(100.0 * ( - parser.volumetric_enabled - ? planner.volumetric_area_nominal / planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] - : planner.volumetric_multiplier[FILAMENT_SENSOR_EXTRUDER_NUM] - ) - )); - #endif - } - - if (PAGE_CONTAINS(XYZ_FRAME_TOP, XYZ_FRAME_TOP + XYZ_FRAME_HEIGHT - 1)) { - - #if ENABLED(XYZ_HOLLOW_FRAME) - u8g.drawFrame(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 29-40 7: 29-39 - #else - u8g.drawBox(0, XYZ_FRAME_TOP, LCD_PIXEL_WIDTH, XYZ_FRAME_HEIGHT); // 8: 30-39 7: 30-37 - #endif - - if (PAGE_CONTAINS(XYZ_BASELINE - (INFO_FONT_HEIGHT - 1), XYZ_BASELINE)) { - - #if DISABLED(XYZ_HOLLOW_FRAME) - u8g.setColorIndex(0); // white on black - #endif - - u8g.setPrintPos(0 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - _draw_axis_label(X_AXIS, PSTR(MSG_X), blink); - u8g.setPrintPos(0 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - lcd_print(xstring); - - u8g.setPrintPos(1 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - _draw_axis_label(Y_AXIS, PSTR(MSG_Y), blink); - u8g.setPrintPos(1 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - lcd_print(ystring); - - u8g.setPrintPos(2 * XYZ_SPACING + X_LABEL_POS, XYZ_BASELINE); - _draw_axis_label(Z_AXIS, PSTR(MSG_Z), blink); - u8g.setPrintPos(2 * XYZ_SPACING + X_VALUE_POS, XYZ_BASELINE); - lcd_print(zstring); - - #if DISABLED(XYZ_HOLLOW_FRAME) - u8g.setColorIndex(1); // black on white - #endif - } - } - - // - // Feedrate - // - - if (PAGE_CONTAINS(51 - INFO_FONT_HEIGHT, 49)) { - lcd_setFont(FONT_MENU); - u8g.setPrintPos(3, 50); - lcd_print(LCD_STR_FEEDRATE[0]); - - lcd_setFont(FONT_STATUSMENU); - u8g.setPrintPos(12, 50); - lcd_print(itostr3(feedrate_percentage)); - u8g.print('%'); - - // - // Filament sensor display if SD is disabled - // - #if ENABLED(FILAMENT_LCD_DISPLAY) && DISABLED(SDSUPPORT) - u8g.setPrintPos(56, 50); - lcd_print(wstring); - u8g.setPrintPos(102, 50); - lcd_print(mstring); - u8g.print('%'); - lcd_setFont(FONT_MENU); - u8g.setPrintPos(47, 50); - lcd_print(LCD_STR_FILAM_DIA); - u8g.setPrintPos(93, 50); - lcd_print(LCD_STR_FILAM_MUL); - #endif - } - - // - // Status line - // - - #define STATUS_BASELINE (55 + INFO_FONT_HEIGHT) - - if (PAGE_CONTAINS(STATUS_BASELINE - (INFO_FONT_HEIGHT - 1), STATUS_BASELINE)) { - u8g.setPrintPos(0, STATUS_BASELINE); - - #if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT) - if (PENDING(millis(), previous_lcd_status_ms + 5000UL)) { //Display both Status message line and Filament display on the last line - lcd_implementation_status_message(blink); - } - else { - lcd_printPGM(PSTR(LCD_STR_FILAM_DIA)); - u8g.print(':'); - lcd_print(wstring); - lcd_printPGM(PSTR(" " LCD_STR_FILAM_MUL)); - u8g.print(':'); - lcd_print(mstring); - u8g.print('%'); - } - #else - lcd_implementation_status_message(blink); - #endif - } -} - #if ENABLED(ULTIPANEL) uint8_t row_y1, row_y2; From 556abc08886b1c2cd6fad94498dbc901bd008250 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 21 Feb 2018 23:50:01 -0600 Subject: [PATCH 12/12] Add LIGHTWEIGHT_UI to example configs --- .../AlephObjects/TAZ4/Configuration_adv.h | 16 ++++++++++++++++ .../src/config/examples/Anet/A6/Configuration.h | 2 -- .../config/examples/Anet/A6/Configuration_adv.h | 16 ++++++++++++++++ .../src/config/examples/Anet/A8/Configuration.h | 2 -- .../config/examples/Anet/A8/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Azteeg/X5GT/Configuration_adv.h | 16 ++++++++++++++++ .../examples/BIBO/TouchX/Configuration_adv.h | 16 ++++++++++++++++ .../examples/BQ/Hephestos/Configuration_adv.h | 16 ++++++++++++++++ .../examples/BQ/Hephestos_2/Configuration_adv.h | 16 ++++++++++++++++ .../examples/BQ/WITBOX/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/Cartesio/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Creality/CR-10/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Creality/CR-10S/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Creality/Ender/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/Felix/Configuration_adv.h | 16 ++++++++++++++++ .../FolgerTech/i3-2020/Configuration_adv.h | 16 ++++++++++++++++ .../Infitary/i3-M508/Configuration_adv.h | 16 ++++++++++++++++ .../examples/JGAurora/A5/Configuration_adv.h | 16 ++++++++++++++++ .../examples/MakerParts/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Malyan/M150/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Malyan/M200/Configuration_adv.h | 16 ++++++++++++++++ .../Micromake/C1/enhanced/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Mks/Sbase/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/RigidBot/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/SCARA/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Sanguinololu/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/TheBorg/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/TinyBoy2/Configuration_adv.h | 16 ++++++++++++++++ .../UltiMachine/Archim2/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Velleman/K8200/Configuration_adv.h | 16 ++++++++++++++++ .../examples/Velleman/K8400/Configuration_adv.h | 16 ++++++++++++++++ .../Wanhao/Duplicator 6/Configuration_adv.h | 16 ++++++++++++++++ .../FLSUN/auto_calibrate/Configuration_adv.h | 16 ++++++++++++++++ .../delta/FLSUN/kossel/Configuration_adv.h | 16 ++++++++++++++++ .../delta/FLSUN/kossel_mini/Configuration_adv.h | 16 ++++++++++++++++ .../examples/delta/generic/Configuration_adv.h | 16 ++++++++++++++++ .../delta/kossel_mini/Configuration_adv.h | 16 ++++++++++++++++ .../delta/kossel_pro/Configuration_adv.h | 16 ++++++++++++++++ .../examples/delta/kossel_xl/Configuration_adv.h | 16 ++++++++++++++++ .../gCreate/gMax1.5+/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/makibox/Configuration_adv.h | 16 ++++++++++++++++ .../examples/tvrrug/Round2/Configuration_adv.h | 16 ++++++++++++++++ .../config/examples/wt150/Configuration_adv.h | 16 ++++++++++++++++ 43 files changed, 656 insertions(+), 4 deletions(-) diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index 125bd9141..cea866311 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index e5875112d..4ac60c6e3 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -1675,8 +1675,6 @@ // 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 -// //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER // diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index 20c4cc06a..e5970eeb3 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index b5b779f2a..6afc9374d 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -1534,8 +1534,6 @@ // 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 -// //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER // diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index d23d26073..a2597b3cd 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h index dcd33b768..c5eeafaad 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h @@ -657,6 +657,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h b/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h index 50ef23cc3..6377d2e4d 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h +++ b/Marlin/src/config/examples/BIBO/TouchX/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index 8f5bc3f12..0051f608c 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index 3be8f8dcd..06f33d4c7 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index 8f5bc3f12..0051f608c 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 60220f1db..8d86f0235 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index 282ce0cc9..8d5cf3f80 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h index 25441b009..d4a2e5f97 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h b/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h index 6727bf256..6ed16d050 100644 --- a/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/Ender/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 51a76484a..29efba3dc 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index f6f5270fe..7d1b2726a 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index ffe39b02a..644d356e6 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h index 81a98c8eb..f0fb352ad 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/MakerParts/Configuration_adv.h b/Marlin/src/config/examples/MakerParts/Configuration_adv.h index 315347e1a..628e94e29 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration_adv.h +++ b/Marlin/src/config/examples/MakerParts/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 6f9f527a2..f9f50061e 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h index eeb56edfe..189b4daf3 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index 4b562b787..241914681 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index 198f4fcd6..909584283 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -664,6 +664,22 @@ #define DOGLCD_MOSI MOSI_PIN #endif + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 2cd9e5448..138266a96 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index be551646e..fe21220d1 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index f0bded8d7..26f64f458 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/TheBorg/Configuration_adv.h b/Marlin/src/config/examples/TheBorg/Configuration_adv.h index 5114bb82f..5cb450a58 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration_adv.h +++ b/Marlin/src/config/examples/TheBorg/Configuration_adv.h @@ -653,6 +653,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index cd72fd0eb..057f4438a 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h index 5d0b1697d..bb0a61716 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index 99d956b3c..fd6b4e344 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -669,6 +669,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index 5ea9cd203..d22b7547b 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h index 892d2f985..2ff90dc52 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 3370fb4f0..442978a49 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h index 7379b0eb5..ea12964b7 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index f15d97279..85d281b06 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index f15d97279..85d281b06 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index f15d97279..85d281b06 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index 1d6de6966..2e1c120b2 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -663,6 +663,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index 8b5b3a99e..311d1de36 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -658,6 +658,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 122bc6b0e..96a6abab6 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index bd489d539..205be2528 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index dd3e88e40..c8c302689 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -656,6 +656,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 704db84b5..720177f83 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -657,6 +657,22 @@ // Swap the CW/CCW indicators in the graphics overlay //#define OVERLAY_GFX_REVERSE + #if ENABLED(U8GLIB_ST7920) + /** + * ST7920-based LCDs can emulate a 16 x 4 character display using + * the ST7920 character-generator for very fast screen updates. + * Enable LIGHTWEIGHT_UI to use this special display mode. + * + * Since LIGHTWEIGHT_UI has limited space, the position and status + * message occupy the same line. Set STATUS_EXPIRE_SECONDS to the + * length of time to display the status message before clearing. + */ + //#define LIGHTWEIGHT_UI + #if ENABLED(LIGHTWEIGHT_UI) + #define STATUS_EXPIRE_SECONDS 20 + #endif + #endif + #endif // DOGLCD // @section safety