Convert DOGM / HD44780 impl to CPP files

2.0.x
Scott Lahteine 6 years ago
parent 182b1405d9
commit c825c419d4

@ -20,15 +20,25 @@
*
*/
#ifndef ULTRALCD_IMPL_HD44780_H
#define ULTRALCD_IMPL_HD44780_H
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD)
/**
* ultralcd_impl_HD44780.cpp
*
* Implementation of the LCD display routines for a Hitachi HD44780 display.
* These are the most common LCD character displays.
*/
#include "ultralcd_common_HD44780.h"
#include "../ultralcd.h"
#include "../../sd/cardreader.h"
#include "../../module/temperature.h"
#include "../../module/printcounter.h"
#include "../../module/planner.h"
#include "../../module/motion.h"
////////////////////////////////////
// Create LCD class instance and chipset-specific information
@ -1043,6 +1053,7 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
const char *outstr = theCard.longest_filename();
if (theCard.longFilename[0]) {
#if ENABLED(SCROLL_LONG_FILENAMES)
static uint8_t filename_scroll_hash;
if (sel) {
uint8_t name_hash = row;
for (uint8_t l = FILENAME_LENGTH; l--;)
@ -1080,6 +1091,8 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
extern millis_t next_button_update_ms;
static uint8_t lcd_implementation_read_slow_buttons() {
#if ENABLED(LCD_I2C_TYPE_MCP23017)
// Reading these buttons this is likely to be too slow to call inside interrupt context
@ -1570,4 +1583,4 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
#endif // ULTIPANEL
#endif // ULTRALCD_IMPL_HD44780_H
#endif // ULTRA_LCD && !DOGLCD

@ -29,6 +29,8 @@
#ifndef _STATUS_SCREEN_DOGM_H_
#define _STATUS_SCREEN_DOGM_H_
#include "../../module/motion.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);
lcd_moveto(x - (str[0] != ' ' ? 0 : str[1] != ' ' ? 1 : 2) * DOG_CHAR_WIDTH / 2, y);

@ -963,7 +963,7 @@ void lcd_impl_status_screen_0() {
* entered the Status Screen and calls the on_entry()
* and on_exit() methods for cleanup.
*/
static void lcd_in_status(const bool inStatus) {
void lcd_in_status(const bool inStatus) {
static bool lastInStatus = false;
if (lastInStatus == inStatus) return;
if ((lastInStatus = inStatus))

@ -21,9 +21,11 @@
*/
/**
* ultralcd_impl_DOGM.h
* ultralcd_impl_DOGM.cpp
*
* Implementation of the LCD display routines for a DOGM128 graphic display.
* by STB for ErikZalm/Marlin. Common LCD 128x64 pixel graphic displays.
*
* Graphics LCD implementation for 128x64 pixel LCDs by STB for ErikZalm/Marlin
* Demonstrator: http://www.reprap.org/wiki/STB_Electronics
* License: http://opensource.org/licenses/BSD-3-Clause
*
@ -33,34 +35,34 @@
* License: http://opensource.org/licenses/BSD-3-Clause
*/
#ifndef ULTRALCD_IMPL_DOGM_H
#define ULTRALCD_IMPL_DOGM_H
#include "../../inc/MarlinConfigPre.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
/**
* Implementation of the LCD display routines for a DOGM128 graphic display.
* These are common LCD 128x64 pixel graphic displays.
*/
#include "../ultralcd.h"
#include "dogm_bitmaps.h"
#if ENABLED(SDSUPPORT)
#include "../../libs/duration_t.h"
#endif
#include <U8glib.h>
#include "HAL_LCD_class_defines.h"
#include "../fontutils.h"
#include "u8g_fontutf8.h"
#include "dogm_bitmaps.h"
#include "HAL_LCD_class_defines.h"
#include "../../sd/cardreader.h"
#include "../../module/temperature.h"
#include "../../module/printcounter.h"
#if ENABLED(SDSUPPORT)
#include "../../libs/duration_t.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../../feature/bedlevel/ubl/ubl.h"
#endif
// The Marlin special symbols is now in the dogm_font_data_ISO10646_1.h
#define FONT_SPECIAL_NAME ISO10646_1_5x7
// Only Western languages support big / small fonts
#if DISABLED(DISPLAY_CHARSET_ISO10646_1)
#undef USE_BIG_EDIT_FONT
@ -76,21 +78,11 @@
#define INFO_FONT_HEIGHT 8
#endif
// The Marlin special symbols is now in the dogm_font_data_ISO10646_1.h
#define FONT_SPECIAL_NAME ISO10646_1_5x7
#include LANGUAGE_DATA_INCL(LCD_LANGUAGE)
#include "dogm_font_data_ISO10646_1.h"
#define FONT_MENU_NAME ISO10646_1_5x7
//#define FONT_STATUSMENU_NAME FONT_MENU_NAME
#define FONT_STATUSMENU 1
#define FONT_SPECIAL 2
#define FONT_MENU_EDIT 3
#define FONT_MENU 4
// DOGM parameters (size in pixels)
#define DOG_CHAR_WIDTH 6
#define DOG_CHAR_HEIGHT 12
@ -110,78 +102,7 @@
#define START_COL 0
// LCD selection
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card)
#else
U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes, SW SPI
#endif
#elif ENABLED(U8GLIB_ST7920)
// RepRap Discount Full Graphics Smart Controller
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
U8GLIB_ST7920_128X64_4X_HAL u8g(LCD_PINS_RS); // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
#else
//U8GLIB_ST7920_128X64_4X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Original u8glib device. 2 stripes, SW SPI
U8GLIB_ST7920_128X64_RRD u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS); // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
// AVR version ignores these pin settings
// HAL version uses these pin settings
#endif
#elif ENABLED(CARTESIO_UI)
// The CartesioUI display
//U8GLIB_DOGM128_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes
U8GLIB_DOGM128_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
#elif ENABLED(U8GLIB_LM6059_AF)
// Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
//U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); // 8 stripes
U8GLIB_LM6059_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
#elif ENABLED(U8GLIB_ST7565_64128N)
// The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
#define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
#if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
U8GLIB_64128N_2X_HAL u8g(DOGLCD_CS, DOGLCD_A0); // using HW-SPI
#else
U8GLIB_64128N_2X_HAL u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // using SW-SPI
#endif
#elif ENABLED(MKS_12864OLED_SSD1306)
// MKS 128x64 (SSD1306) OLED I2C LCD
U8GLIB_SSD1306_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 8 stripes
//U8GLIB_SSD1306_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes
#elif ENABLED(U8GLIB_SSD1306)
// Generic support for SSD1306 OLED I2C LCDs
//U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
U8GLIB_SSD1306_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
#elif ENABLED(MKS_12864OLED)
// MKS 128x64 (SH1106) OLED I2C LCD
U8GLIB_SH1106_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 8 stripes
//U8GLIB_SH1106_128X64_2X u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0); // 4 stripes
#elif ENABLED(U8GLIB_SH1106)
// Generic support for SH1106 OLED I2C LCDs
//U8GLIB_SH1106_128X64_2X_I2C_2_WIRE u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
U8GLIB_SH1106_128X64_2X u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST); // 4 stripes
#elif ENABLED(U8GLIB_SSD1309)
// Generic support for SSD1309 OLED I2C LCDs
U8GLIB_SSD1309_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST);
#elif ENABLED(MINIPANEL)
// The MINIPanel display
//U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0); // 8 stripes
U8GLIB_MINI12864_2X u8g(DOGLCD_CS, DOGLCD_A0); // 4 stripes
#elif ENABLED(U8GLIB_SH1106_EINSTART)
// Connected via motherboard header
U8GLIB_SH1106_128X64 u8g(DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS);
#else
// for regular DOGM128 display with HW-SPI
//U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 // 8 stripes
U8GLIB_DOGM128_2X u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0 // 4 stripes
#endif
U8G_CLASS u8g(U8G_PARAM);
U8GLIB *pu8g = &u8g;
#ifndef LCD_PIXEL_WIDTH
@ -193,8 +114,16 @@ U8GLIB *pu8g = &u8g;
#include "../lcdprint.h"
int16_t lcd_contrast; // Initialized by settings.load()
static char currentfont = 0;
#if HAS_LCD_CONTRAST
int16_t lcd_contrast; // Initialized by settings.load()
void set_lcd_contrast(const int16_t value) {
lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
u8g.setContrast(lcd_contrast);
}
#endif
// The current graphical page being rendered
u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p;
@ -203,13 +132,16 @@ u8g_page_t &page = ((u8g_pb_t *)((u8g.getU8g())->dev->dev_mem))->p;
#define PAGE_UNDER(yb) (u8g.getU8g()->current_page.y0 <= (yb))
#define PAGE_CONTAINS(ya, yb) (PAGE_UNDER(yb) && u8g.getU8g()->current_page.y1 >= (ya))
static void lcd_setFont(const char font_nr) {
switch (font_nr) {
case FONT_STATUSMENU : {u8g.setFont(FONT_STATUSMENU_NAME); currentfont = FONT_STATUSMENU;}; break;
void lcd_setFont(const MarlinFont font_nr) {
static char currentfont = 0;
if (font_nr != currentfont) {
switch ((currentfont = font_nr)) {
case FONT_STATUSMENU : u8g.setFont(FONT_STATUSMENU_NAME); break;
default:
case FONT_MENU : {u8g.setFont(FONT_MENU_NAME); currentfont = FONT_MENU;}; break;
case FONT_SPECIAL : {u8g.setFont(FONT_SPECIAL_NAME); currentfont = FONT_SPECIAL;}; break;
case FONT_MENU_EDIT : {u8g.setFont(FONT_MENU_EDIT_NAME); currentfont = FONT_MENU_EDIT;}; break;
case FONT_MENU : u8g.setFont(FONT_MENU_NAME); break;
case FONT_SPECIAL : u8g.setFont(FONT_SPECIAL_NAME); break;
case FONT_MENU_EDIT : u8g.setFont(FONT_MENU_EDIT_NAME); break;
}
}
}
@ -324,8 +256,8 @@ void lcd_implementation_init() {
u8g.begin();
#endif
#if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
u8g.setContrast(lcd_contrast);
#if HAS_LCD_CONTRAST
set_lcd_contrast(lcd_contrast);
#endif
#if ENABLED(LCD_SCREEN_ROT_90)
@ -336,7 +268,7 @@ void lcd_implementation_init() {
u8g.setRot270(); // Rotate screen by 270°
#endif
uxg_SetUtf8Fonts (g_fontinfo, NUM_ARRAY(g_fontinfo));
uxg_SetUtf8Fonts(g_fontinfo, NUM_ARRAY(g_fontinfo));
}
// The kill screen is displayed for unrecoverable conditions
@ -526,6 +458,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
const char *outstr = theCard.longest_filename();
if (theCard.longFilename[0]) {
#if ENABLED(SCROLL_LONG_FILENAMES)
static uint8_t filename_scroll_hash;
if (isSelected) {
uint8_t name_hash = row;
for (uint8_t l = FILENAME_LENGTH; l--;)
@ -682,4 +615,4 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
#endif // ULTIPANEL
#endif // __ULTRALCD_IMPL_DOGM_H
#endif // DOGLCD

@ -6,8 +6,7 @@
* @date 2016-08-19
* @copyright GPL/BSD
*/
#ifndef _LCDPRINT_H
#define _LCDPRINT_H
#pragma once
#include "fontutils.h"
@ -56,5 +55,3 @@ inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LE
inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_wchar(wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
#endif // _LCDPRINT_H

@ -54,10 +54,6 @@
#include "../../libs/duration_t.h"
#endif
#if ENABLED(FILAMENT_LCD_DISPLAY)
#include "../../feature/filwidth.h"
#endif
#if ENABLED(BLTOUCH)
#include "../../module/endstops.h"
#endif
@ -74,15 +70,6 @@
#include "../../feature/runout.h"
#endif
////////////////////////////////////////////
///////////////// Externs //////////////////
////////////////////////////////////////////
// LCD Updates
#if HAS_GRAPHICAL_LCD
extern bool drawing_screen;
#endif
////////////////////////////////////////////
///////////// Global Variables /////////////
////////////////////////////////////////////

@ -108,9 +108,6 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed
millis_t next_button_update_ms;
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
#include "dogm/HAL_LCD_class_defines.h"
extern U8G_CLASS u8g;
bool drawing_screen, first_page; // = false
#endif
@ -124,13 +121,6 @@ millis_t next_button_update_ms;
void lcd_status_screen();
#if HAS_LCD_CONTRAST
void set_lcd_contrast(const int16_t value) {
lcd_contrast = constrain(value, LCD_CONTRAST_MIN, LCD_CONTRAST_MAX);
u8g.setContrast(lcd_contrast);
}
#endif
#if HAS_LCD_MENU
#include "menu/menu.h"

@ -23,18 +23,124 @@
#include "../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
extern bool first_page;
#else
constexpr bool first_page = true;
enum HD44780CharSet : uint8_t {
CHARSET_MENU,
CHARSET_INFO,
CHARSET_BOOT
#if HAS_GRAPHICAL_LCD
// LCD selection
#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
#define U8G_CLASS U8GLIB_ST7920_128X64_4X
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
#define U8G_PARAM LCD_PINS_RS
#else
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS
#endif
#elif ENABLED(U8GLIB_ST7920)
// RepRap Discount Full Graphics Smart Controller
#if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN)
#define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL
#define U8G_PARAM LCD_PINS_RS // 2 stripes, HW SPI (shared with SD card, on AVR does not use standard LCD adapter)
#else
//#define U8G_CLASS U8GLIB_ST7920_128X64_4X
//#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Original u8glib device. 2 stripes, SW SPI
#define U8G_CLASS U8GLIB_ST7920_128X64_RRD
#define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS // Number of stripes can be adjusted in ultralcd_st7920_u8glib_rrd.h with PAGE_HEIGHT
// AVR version ignores these pin settings
// HAL version uses these pin settings
#endif
#elif ENABLED(CARTESIO_UI)
// The CartesioUI display
//#define U8G_CLASS U8GLIB_DOGM128_2X
//#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
#define U8G_CLASS U8GLIB_DOGM128_2X
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
#elif ENABLED(U8GLIB_LM6059_AF)
// Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
//#define U8G_CLASS U8GLIB_LM6059
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
#define U8G_CLASS U8GLIB_LM6059_2X
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
#elif ENABLED(U8GLIB_ST7565_64128N)
// The MaKrPanel, Mini Viki, Viki 2.0 & AZSMZ 12864 ST7565 controller
#define SMART_RAMPS (MB(RAMPS_SMART_EFB) || MB(RAMPS_SMART_EEB) || MB(RAMPS_SMART_EFF) || MB(RAMPS_SMART_EEF) || MB(RAMPS_SMART_SF))
#if DOGLCD_SCK == SCK_PIN && DOGLCD_MOSI == MOSI_PIN && !SMART_RAMPS
#define U8G_CLASS U8GLIB_64128N_2X_HAL
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // using HW-SPI
#else
#define U8G_CLASS U8GLIB_64128N_2X_HAL
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // using SW-SPI
#endif
#elif ENABLED(MKS_12864OLED_SSD1306)
// MKS 128x64 (SSD1306) OLED I2C LCD
#define U8G_CLASS U8GLIB_SSD1306_128X64
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
//#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
//#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
#elif ENABLED(U8GLIB_SSD1306)
// Generic support for SSD1306 OLED I2C LCDs
//#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
//#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
#define U8G_CLASS U8GLIB_SSD1306_128X64_2X
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
#elif ENABLED(MKS_12864OLED)
// MKS 128x64 (SH1106) OLED I2C LCD
#define U8G_CLASS U8GLIB_SH1106_128X64
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 8 stripes
//#define U8G_CLASS U8GLIB_SH1106_128X64_2X
//#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes
#elif ENABLED(U8GLIB_SH1106)
// Generic support for SH1106 OLED I2C LCDs
//#define U8G_CLASS U8GLIB_SH1106_128X64_2X_I2C_2_WIRE
//#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
#define U8G_CLASS U8GLIB_SH1106_128X64_2X
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST) // 4 stripes
#elif ENABLED(U8GLIB_SSD1309)
// Generic support for SSD1309 OLED I2C LCDs
#define U8G_CLASS U8GLIB_SSD1309_128X64
#define U8G_PARAM (U8G_I2C_OPT_NONE | U8G_I2C_OPT_FAST)
#elif ENABLED(MINIPANEL)
// The MINIPanel display
//#define U8G_CLASS U8GLIB_MINI12864
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes
#define U8G_CLASS U8GLIB_MINI12864_2X
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes
#elif ENABLED(U8GLIB_SH1106_EINSTART)
// Connected via motherboard header
#define U8G_CLASS U8GLIB_SH1106_128X64
#define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, LCD_PINS_DC, LCD_PINS_RS
#else
// for regular DOGM128 display with HW-SPI
//#define U8G_CLASS U8GLIB_DOGM128
//#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 8 stripes
#define U8G_CLASS U8GLIB_DOGM128_2X
#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // HW-SPI Com: CS, A0 // 4 stripes
#endif
#include <U8glib.h>
#include "dogm/HAL_LCD_class_defines.h"
extern U8G_CLASS u8g;
enum MarlinFont : uint8_t {
FONT_STATUSMENU = 1,
FONT_SPECIAL,
FONT_MENU_EDIT,
FONT_MENU,
};
#endif
#if ENABLED(ULTRA_LCD) || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
void lcd_setFont(const MarlinFont font_nr);
#if ENABLED(LIGHTWEIGHT_UI)
void lcd_in_status(const bool inStatus);
#endif
#endif // HAS_GRAPHICAL_LCD
#if HAS_SPI_LCD || ENABLED(MALYAN_LCD) || ENABLED(EXTENSIBLE_UI)
void lcd_init();
bool lcd_detected();
void lcd_update();
@ -47,7 +153,7 @@
inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
#endif
#if ENABLED(ULTRA_LCD)
#if HAS_SPI_LCD
#include "../Marlin.h"
@ -168,65 +274,21 @@
float lcd_z_offset_edit();
#endif
#if ENABLED(SCROLL_LONG_FILENAMES)
extern uint8_t filename_scroll_pos, filename_scroll_max;
#endif
#endif // ULTIPANEL
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
extern millis_t previous_lcd_status_ms;
#endif
bool lcd_blink();
#if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
#define BLEN_REPRAPWORLD_KEYPAD_F1 2
#define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
#define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
#define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
#define BLEN_REPRAPWORLD_KEYPAD_UP 6
#define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_F1))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_DOWN))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_RIGHT))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_MIDDLE))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_UP))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(REPRAPWORLD_BTN_OFFSET + BLEN_REPRAPWORLD_KEYPAD_LEFT))
#define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3)
#define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2)
#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN)
#define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT)
#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
#define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
#if ENABLED(ADC_KEYPAD)
#define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_F1
#define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_MIDDLE
#else
#define KEYPAD_HOME EN_REPRAPWORLD_KEYPAD_MIDDLE
#define KEYPAD_EN_C EN_REPRAPWORLD_KEYPAD_F1
#if ENABLED(STATUS_MESSAGE_SCROLLING)
extern uint8_t status_scroll_offset;
#endif
#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & KEYPAD_HOME)
#define REPRAPWORLD_KEYPAD_MOVE_MENU (buttons_reprapworld_keypad & KEYPAD_EN_C)
#define REPRAPWORLD_KEYPAD_PRESSED (buttons_reprapworld_keypad & ( \
EN_REPRAPWORLD_KEYPAD_F3 | \
EN_REPRAPWORLD_KEYPAD_F2 | \
EN_REPRAPWORLD_KEYPAD_F1 | \
EN_REPRAPWORLD_KEYPAD_DOWN | \
EN_REPRAPWORLD_KEYPAD_RIGHT | \
EN_REPRAPWORLD_KEYPAD_MIDDLE | \
EN_REPRAPWORLD_KEYPAD_UP | \
EN_REPRAPWORLD_KEYPAD_LEFT) \
)
#endif
bool lcd_blink();
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
bool is_lcd_clicked();
@ -234,6 +296,7 @@
#endif
#elif ENABLED(EXTENSIBLE_UI)
// These functions are defined elsewhere
void lcd_setstatus(const char* const message, const bool persist=false);
void lcd_setstatusPGM(const char* const message, const int8_t level=0);
@ -242,6 +305,7 @@
void lcd_refresh();
void lcd_reset_alert_level();
bool lcd_hasstatus();
#else // MALYAN_LCD or no LCD
constexpr bool lcd_wait_for_move = false;
@ -254,11 +318,11 @@
inline void lcd_reset_alert_level() {}
inline void lcd_reset_status() {}
#endif // ULTRA_LCD
#endif
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
#if ENABLED(NEWPANEL) // Uses digital switches, not a shift register
#if HAS_DIGITAL_ENCODER
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
#define BLEN_A 0
@ -305,6 +369,9 @@
#define LCD_CLICKED false
#endif
extern uint8_t lcd_status_update_delay;
extern char lcd_status_message[];
#define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatusPGM(PSTR(x))
@ -320,3 +387,19 @@
// LCD implementations
void lcd_implementation_clear();
void lcd_implementation_init();
#if HAS_GRAPHICAL_LCD
extern bool drawing_screen, first_page;
#elif HAS_SPI_LCD
constexpr bool first_page = true;
#endif
#if HAS_CHARACTER_LCD
enum HD44780CharSet : uint8_t {
CHARSET_MENU,
CHARSET_INFO,
CHARSET_BOOT
};
#endif

Loading…
Cancel
Save