Followup to Menu Refactor (#12275)

This commit is contained in:
Scott Lahteine
2018-10-30 16:34:45 -05:00
committed by GitHub
parent 5536228359
commit 3583e2b449
45 changed files with 244 additions and 273 deletions

View File

@ -14,16 +14,15 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD)
#if HAS_CHARACTER_LCD
#include "../ultralcd.h"
#include "../../Marlin.h"
#include <string.h>
#include "../fontutils.h"
#include "../lcdprint.h"
#include "ultralcd_common_HD44780.h"
#include <string.h>
#ifndef LCD_CLASS
#include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal
@ -1039,4 +1038,4 @@ int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
}
#endif // ULTRA_LCD && !DOGLCD
#endif // HAS_CHARACTER_LCD

View File

@ -32,24 +32,6 @@
#include "../../libs/duration_t.h"
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../../feature/bedlevel/ubl/ubl.h"
#if ENABLED(ULTIPANEL)
#define ULTRA_X_PIXELS_PER_CHAR 5
#define ULTRA_Y_PIXELS_PER_CHAR 8
#define ULTRA_COLUMNS_FOR_MESH_MAP 7
#define ULTRA_ROWS_FOR_MESH_MAP 4
#define N_USER_CHARS 8
#define TOP_LEFT _BV(0)
#define TOP_RIGHT _BV(1)
#define LOWER_LEFT _BV(2)
#define LOWER_RIGHT _BV(3)
#endif
#endif
////////////////////////////////////
// Setup button and encode mappings for each panel (into 'buttons' variable
//
@ -57,7 +39,7 @@
// macro name. The mapping is independent of whether the button is directly connected or
// via a shift/i2c register.
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
extern volatile uint8_t buttons;
@ -119,7 +101,21 @@
#define LCD_CLICKED (buttons & (B_MI|B_ST))
#endif
#endif // ULTIPANEL
#if ENABLED(AUTO_BED_LEVELING_UBL)
#define ULTRA_X_PIXELS_PER_CHAR 5
#define ULTRA_Y_PIXELS_PER_CHAR 8
#define ULTRA_COLUMNS_FOR_MESH_MAP 7
#define ULTRA_ROWS_FOR_MESH_MAP 4
#define N_USER_CHARS 8
#define TOP_LEFT _BV(0)
#define TOP_RIGHT _BV(1)
#define LOWER_LEFT _BV(2)
#define LOWER_RIGHT _BV(3)
#endif
#endif // HAS_LCD_MENU
////////////////////////////////////
// Create LCD class instance and chipset-specific information
@ -141,12 +137,11 @@
#elif ENABLED(LCD_I2C_TYPE_MCP23017)
// For the LED indicators (which may be mapped to different events in lcd_implementation_update_indicators())
#define LCD_HAS_STATUS_INDICATORS
#define LED_A 0x04 //100
#define LED_B 0x02 //010
#define LED_C 0x01 //001
#define LCD_HAS_STATUS_INDICATORS
#include <Wire.h>
#include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2
@ -160,9 +155,9 @@
#include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#elif ENABLED(SR_LCD_2W_NL)
// 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
extern "C" void __cxa_pure_virtual() { while (1); }
#include <LCD.h>
#include <LiquidCrystal_SR.h>
@ -178,12 +173,7 @@
// Standard directly connected LCD implementations
#include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal
#endif
#include "../fontutils.h"
#include "../lcdprint.h"
#if ENABLED(LCD_PROGRESS_BAR)
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif

View File

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(ULTRA_LCD) && DISABLED(DOGLCD)
#if HAS_CHARACTER_LCD
/**
* ultralcd_impl_HD44780.cpp
@ -40,6 +40,10 @@
#include "../../module/planner.h"
#include "../../module/motion.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../../feature/bedlevel/ubl/ubl.h"
#endif
////////////////////////////////////
// Create LCD class instance and chipset-specific information
#if ENABLED(LCD_I2C_TYPE_PCF8575)
@ -79,16 +83,6 @@
LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5, LCD_PINS_D6, LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
#endif
#include "../fontutils.h"
#include "../lcdprint.h"
#if ENABLED(LCD_PROGRESS_BAR)
static millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle
#if PROGRESS_MSG_EXPIRE > 0
static millis_t expire_status_ms = 0; // millis at which to expire the status message
#endif
#endif
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators();
#endif
@ -100,9 +94,13 @@ static void createChar_P(const char c, const byte * const ptr) {
lcd.createChar(c, temp);
}
#if ENABLED(LCD_PROGRESS_BAR)
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif
void lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN)
const uint8_t screen_charset=CHARSET_INFO
const HD44780CharSet screen_charset/*=CHARSET_INFO*/
#endif
) {
// CHARSET_BOOT
@ -318,11 +316,7 @@ void lcd_set_custom_characters(
}
void lcd_implementation_init(
#if ENABLED(LCD_PROGRESS_BAR)
const uint8_t screen_charset=CHARSET_INFO
#endif
) {
void lcd_implementation_init() {
#if ENABLED(LCD_I2C_TYPE_PCF8575)
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
@ -348,11 +342,7 @@ void lcd_implementation_init(
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#endif
lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR)
screen_charset
#endif
);
LCD_SET_CHARSET(currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU);
lcd.clear();
}
@ -416,7 +406,7 @@ void lcd_implementation_clear() { lcd.clear(); }
}
void lcd_bootscreen() {
lcd_set_custom_characters(CHARSET_BOOT);
LCD_SET_CHARSET(CHARSET_BOOT);
lcd.clear();
#define LCD_EXTRA_SPACE (LCD_WIDTH-8)
@ -485,7 +475,7 @@ void lcd_implementation_clear() { lcd.clear(); }
lcd.clear();
safe_delay(100);
lcd_set_custom_characters();
LCD_SET_CHARSET(CHARSET_INFO);
lcd.clear();
}
@ -975,7 +965,7 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
#endif
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
#if ENABLED(ADVANCED_PAUSE_FEATURE)
@ -1581,6 +1571,6 @@ FORCE_INLINE void _draw_status_message(const bool blink) {
#endif // AUTO_BED_LEVELING_UBL
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
#endif // ULTRA_LCD && !DOGLCD
#endif // HAS_CHARACTER_LCD

View File

@ -9,7 +9,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
extern U8GLIB *pu8g;
@ -62,4 +62,4 @@ int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
return ret;
}
#endif // DOGLCD
#endif // HAS_GRAPHICAL_LCD

View File

@ -67,7 +67,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
#include "HAL_LCD_com_defines.h"
@ -281,4 +281,4 @@ uint8_t u8g_WriteEscSeqP_2_wire(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_s
return 1;
}
#endif // DOGLCD
#endif // HAS_GRAPHICAL_LCD

View File

@ -55,7 +55,7 @@
#include "../../inc/MarlinConfig.h"
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
@ -233,4 +233,4 @@ u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_sw_spi = { u8g_dev_st7565_64128n_HAL_2x_f
U8G_PB_DEV(u8g_dev_st7565_64128n_HAL_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_st7565_64128n_HAL_fn, U8G_COM_HAL_HW_SPI_FN);
u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi = { u8g_dev_st7565_64128n_HAL_2x_fn, &u8g_dev_st7565_64128n_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN };
#endif // DOGLCD
#endif // HAS_GRAPHICAL_LCD

View File

@ -55,7 +55,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
@ -209,4 +209,4 @@ u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi = { u8g_dev_st7920_128x64_HAL_4x_f
u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = { u8g_dev_st7920_128x64_HAL_4x_fn, &u8g_dev_st7920_128x64_HAL_4x_pb, U8G_COM_ST7920_HAL_SW_SPI };
#endif
#endif // DOGLCD
#endif // HAS_GRAPHICAL_LCD

View File

@ -59,7 +59,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#include <U8glib.h>
@ -114,19 +114,18 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg,
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq);
break;
case U8G_DEV_MSG_STOP:
break;
case U8G_DEV_MSG_PAGE_NEXT:
{
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */
u8g_SetAddress(u8g, dev, 1); /* data mode */
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
return 0;
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_STOP: break;
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page */
u8g_SetAddress(u8g, dev, 1); /* data mode */
if (!u8g_pb_WriteBuffer(pb, u8g, dev)) return 0;
u8g_SetChipSelect(u8g, dev, 0);
} break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
@ -144,25 +143,25 @@ uint8_t u8g_dev_uc1701_mini12864_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_init_seq);
break;
case U8G_DEV_MSG_STOP:
break;
case U8G_DEV_MSG_PAGE_NEXT:
{
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */
u8g_SetAddress(u8g, dev, 1); /* data mode */
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
u8g_SetChipSelect(u8g, dev, 0);
case U8G_DEV_MSG_STOP: break;
case U8G_DEV_MSG_PAGE_NEXT: {
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page */
u8g_SetAddress(u8g, dev, 1); /* data mode */
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
u8g_SetChipSelect(u8g, dev, 0);
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */
u8g_SetAddress(u8g, dev, 1); /* data mode */
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
u8g_SetChipSelect(u8g, dev, 0);
} break;
u8g_WriteEscSeqP(u8g, dev, u8g_dev_uc1701_mini12864_HAL_data_start);
u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page */
u8g_SetAddress(u8g, dev, 1); /* data mode */
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
@ -182,4 +181,4 @@ u8g_pb_t u8g_dev_uc1701_mini12864_HAL_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u
u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi = { u8g_dev_uc1701_mini12864_HAL_2x_fn, &u8g_dev_uc1701_mini12864_HAL_2x_pb, U8G_COM_HAL_SW_SPI_FN };
u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_hw_spi = { u8g_dev_uc1701_mini12864_HAL_2x_fn, &u8g_dev_uc1701_mini12864_HAL_2x_pb, U8G_COM_HAL_HW_SPI_FN };
#endif // DOGLCD
#endif // HAS_GRAPHICAL_LCD

View File

@ -9,7 +9,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#include <string.h>
#include "../fontutils.h"
@ -317,4 +317,4 @@ int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg) {
return data.adv;
}
#endif // DOGLCD
#endif // HAS_GRAPHICAL_LCD

View File

@ -245,7 +245,7 @@ void lcd_kill_screen() {
void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
uint8_t row_y1, row_y2;
@ -655,6 +655,6 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
#endif // HAS_GRAPHICAL_LCD

View File

@ -22,7 +22,7 @@
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
#include "menu.h"
#include "../ultralcd.h"
@ -75,8 +75,6 @@ bool no_reentry = false;
//////// Menu Navigation & History /////////
////////////////////////////////////////////
void lcd_status_screen();
void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
void lcd_save_previous_screen() {
@ -203,14 +201,6 @@ void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t
bool printer_busy() { return planner.movesplanned() || IS_SD_PRINTING(); }
#if HAS_CHARACTER_LCD && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(LCD_PROGRESS_BAR_TEST) || ENABLED(AUTO_BED_LEVELING_UBL))
void lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN)
const uint8_t screen_charset=CHARSET_INFO
#endif
);
#endif
/**
* General function to go directly to a screen
*/
@ -258,19 +248,17 @@ void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder/*=0*/) {
#endif
screen_history_depth = 0;
}
lcd_implementation_clear();
// Re-initialize custom characters that may be re-used
#if HAS_CHARACTER_LCD && ENABLED(AUTO_BED_LEVELING_UBL)
if (!ubl.lcd_map_control) {
lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR)
screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU
#endif
);
}
#elif ENABLED(LCD_PROGRESS_BAR)
lcd_set_custom_characters(screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU);
#if HAS_CHARACTER_LCD
#if ENABLED(AUTO_BED_LEVELING_UBL)
if (!ubl.lcd_map_control)
#endif
LCD_SET_CHARSET(screen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU);
#endif
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
screen_changed = true;
#if HAS_GRAPHICAL_LCD
@ -476,4 +464,4 @@ void _lcd_draw_homing() {
void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); }
#endif
#endif // ULTIPANEL
#endif // HAS_LCD_MENU

View File

@ -54,7 +54,7 @@ static void lcd_factory_settings() {
static int8_t bar_percent = 0;
if (use_click()) {
lcd_goto_previous_menu();
lcd_set_custom_characters(CHARSET_MENU);
LCD_SET_CHARSET(CHARSET_MENU);
return;
}
bar_percent += (int8_t)encoderPosition;
@ -68,7 +68,7 @@ static void lcd_factory_settings() {
void _progress_bar_test() {
lcd_goto_screen(progress_bar_test);
lcd_set_custom_characters();
LCD_SET_CHARSET(CHARSET_INFO);
}
#endif // LCD_PROGRESS_BAR_TEST

View File

@ -49,7 +49,7 @@
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../feature/power_loss_recovery.h"
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
void menu_job_recovery();
#endif
#endif
@ -100,7 +100,7 @@ uint8_t lcd_status_update_delay = 1, // First update one loop delayed
millis_t previous_lcd_status_ms = 0;
#endif
#if ENABLED(SDSUPPORT) && ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES)
#if HAS_LCD_MENU && ENABLED(SDSUPPORT) && ENABLED(SCROLL_LONG_FILENAMES)
uint8_t filename_scroll_pos, filename_scroll_max;
#endif
@ -122,8 +122,6 @@ millis_t next_button_update_ms;
int8_t encoderDirection = 1;
#endif
void lcd_status_screen();
#if HAS_LCD_MENU
#include "menu/menu.h"
@ -202,7 +200,7 @@ void lcd_init() {
lcd_buttons_update();
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
encoderDiff = 0;
#endif
}
@ -363,6 +361,14 @@ bool lcd_blink() {
* This is very display-dependent, so the lcd implementation draws this.
*/
#if ENABLED(LCD_PROGRESS_BAR)
millis_t progress_bar_ms = 0; // Start millis of the current progress bar cycle
#if PROGRESS_MSG_EXPIRE > 0
static millis_t expire_status_ms = 0;
void dontExpireStatus() { expire_status_ms = 0; }
#endif
#endif
#if LCD_INFO_SCREEN_STYLE == 0
void lcd_impl_status_screen_0();
#elif LCD_INFO_SCREEN_STYLE == 1
@ -371,12 +377,12 @@ bool lcd_blink() {
void lcd_status_screen() {
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
ENCODER_DIRECTION_NORMAL();
ENCODER_RATE_MULTIPLY(false);
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || ENABLED(DOGLCD))
#if ENABLED(LCD_SET_PROGRESS_MANUALLY) && ENABLED(SDSUPPORT) && (ENABLED(LCD_PROGRESS_BAR) || HAS_GRAPHICAL_LCD)
// Progress bar % comes from SD when actively printing
if (IS_SD_PRINTING())
progress_bar_percent = card.percentDone();
@ -425,18 +431,14 @@ void lcd_status_screen() {
#endif // LCD_PROGRESS_BAR
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
if (use_click()) {
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
previous_lcd_status_ms = millis(); // get status message to show up for a while
#endif
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if ENABLED(LCD_PROGRESS_BAR)
CHARSET_MENU
#endif
);
lcd_goto_screen(menu_main);
lcd_implementation_init(); // May revive the LCD if static electricity killed it
return;
}
@ -465,7 +467,7 @@ void lcd_status_screen() {
feedrate_percentage = constrain(feedrate_percentage, 10, 999);
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
#if LCD_INFO_SCREEN_STYLE == 0
lcd_impl_status_screen_0();
@ -514,7 +516,7 @@ void kill_screen(PGM_P lcd_msg) {
void lcd_quick_feedback(const bool clear_buttons) {
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
lcd_refresh();
if (clear_buttons) buttons = 0;
next_button_update_ms = millis() + 500;
@ -525,7 +527,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
// Buzz and wait. The delay is needed for buttons to settle!
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
#if ENABLED(LCD_USE_I2C_BUZZER)
delay(10);
#elif PIN_EXISTS(BEEPER)
@ -534,7 +536,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
#endif
}
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
extern bool no_reentry; // Flag to prevent recursion into menu handlers
@ -602,7 +604,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
}
}
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
/**
* Update the LCD, read encoder buttons, etc.
@ -652,7 +654,7 @@ void lcd_update() {
static uint16_t max_display_update_time = 0;
static millis_t next_lcd_update_ms;
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
static millis_t return_to_status_ms = 0;
// Handle any queued Move Axis motion
@ -688,7 +690,7 @@ void lcd_update() {
}
#endif
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
@ -712,11 +714,7 @@ void lcd_update() {
}
lcd_refresh();
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#if ENABLED(LCD_PROGRESS_BAR)
currentScreen == lcd_status_screen ? CHARSET_INFO : CHARSET_MENU
#endif
);
lcd_implementation_init(); // May revive the LCD if static electricity killed it
}
#endif // SDSUPPORT && SD_DETECT_PIN
@ -730,7 +728,7 @@ void lcd_update() {
const millis_t ms = millis();
if (ELAPSED(ms, next_lcd_update_ms)
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
|| drawing_screen
#endif
) {
@ -741,7 +739,7 @@ void lcd_update() {
lcd_implementation_update_indicators();
#endif
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
@ -797,18 +795,18 @@ void lcd_update() {
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
// This runs every ~100ms when idling often enough.
// Instead of tracking changes just redraw the Status Screen once per second.
if (
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
currentScreen == lcd_status_screen &&
#endif
!lcd_status_update_delay--
) {
lcd_status_update_delay = 9
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
+ 3
#endif
;
@ -816,7 +814,7 @@ void lcd_update() {
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
#if ENABLED(ULTIPANEL) && ENABLED(SCROLL_LONG_FILENAMES)
#if HAS_LCD_MENU && ENABLED(SCROLL_LONG_FILENAMES)
// If scrolling of long file names is enabled and we are in the sd card menu,
// cause a refresh to occur until all the text has scrolled into view.
if (currentScreen == menu_sdcard && filename_scroll_pos < filename_scroll_max && !lcd_status_update_delay--) {
@ -830,7 +828,7 @@ void lcd_update() {
// then we want to use 1/2 of the time only.
uint16_t bbr2 = planner.block_buffer_runtime() >> 1;
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
const bool &is_drawing = drawing_screen;
#else
constexpr bool is_drawing = false;
@ -855,15 +853,15 @@ void lcd_update() {
buttons_reprapworld_keypad = 0;
#endif
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
#define CURRENTSCREEN() (*currentScreen)()
#else
#define CURRENTSCREEN() lcd_status_screen()
#endif
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#if ENABLED(LIGHTWEIGHT_UI)
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
const bool in_status = currentScreen == lcd_status_screen;
#else
constexpr bool in_status = true;
@ -896,7 +894,7 @@ void lcd_update() {
CURRENTSCREEN();
#endif
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
lcd_clicked = false;
#endif
@ -905,7 +903,7 @@ void lcd_update() {
NOLESS(max_display_update_time, millis() - ms);
}
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
// Return to Status Screen after a timeout
if (currentScreen == lcd_status_screen || defer_return_to_status)
@ -913,7 +911,7 @@ void lcd_update() {
else if (ELAPSED(ms, return_to_status_ms))
lcd_return_to_status();
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
// Change state of drawing flag between screen updates
if (!is_drawing) switch (lcdDrawUpdate) {
@ -942,6 +940,7 @@ void lcd_finishstatus(const bool persist=false) {
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
#endif
#endif
lcd_refresh();
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
@ -953,10 +952,6 @@ void lcd_finishstatus(const bool persist=false) {
#endif
}
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus() { expire_status_ms = 0; }
#endif
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
void lcd_setstatus(const char * const message, const bool persist) {
@ -1023,7 +1018,7 @@ void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
void lcd_setalertstatusPGM(PGM_P const message) {
lcd_setstatusPGM(message, 1);
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
lcd_return_to_status();
#endif
}
@ -1068,7 +1063,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
}
#endif
#if ENABLED(ULTIPANEL)
#if HAS_LCD_MENU
/**
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
@ -1252,6 +1247,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
}
}
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
#endif // ULTRA_LCD

View File

@ -89,7 +89,7 @@
#elif ENABLED(U8GLIB_SSD1306)
// Generic support for SSD1306 OLED I2C LCDs
//#define U8G_CLASS U8GLIB_SSD1306_128X64_2X_I2C_2_WIRE
//#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
@ -102,7 +102,7 @@
//#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_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
@ -199,6 +199,7 @@
#include "../module/motion.h" // for active_extruder
#endif
void lcd_status_screen();
void lcd_return_to_status();
bool lcd_hasstatus();
void lcd_setstatus(const char* message, const bool persist=false);
@ -229,8 +230,11 @@
void lcd_quick_feedback(const bool clear_buttons); // Audible feedback for a button click - could also be visual
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus();
#if ENABLED(LCD_PROGRESS_BAR)
extern millis_t progress_bar_ms; // Start time for the current progress bar cycle
#if PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus();
#endif
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
@ -246,7 +250,7 @@
void set_lcd_contrast(const int16_t value);
#endif
#if ENABLED(DOGLCD)
#if HAS_GRAPHICAL_LCD
#define SETCURSOR(col, row) lcd_moveto(col * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT))
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - len * (DOG_CHAR_WIDTH), (row + 1) * (DOG_CHAR_HEIGHT))
#else
@ -316,7 +320,7 @@
extern uint8_t filename_scroll_pos, filename_scroll_max;
#endif
#endif // ULTIPANEL
#endif // HAS_LCD_MENU
#if ENABLED(FILAMENT_LCD_DISPLAY) && ENABLED(SDSUPPORT)
extern millis_t previous_lcd_status_ms;
@ -422,22 +426,29 @@ extern char lcd_status_message[];
void lcd_reselect_last_file();
#endif
// 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
// LCD implementations
void lcd_implementation_clear();
void lcd_implementation_init();
#if HAS_CHARACTER_LCD
enum HD44780CharSet : uint8_t {
CHARSET_MENU,
CHARSET_INFO,
CHARSET_BOOT
};
enum HD44780CharSet : uint8_t { CHARSET_MENU, CHARSET_INFO, CHARSET_BOOT };
void lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR) || ENABLED(SHOW_BOOTSCREEN)
const HD44780CharSet screen_charset=CHARSET_INFO
#endif
);
#if ENABLED(LCD_PROGRESS_BAR)
#define LCD_SET_CHARSET(C) lcd_set_custom_characters(C)
#else
#define LCD_SET_CHARSET(C) lcd_set_custom_characters()
#endif
#endif