From b2328d089a1c3c375de729c0af623c638d631078 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 22 Feb 2020 21:36:12 -0600 Subject: [PATCH] Allow LCD_PIXEL_WIDTH/HEIGHT override --- Marlin/src/gcode/queue.cpp | 2 +- Marlin/src/inc/Conditionals_LCD.h | 9 +++++++++ Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 3 ++- Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp | 2 -- Marlin/src/lcd/dogm/ultralcd_DOGM.h | 7 ------- Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 2 +- Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h | 9 +++------ 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index c3c155e4c3..5edd2d926b 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -532,7 +532,7 @@ void GCodeQueue::get_serial_commands() { // Reset stream state, terminate the buffer, and commit a non-empty command if (!process_line_done(sd_input_state, command_buffer[index_w], sd_count)) { - _commit_command(false); // The file was not terminated with a newline + _commit_command(false); // Can handle last line missing a newline terminator #if ENABLED(POWER_LOSS_RECOVERY) recovery.cmd_sdpos = card.getIndex(); // Prime for the next _commit_command #endif diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 67130d21e4..5cbdafd6e0 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -361,6 +361,15 @@ #define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD) #define HAS_DGUS_LCD ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY) +#if HAS_GRAPHICAL_LCD + #ifndef LCD_PIXEL_WIDTH + #define LCD_PIXEL_WIDTH 128 + #endif + #ifndef LCD_PIXEL_HEIGHT + #define LCD_PIXEL_HEIGHT 64 + #endif +#endif + /** * Extruders have some combination of stepper motors and hotends * so we separate these concepts into the defines: diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index e1478ff98e..25224934c5 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -25,7 +25,7 @@ #include -#ifndef U8G_HAL_LINKS +#ifndef U8G_HAL_LINKS // Defined by LPC1768/9 environments in platform.ini #ifdef __SAM3X8E__ @@ -75,6 +75,7 @@ #define U8G_COM_ST7920_HAL_HW_SPI u8g_com_arduino_st7920_hw_spi_fn #endif + // This can't be invoked from the current platformio.ini #ifdef TARGET_LPC1768 uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #endif diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp index 34712e0706..b6449bd4ae 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp @@ -59,8 +59,6 @@ #include "HAL_LCD_com_defines.h" -#define LCD_PIXEL_WIDTH 128 -#define LCD_PIXEL_HEIGHT 64 #define PAGE_HEIGHT 8 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */ diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index 27443d9e71..536b8f0bf9 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -196,13 +196,6 @@ #endif #endif -#ifndef LCD_PIXEL_WIDTH - #define LCD_PIXEL_WIDTH 128 -#endif -#ifndef LCD_PIXEL_HEIGHT - #define LCD_PIXEL_HEIGHT 64 -#endif - // LCD_FULL_PIXEL_WIDTH = // LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X #if ENABLED(FSMC_GRAPHICAL_TFT) 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 41b0c571f0..4e38e554a2 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -154,4 +154,4 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_rrd_st7920_128x64_fn, &u8 #endif #endif // U8GLIB_ST7920 -#endif // __AVR__ && !U8G_HAL_LINKS +#endif // !U8G_HAL_LINKS && (__AVR__ || ARDUINO_ARCH_STM32 || ARDUINO_ARCH_ESP32) diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h index 6bcf3a94cf..c6e0b9944b 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h @@ -31,12 +31,9 @@ #define ST7920_DAT_PIN LCD_PINS_ENABLE #define ST7920_CS_PIN LCD_PINS_RS -//#define PAGE_HEIGHT 8 //128 byte framebuffer -#define PAGE_HEIGHT 16 //256 byte framebuffer -//#define PAGE_HEIGHT 32 //512 byte framebuffer - -#define LCD_PIXEL_WIDTH 128 -#define LCD_PIXEL_HEIGHT 64 +//#define PAGE_HEIGHT 8 // 128 byte framebuffer +#define PAGE_HEIGHT 16 // 256 byte framebuffer +//#define PAGE_HEIGHT 32 // 512 byte framebuffer #include