Browse Source

Overridable Options - Part 7 (PR#2559)

Apply `ENABLED` / `DISABLED` macros to LCD-related files.
pull/1/head
Scott Lahteine 10 years ago
committed by Richard Wackerbarth
parent
commit
0d8989fc14
  1. 54
      Marlin/dogm_lcd_implementation.h
  2. 172
      Marlin/ultralcd.cpp
  3. 18
      Marlin/ultralcd.h
  4. 60
      Marlin/ultralcd_implementation_hitachi_HD44780.h

54
Marlin/dogm_lcd_implementation.h

@ -18,7 +18,7 @@
* Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays. * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
*/ */
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
#define BLEN_A 0 #define BLEN_A 0
#define BLEN_B 1 #define BLEN_B 1
#define BLEN_C 2 #define BLEN_C 2
@ -35,12 +35,12 @@
#include "ultralcd_st7920_u8glib_rrd.h" #include "ultralcd_st7920_u8glib_rrd.h"
#include "Configuration.h" #include "Configuration.h"
#if !defined(MAPPER_C2C3) && !defined(MAPPER_NON) && defined(USE_BIG_EDIT_FONT) #if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
#undef USE_BIG_EDIT_FONT #undef USE_BIG_EDIT_FONT
#endif #endif
#ifdef USE_SMALL_INFOFONT #if ENABLED(USE_SMALL_INFOFONT)
#include "dogm_font_data_6x9_marlin.h" #include "dogm_font_data_6x9_marlin.h"
#define FONT_STATUSMENU_NAME u8g_font_6x9 #define FONT_STATUSMENU_NAME u8g_font_6x9
#else #else
@ -50,17 +50,17 @@
#include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols #include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols
#define FONT_SPECIAL_NAME Marlin_symbols #define FONT_SPECIAL_NAME Marlin_symbols
#ifndef SIMULATE_ROMFONT #if DISABLED(SIMULATE_ROMFONT)
#if defined( DISPLAY_CHARSET_ISO10646_1 ) #if ENABLED(DISPLAY_CHARSET_ISO10646_1)
#include "dogm_font_data_ISO10646_1.h" #include "dogm_font_data_ISO10646_1.h"
#define FONT_MENU_NAME ISO10646_1_5x7 #define FONT_MENU_NAME ISO10646_1_5x7
#elif defined( DISPLAY_CHARSET_ISO10646_5 ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_5)
#include "dogm_font_data_ISO10646_5_Cyrillic.h" #include "dogm_font_data_ISO10646_5_Cyrillic.h"
#define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7 #define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7
#elif defined( DISPLAY_CHARSET_ISO10646_KANA ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_KANA)
#include "dogm_font_data_ISO10646_Kana.h" #include "dogm_font_data_ISO10646_Kana.h"
#define FONT_MENU_NAME ISO10646_Kana_5x7 #define FONT_MENU_NAME ISO10646_Kana_5x7
#elif defined( DISPLAY_CHARSET_ISO10646_CN ) #elif ENABLED(DISPLAY_CHARSET_ISO10646_CN)
#include "dogm_font_data_ISO10646_CN.h" #include "dogm_font_data_ISO10646_CN.h"
#define FONT_MENU_NAME ISO10646_CN #define FONT_MENU_NAME ISO10646_CN
#define TALL_FONT_CORRECTION 1 #define TALL_FONT_CORRECTION 1
@ -69,13 +69,13 @@
#define FONT_MENU_NAME ISO10646_1_5x7 #define FONT_MENU_NAME ISO10646_1_5x7
#endif #endif
#else // SIMULATE_ROMFONT #else // SIMULATE_ROMFONT
#if defined( DISPLAY_CHARSET_HD44780_JAPAN ) #if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN)
#include "dogm_font_data_HD44780_J.h" #include "dogm_font_data_HD44780_J.h"
#define FONT_MENU_NAME HD44780_J_5x7 #define FONT_MENU_NAME HD44780_J_5x7
#elif defined( DISPLAY_CHARSET_HD44780_WESTERN ) #elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN)
#include "dogm_font_data_HD44780_W.h" #include "dogm_font_data_HD44780_W.h"
#define FONT_MENU_NAME HD44780_W_5x7 #define FONT_MENU_NAME HD44780_W_5x7
#elif defined( DISPLAY_CHARSET_HD44780_CYRILLIC ) #elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
#include "dogm_font_data_HD44780_C.h" #include "dogm_font_data_HD44780_C.h"
#define FONT_MENU_NAME HD44780_C_5x7 #define FONT_MENU_NAME HD44780_C_5x7
#else // fall-back #else // fall-back
@ -94,7 +94,7 @@
// DOGM parameters (size in pixels) // DOGM parameters (size in pixels)
#define DOG_CHAR_WIDTH 6 #define DOG_CHAR_WIDTH 6
#define DOG_CHAR_HEIGHT 12 #define DOG_CHAR_HEIGHT 12
#ifdef USE_BIG_EDIT_FONT #if ENABLED(USE_BIG_EDIT_FONT)
#define FONT_MENU_EDIT_NAME u8g_font_9x18 #define FONT_MENU_EDIT_NAME u8g_font_9x18
#define DOG_CHAR_WIDTH_EDIT 9 #define DOG_CHAR_WIDTH_EDIT 9
#define DOG_CHAR_HEIGHT_EDIT 18 #define DOG_CHAR_HEIGHT_EDIT 18
@ -113,16 +113,16 @@
#define START_ROW 0 #define START_ROW 0
// LCD selection // LCD selection
#ifdef U8GLIB_ST7920 #if ENABLED(U8GLIB_ST7920)
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0); //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0); U8GLIB_ST7920_128X64_RRD u8g(0);
#elif defined(MAKRPANEL) #elif ENABLED(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well // The MaKrPanel display, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined(VIKI2) || defined(miniVIKI) #elif ENABLED(VIKI2) || ENABLED(miniVIKI)
// Mini Viki and Viki 2.0 LCD, ST7565 controller as well // Mini Viki and Viki 2.0 LCD, ST7565 controller as well
U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined(U8GLIB_LM6059_AF) #elif ENABLED(U8GLIB_LM6059_AF)
// Based on the Adafruit ST7565 (http://www.adafruit.com/products/250) // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);
#elif defined U8GLIB_SSD1306 #elif defined U8GLIB_SSD1306
@ -195,12 +195,12 @@ static bool show_splashscreen = true;
/* Warning: This function is called from interrupt context */ /* Warning: This function is called from interrupt context */
static void lcd_implementation_init() { static void lcd_implementation_init() {
#ifdef LCD_PIN_BL // Enable LCD backlight #if ENABLED(LCD_PIN_BL) // Enable LCD backlight
pinMode(LCD_PIN_BL, OUTPUT); pinMode(LCD_PIN_BL, OUTPUT);
digitalWrite(LCD_PIN_BL, HIGH); digitalWrite(LCD_PIN_BL, HIGH);
#endif #endif
#ifdef LCD_PIN_RESET #if ENABLED(LCD_PIN_RESET)
pinMode(LCD_PIN_RESET, OUTPUT); pinMode(LCD_PIN_RESET, OUTPUT);
digitalWrite(LCD_PIN_RESET, HIGH); digitalWrite(LCD_PIN_RESET, HIGH);
#endif #endif
@ -212,17 +212,17 @@ static void lcd_implementation_init() {
// pinMode(17, OUTPUT); // Enable LCD backlight // pinMode(17, OUTPUT); // Enable LCD backlight
// digitalWrite(17, HIGH); // digitalWrite(17, HIGH);
#ifdef LCD_SCREEN_ROT_90 #if ENABLED(LCD_SCREEN_ROT_90)
u8g.setRot90(); // Rotate screen by 90° u8g.setRot90(); // Rotate screen by 90°
#elif defined(LCD_SCREEN_ROT_180) #elif ENABLED(LCD_SCREEN_ROT_180)
u8g.setRot180(); // Rotate screen by 180° u8g.setRot180(); // Rotate screen by 180°
#elif defined(LCD_SCREEN_ROT_270) #elif ENABLED(LCD_SCREEN_ROT_270)
u8g.setRot270(); // Rotate screen by 270° u8g.setRot270(); // Rotate screen by 270°
#endif #endif
// Show splashscreen // Show splashscreen
int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
#ifdef START_BMPHIGH #if ENABLED(START_BMPHIGH)
int offy = 0; int offy = 0;
#else #else
int offy = DOG_CHAR_HEIGHT; int offy = DOG_CHAR_HEIGHT;
@ -277,7 +277,7 @@ static void lcd_implementation_status_screen() {
// Symbols menu graphics, animated fan // Symbols menu graphics, animated fan
u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp); u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
// SD Card Symbol // SD Card Symbol
u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7); u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7);
u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5); u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5);
@ -332,7 +332,7 @@ static void lcd_implementation_status_screen() {
#define XYZ_BASELINE 38 #define XYZ_BASELINE 38
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT #if ENABLED(USE_SMALL_INFOFONT)
u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10); u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10);
#else #else
u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9); u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9);
@ -378,12 +378,12 @@ static void lcd_implementation_status_screen() {
// Status line // Status line
lcd_setFont(FONT_STATUSMENU); lcd_setFont(FONT_STATUSMENU);
#ifdef USE_SMALL_INFOFONT #if ENABLED(USE_SMALL_INFOFONT)
u8g.setPrintPos(0,62); u8g.setPrintPos(0,62);
#else #else
u8g.setPrintPos(0,63); u8g.setPrintPos(0,63);
#endif #endif
#ifndef FILAMENT_LCD_DISPLAY #if DISABLED(FILAMENT_LCD_DISPLAY)
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
#else #else
if (millis() < previous_lcd_status_ms + 5000) { //Display both Status message line and Filament display on the last line if (millis() < previous_lcd_status_ms + 5000) { //Display both Status message line and Filament display on the last line
@ -473,7 +473,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH; uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
uint8_t vallen = lcd_strlen(value); uint8_t vallen = lcd_strlen(value);
#ifdef USE_BIG_EDIT_FONT #if ENABLED(USE_BIG_EDIT_FONT)
if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
lcd_setFont(FONT_MENU_EDIT); lcd_setFont(FONT_MENU_EDIT);
lcd_width = LCD_WIDTH_EDIT + 1; lcd_width = LCD_WIDTH_EDIT + 1;

172
Marlin/ultralcd.cpp

@ -1,5 +1,5 @@
#include "ultralcd.h" #include "ultralcd.h"
#ifdef ULTRA_LCD #if ENABLED(ULTRA_LCD)
#include "Marlin.h" #include "Marlin.h"
#include "language.h" #include "language.h"
#include "cardreader.h" #include "cardreader.h"
@ -20,7 +20,7 @@ int absPreheatHotendTemp;
int absPreheatHPBTemp; int absPreheatHPBTemp;
int absPreheatFanSpeed; int absPreheatFanSpeed;
#ifdef FILAMENT_LCD_DISPLAY #if ENABLED(FILAMENT_LCD_DISPLAY)
millis_t previous_lcd_status_ms = 0; millis_t previous_lcd_status_ms = 0;
#endif #endif
@ -30,7 +30,7 @@ typedef void (*menuFunc_t)();
uint8_t lcd_status_message_level; uint8_t lcd_status_message_level;
char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
#ifdef DOGLCD #if ENABLED(DOGLCD)
#include "dogm_lcd_implementation.h" #include "dogm_lcd_implementation.h"
#else #else
#include "ultralcd_implementation_hitachi_HD44780.h" #include "ultralcd_implementation_hitachi_HD44780.h"
@ -39,7 +39,7 @@ char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with
// The main status screen // The main status screen
static void lcd_status_screen(); static void lcd_status_screen();
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
extern bool powersupply; extern bool powersupply;
@ -55,19 +55,19 @@ static void lcd_status_screen();
static void lcd_control_temperature_preheat_abs_settings_menu(); static void lcd_control_temperature_preheat_abs_settings_menu();
static void lcd_control_motion_menu(); static void lcd_control_motion_menu();
static void lcd_control_volumetric_menu(); static void lcd_control_volumetric_menu();
#ifdef HAS_LCD_CONTRAST #if ENABLED(HAS_LCD_CONTRAST)
static void lcd_set_contrast(); static void lcd_set_contrast();
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
static void lcd_control_retract_menu(); static void lcd_control_retract_menu();
#endif #endif
static void lcd_sdcard_menu(); static void lcd_sdcard_menu();
#ifdef DELTA_CALIBRATION_MENU #if ENABLED(DELTA_CALIBRATION_MENU)
static void lcd_delta_calibrate_menu(); static void lcd_delta_calibrate_menu();
#endif #endif
#if defined(MANUAL_BED_LEVELING) #if ENABLED(MANUAL_BED_LEVELING)
#include "mesh_bed_leveling.h" #include "mesh_bed_leveling.h"
static void _lcd_level_bed(); static void _lcd_level_bed();
static void _lcd_level_bed_homing(); static void _lcd_level_bed_homing();
@ -102,7 +102,7 @@ static void lcd_status_screen();
#define ENCODER_FEEDRATE_DEADZONE 10 #define ENCODER_FEEDRATE_DEADZONE 10
#if !defined(LCD_I2C_VIKI) #if DISABLED(LCD_I2C_VIKI)
#ifndef ENCODER_STEPS_PER_MENU_ITEM #ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 5 #define ENCODER_STEPS_PER_MENU_ITEM 5
#endif #endif
@ -169,7 +169,7 @@ static void lcd_status_screen();
_menuItemNr++; \ _menuItemNr++; \
} while(0) } while(0)
#ifdef ENCODER_RATE_MULTIPLIER #if ENABLED(ENCODER_RATE_MULTIPLIER)
//#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value //#define ENCODER_RATE_MULTIPLIER_DEBUG // If defined, output the encoder steps per second value
@ -196,7 +196,7 @@ static void lcd_status_screen();
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0) #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
#ifdef ENCODER_RATE_MULTIPLIER #if ENABLED(ENCODER_RATE_MULTIPLIER)
#define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args) #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
#define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
#else //!ENCODER_RATE_MULTIPLIER #else //!ENCODER_RATE_MULTIPLIER
@ -210,11 +210,11 @@ static void lcd_status_screen();
/** Used variables to keep track of the menu */ /** Used variables to keep track of the menu */
volatile uint8_t buttons; //the last checked buttons in a bit array. volatile uint8_t buttons; //the last checked buttons in a bit array.
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif #endif
#ifdef LCD_HAS_SLOW_BUTTONS #if ENABLED(LCD_HAS_SLOW_BUTTONS)
volatile uint8_t slow_buttons; // Bits of the pressed buttons. volatile uint8_t slow_buttons; // Bits of the pressed buttons.
#endif #endif
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */ uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
@ -252,12 +252,12 @@ float raw_Ki, raw_Kd;
static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint32_t encoder=0) { static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint32_t encoder=0) {
if (currentMenu != menu) { if (currentMenu != menu) {
currentMenu = menu; currentMenu = menu;
#ifdef NEWPANEL #if ENABLED(NEWPANEL)
encoderPosition = encoder; encoderPosition = encoder;
if (feedback) lcd_quick_feedback(); if (feedback) lcd_quick_feedback();
#endif #endif
// For LCD_PROGRESS_BAR re-initialize the custom characters // For LCD_PROGRESS_BAR re-initialize the custom characters
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
lcd_set_custom_characters(menu == lcd_status_screen); lcd_set_custom_characters(menu == lcd_status_screen);
#endif #endif
} }
@ -273,7 +273,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint
static void lcd_status_screen() { static void lcd_status_screen() {
encoderRateMultiplierEnabled = false; encoderRateMultiplierEnabled = false;
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
millis_t ms = millis(); millis_t ms = millis();
#ifndef PROGRESS_MSG_ONCE #ifndef PROGRESS_MSG_ONCE
if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
@ -305,7 +305,7 @@ static void lcd_status_screen() {
lcd_implementation_status_screen(); lcd_implementation_status_screen();
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
bool current_click = LCD_CLICKED; bool current_click = LCD_CLICKED;
@ -326,16 +326,16 @@ static void lcd_status_screen() {
if (current_click) { if (current_click) {
lcd_goto_menu(lcd_main_menu, true); lcd_goto_menu(lcd_main_menu, true);
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
currentMenu == lcd_status_screen currentMenu == lcd_status_screen
#endif #endif
); );
#ifdef FILAMENT_LCD_DISPLAY #if ENABLED(FILAMENT_LCD_DISPLAY)
previous_lcd_status_ms = millis(); // get status message to show up for a while previous_lcd_status_ms = millis(); // get status message to show up for a while
#endif #endif
} }
#ifdef ULTIPANEL_FEEDMULTIPLY #if ENABLED(ULTIPANEL_FEEDMULTIPLY)
// Dead zone at 100% feedrate // Dead zone at 100% feedrate
if ((feedrate_multiplier < 100 && (feedrate_multiplier + int(encoderPosition)) > 100) || if ((feedrate_multiplier < 100 && (feedrate_multiplier + int(encoderPosition)) > 100) ||
(feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) { (feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) {
@ -363,7 +363,7 @@ static void lcd_status_screen() {
#endif //ULTIPANEL #endif //ULTIPANEL
} }
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); } static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
@ -394,13 +394,13 @@ static void lcd_main_menu() {
} }
else { else {
MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu); MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
#ifdef DELTA_CALIBRATION_MENU #if ENABLED(DELTA_CALIBRATION_MENU)
MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu); MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
#endif #endif
} }
MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu); MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
if (card.cardOK) { if (card.cardOK) {
if (card.isFileOpen()) { if (card.isFileOpen()) {
if (card.sdprinting) if (card.sdprinting)
@ -427,7 +427,7 @@ static void lcd_main_menu() {
END_MENU(); END_MENU();
} }
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
static void lcd_autostart_sd() { static void lcd_autostart_sd() {
card.autostart_index = 0; card.autostart_index = 0;
card.setroot(); card.setroot();
@ -445,7 +445,7 @@ void lcd_set_home_offsets() {
} }
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
static void _lcd_babystep(int axis, const char *msg) { static void _lcd_babystep(int axis, const char *msg) {
if (encoderPosition != 0) { if (encoderPosition != 0) {
@ -500,14 +500,14 @@ static void lcd_tune_menu() {
MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &extruder_multiplier[3], 10, 999); MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &extruder_multiplier[3], 10, 999);
#endif #endif
#ifdef BABYSTEPPING #if ENABLED(BABYSTEPPING)
#ifdef BABYSTEP_XY #if ENABLED(BABYSTEP_XY)
MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x); MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x);
MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y); MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y);
#endif //BABYSTEP_XY #endif //BABYSTEP_XY
MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);
#endif #endif
#ifdef FILAMENTCHANGEENABLE #if ENABLED(FILAMENTCHANGEENABLE)
MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600")); MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600"));
#endif #endif
END_MENU(); END_MENU();
@ -638,10 +638,10 @@ static void lcd_prepare_menu() {
// //
// Level Bed // Level Bed
// //
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS])
MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29")); MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29"));
#elif defined(MANUAL_BED_LEVELING) #elif ENABLED(MANUAL_BED_LEVELING)
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed); MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
#endif #endif
@ -687,14 +687,14 @@ static void lcd_prepare_menu() {
// //
// Autostart // Autostart
// //
#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd); MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
#endif #endif
END_MENU(); END_MENU();
} }
#ifdef DELTA_CALIBRATION_MENU #if ENABLED(DELTA_CALIBRATION_MENU)
static void lcd_delta_calibrate_menu() { static void lcd_delta_calibrate_menu() {
START_MENU(); START_MENU();
@ -710,7 +710,7 @@ static void lcd_prepare_menu() {
#endif // DELTA_CALIBRATION_MENU #endif // DELTA_CALIBRATION_MENU
inline void line_to_current(AxisEnum axis) { inline void line_to_current(AxisEnum axis) {
#ifdef DELTA #if ENABLED(DELTA)
calculate_delta(current_position); calculate_delta(current_position);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder); plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
#else #else
@ -814,14 +814,14 @@ static void lcd_control_menu() {
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu); MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu); MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
#ifdef HAS_LCD_CONTRAST #if ENABLED(HAS_LCD_CONTRAST)
//MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63); //MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast); MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
#endif #endif
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu); MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
#endif #endif
#ifdef EEPROM_SETTINGS #if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings); MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings);
#endif #endif
@ -835,7 +835,7 @@ static void lcd_control_menu() {
* *
*/ */
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
// Helpers for editing PID Ki & Kd values // Helpers for editing PID Ki & Kd values
// grab the PID value out of the temp variable; scale it; then update the PID driver // grab the PID value out of the temp variable; scale it; then update the PID driver
@ -849,7 +849,7 @@ static void lcd_control_menu() {
} }
void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); } void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); }
void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); } void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); }
#ifdef PID_PARAMS_PER_EXTRUDER #if ENABLED(PID_PARAMS_PER_EXTRUDER)
#if EXTRUDERS > 1 #if EXTRUDERS > 1
void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); } void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); }
void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); } void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); }
@ -916,7 +916,7 @@ static void lcd_control_temperature_menu() {
// //
// Autotemp, Min, Max, Fact // Autotemp, Min, Max, Fact
// //
#if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0) #if ENABLED(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled); MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15); MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15); MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
@ -926,7 +926,7 @@ static void lcd_control_temperature_menu() {
// //
// PID-P, PID-I, PID-D, PID-C // PID-P, PID-I, PID-D, PID-C
// //
#ifdef PIDTEMP #if ENABLED(PIDTEMP)
// set up temp variables - undo the default scaling // set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,0)); raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
raw_Kd = unscalePID_d(PID_PARAM(Kd,0)); raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
@ -934,10 +934,10 @@ static void lcd_control_temperature_menu() {
// i is typically a small value so allows values below 1 // i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E1); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E1);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_E1); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_E1);
#ifdef PID_ADD_EXTRUSION_RATE #if ENABLED(PID_ADD_EXTRUSION_RATE)
MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990); MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
#endif//PID_ADD_EXTRUSION_RATE #endif//PID_ADD_EXTRUSION_RATE
#ifdef PID_PARAMS_PER_EXTRUDER #if ENABLED(PID_PARAMS_PER_EXTRUDER)
#if EXTRUDERS > 1 #if EXTRUDERS > 1
// set up temp variables - undo the default scaling // set up temp variables - undo the default scaling
raw_Ki = unscalePID_i(PID_PARAM(Ki,1)); raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
@ -946,7 +946,7 @@ static void lcd_control_temperature_menu() {
// i is typically a small value so allows values below 1 // i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E2, &raw_Kd, 1, 9990, copy_and_scalePID_d_E2); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E2, &raw_Kd, 1, 9990, copy_and_scalePID_d_E2);
#ifdef PID_ADD_EXTRUSION_RATE #if ENABLED(PID_ADD_EXTRUSION_RATE)
MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E2, &PID_PARAM(Kc,1), 1, 9990); MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E2, &PID_PARAM(Kc,1), 1, 9990);
#endif//PID_ADD_EXTRUSION_RATE #endif//PID_ADD_EXTRUSION_RATE
@ -958,7 +958,7 @@ static void lcd_control_temperature_menu() {
// i is typically a small value so allows values below 1 // i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E3, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E3, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E3, &raw_Kd, 1, 9990, copy_and_scalePID_d_E3); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E3, &raw_Kd, 1, 9990, copy_and_scalePID_d_E3);
#ifdef PID_ADD_EXTRUSION_RATE #if ENABLED(PID_ADD_EXTRUSION_RATE)
MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E3, &PID_PARAM(Kc,2), 1, 9990); MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E3, &PID_PARAM(Kc,2), 1, 9990);
#endif//PID_ADD_EXTRUSION_RATE #endif//PID_ADD_EXTRUSION_RATE
@ -970,7 +970,7 @@ static void lcd_control_temperature_menu() {
// i is typically a small value so allows values below 1 // i is typically a small value so allows values below 1
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E4, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E4, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4);
MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E4, &raw_Kd, 1, 9990, copy_and_scalePID_d_E4); MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E4, &raw_Kd, 1, 9990, copy_and_scalePID_d_E4);
#ifdef PID_ADD_EXTRUSION_RATE #if ENABLED(PID_ADD_EXTRUSION_RATE)
MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E4, &PID_PARAM(Kc,3), 1, 9990); MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E4, &PID_PARAM(Kc,3), 1, 9990);
#endif//PID_ADD_EXTRUSION_RATE #endif//PID_ADD_EXTRUSION_RATE
#endif//EXTRUDERS > 3 #endif//EXTRUDERS > 3
@ -1006,7 +1006,7 @@ static void lcd_control_temperature_preheat_pla_settings_menu() {
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15); MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15);
#endif #endif
#ifdef EEPROM_SETTINGS #if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
#endif #endif
END_MENU(); END_MENU();
@ -1027,7 +1027,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() {
#if TEMP_SENSOR_BED != 0 #if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15); MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15);
#endif #endif
#ifdef EEPROM_SETTINGS #if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
#endif #endif
END_MENU(); END_MENU();
@ -1041,7 +1041,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() {
static void lcd_control_motion_menu() { static void lcd_control_motion_menu() {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
#ifdef ENABLE_AUTO_BED_LEVELING #if ENABLED(ENABLE_AUTO_BED_LEVELING)
MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
#endif #endif
MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000); MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000);
@ -1064,10 +1064,10 @@ static void lcd_control_motion_menu() {
MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999); MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999); MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999); MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit); MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
#endif #endif
#ifdef SCARA #if ENABLED(SCARA)
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2); MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2); MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
#endif #endif
@ -1106,10 +1106,10 @@ static void lcd_control_volumetric_menu() {
* "Control" > "Contrast" submenu * "Control" > "Contrast" submenu
* *
*/ */
#ifdef HAS_LCD_CONTRAST #if ENABLED(HAS_LCD_CONTRAST)
static void lcd_set_contrast() { static void lcd_set_contrast() {
if (encoderPosition != 0) { if (encoderPosition != 0) {
#ifdef U8GLIB_LM6059_AF #if ENABLED(U8GLIB_LM6059_AF)
lcd_contrast += encoderPosition; lcd_contrast += encoderPosition;
lcd_contrast &= 0xFF; lcd_contrast &= 0xFF;
#else #else
@ -1121,7 +1121,7 @@ static void lcd_control_volumetric_menu() {
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
#ifdef U8GLIB_LM6059_AF #if ENABLED(U8GLIB_LM6059_AF)
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast)); lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast));
#else #else
lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
@ -1136,7 +1136,7 @@ static void lcd_control_volumetric_menu() {
* "Control" > "Retract" submenu * "Control" > "Retract" submenu
* *
*/ */
#ifdef FWRETRACT #if ENABLED(FWRETRACT)
static void lcd_control_retract_menu() { static void lcd_control_retract_menu() {
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu); MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
@ -1191,7 +1191,7 @@ void lcd_sdcard_menu() {
for (uint16_t i = 0; i < fileCnt; i++) { for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuItemNr == _lineNr) { if (_menuItemNr == _lineNr) {
card.getfilename( card.getfilename(
#ifdef SDCARD_RATHERRECENTFIRST #if ENABLED(SDCARD_RATHERRECENTFIRST)
fileCnt-1 - fileCnt-1 -
#endif #endif
i i
@ -1264,7 +1264,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
* Handlers for RepRap World Keypad input * Handlers for RepRap World Keypad input
* *
*/ */
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
static void reprapworld_keypad_move_z_up() { static void reprapworld_keypad_move_z_up() {
encoderPosition = 1; encoderPosition = 1;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
@ -1307,7 +1307,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
* *
*/ */
#ifdef LCD_USE_I2C_BUZZER #if ENABLED(LCD_USE_I2C_BUZZER)
void lcd_buzz(long duration, uint16_t freq) { // called from buzz() in Marlin_main.cpp where lcd is unknown void lcd_buzz(long duration, uint16_t freq) { // called from buzz() in Marlin_main.cpp where lcd is unknown
lcd.buzz(duration, freq); lcd.buzz(duration, freq);
} }
@ -1317,7 +1317,7 @@ void lcd_quick_feedback() {
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
next_button_update_ms = millis() + 500; next_button_update_ms = millis() + 500;
#ifdef LCD_USE_I2C_BUZZER #if ENABLED(LCD_USE_I2C_BUZZER)
#ifndef LCD_FEEDBACK_FREQUENCY_HZ #ifndef LCD_FEEDBACK_FREQUENCY_HZ
#define LCD_FEEDBACK_FREQUENCY_HZ 100 #define LCD_FEEDBACK_FREQUENCY_HZ 100
#endif #endif
@ -1375,7 +1375,7 @@ static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr,
void lcd_init() { void lcd_init() {
lcd_implementation_init(); lcd_implementation_init();
#ifdef NEWPANEL #if ENABLED(NEWPANEL)
SET_INPUT(BTN_EN1); SET_INPUT(BTN_EN1);
SET_INPUT(BTN_EN2); SET_INPUT(BTN_EN2);
@ -1385,7 +1385,7 @@ void lcd_init() {
SET_INPUT(BTN_ENC); SET_INPUT(BTN_ENC);
WRITE(BTN_ENC,HIGH); WRITE(BTN_ENC,HIGH);
#endif #endif
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
pinMode(SHIFT_CLK,OUTPUT); pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT); pinMode(SHIFT_LD,OUTPUT);
pinMode(SHIFT_OUT,INPUT); pinMode(SHIFT_OUT,INPUT);
@ -1393,7 +1393,7 @@ void lcd_init() {
WRITE(SHIFT_LD,HIGH); WRITE(SHIFT_LD,HIGH);
#endif #endif
#else // Not NEWPANEL #else // Not NEWPANEL
#ifdef SR_LCD_2W_NL // Non latching 2 wire shift register #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
pinMode (SR_DATA_PIN, OUTPUT); pinMode (SR_DATA_PIN, OUTPUT);
pinMode (SR_CLK_PIN, OUTPUT); pinMode (SR_CLK_PIN, OUTPUT);
#elif defined(SHIFT_CLK) #elif defined(SHIFT_CLK)
@ -1407,19 +1407,19 @@ void lcd_init() {
#endif // SR_LCD_2W_NL #endif // SR_LCD_2W_NL
#endif//!NEWPANEL #endif//!NEWPANEL
#if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) #if ENABLED(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
pinMode(SDCARDDETECT, INPUT); pinMode(SDCARDDETECT, INPUT);
WRITE(SDCARDDETECT, HIGH); WRITE(SDCARDDETECT, HIGH);
lcd_oldcardstatus = IS_SD_INSERTED; lcd_oldcardstatus = IS_SD_INSERTED;
#endif //(SDCARDDETECT > 0) #endif //(SDCARDDETECT > 0)
#ifdef LCD_HAS_SLOW_BUTTONS #if ENABLED(LCD_HAS_SLOW_BUTTONS)
slow_buttons = 0; slow_buttons = 0;
#endif #endif
lcd_buttons_update(); lcd_buttons_update();
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
encoderDiff = 0; encoderDiff = 0;
#endif #endif
} }
@ -1456,11 +1456,11 @@ int lcd_strlen_P(const char *s) {
* Warning: This function is called from interrupt context! * Warning: This function is called from interrupt context!
*/ */
void lcd_update() { void lcd_update() {
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
static millis_t return_to_status_ms = 0; static millis_t return_to_status_ms = 0;
#endif #endif
#ifdef LCD_HAS_SLOW_BUTTONS #if ENABLED(LCD_HAS_SLOW_BUTTONS)
slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
#endif #endif
@ -1471,7 +1471,7 @@ void lcd_update() {
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
lcd_oldcardstatus = IS_SD_INSERTED; lcd_oldcardstatus = IS_SD_INSERTED;
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
currentMenu == lcd_status_screen currentMenu == lcd_status_screen
#endif #endif
); );
@ -1490,9 +1490,9 @@ void lcd_update() {
millis_t ms = millis(); millis_t ms = millis();
if (ms > next_lcd_update_ms) { if (ms > next_lcd_update_ms) {
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up(); if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up();
if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) reprapworld_keypad_move_z_down(); if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) reprapworld_keypad_move_z_down();
if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left(); if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left();
@ -1507,7 +1507,7 @@ void lcd_update() {
if (encoderPastThreshold) { if (encoderPastThreshold) {
int32_t encoderMultiplier = 1; int32_t encoderMultiplier = 1;
#ifdef ENCODER_RATE_MULTIPLIER #if ENABLED(ENCODER_RATE_MULTIPLIER)
if (encoderRateMultiplierEnabled) { if (encoderRateMultiplierEnabled) {
int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP; int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
@ -1520,7 +1520,7 @@ void lcd_update() {
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
#ifdef ENCODER_RATE_MULTIPLIER_DEBUG #if ENABLED(ENCODER_RATE_MULTIPLIER_DEBUG)
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHO("Enc Step Rate: "); SERIAL_ECHO("Enc Step Rate: ");
SERIAL_ECHO(encoderStepRate); SERIAL_ECHO(encoderStepRate);
@ -1554,7 +1554,7 @@ void lcd_update() {
lcd_status_update_delay--; lcd_status_update_delay--;
} }
} }
#ifdef DOGLCD // Changes due to different driver architecture of the DOGM display #if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
blink++; // Variable for fan animation and alive dot blink++; // Variable for fan animation and alive dot
u8g.firstPage(); u8g.firstPage();
@ -1571,15 +1571,15 @@ void lcd_update() {
(*currentMenu)(); (*currentMenu)();
#endif #endif
#ifdef LCD_HAS_STATUS_INDICATORS #if ENABLED(LCD_HAS_STATUS_INDICATORS)
lcd_implementation_update_indicators(); lcd_implementation_update_indicators();
#endif #endif
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
// Return to Status Screen after a timeout // Return to Status Screen after a timeout
if (currentMenu != lcd_status_screen && if (currentMenu != lcd_status_screen &&
#ifdef MANUAL_BED_LEVELING #if ENABLED(MANUAL_BED_LEVELING)
currentMenu != _lcd_level_bed && currentMenu != _lcd_level_bed &&
currentMenu != _lcd_level_bed_homing && currentMenu != _lcd_level_bed_homing &&
#endif #endif
@ -1603,7 +1603,7 @@ void lcd_ignore_click(bool b) {
} }
void lcd_finishstatus(bool persist=false) { void lcd_finishstatus(bool persist=false) {
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
progress_bar_ms = millis(); progress_bar_ms = millis();
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
@ -1611,12 +1611,12 @@ void lcd_finishstatus(bool persist=false) {
#endif #endif
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
#ifdef FILAMENT_LCD_DISPLAY #if ENABLED(FILAMENT_LCD_DISPLAY)
previous_lcd_status_ms = millis(); //get status message to show up for a while previous_lcd_status_ms = millis(); //get status message to show up for a while
#endif #endif
} }
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus() { expire_status_ms = 0; } void dontExpireStatus() { expire_status_ms = 0; }
#endif #endif
@ -1650,21 +1650,21 @@ void lcd_setstatuspgm(const char* message, uint8_t level) {
void lcd_setalertstatuspgm(const char* message) { void lcd_setalertstatuspgm(const char* message) {
lcd_setstatuspgm(message, 1); lcd_setstatuspgm(message, 1);
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
lcd_return_to_status(); lcd_return_to_status();
#endif #endif
} }
void lcd_reset_alert_level() { lcd_status_message_level = 0; } void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#ifdef HAS_LCD_CONTRAST #if ENABLED(HAS_LCD_CONTRAST)
void lcd_setcontrast(uint8_t value) { void lcd_setcontrast(uint8_t value) {
lcd_contrast = value & 0x3F; lcd_contrast = value & 0x3F;
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
#endif #endif
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
/** /**
* Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement) * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
@ -1683,7 +1683,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
* Warning: This function is called from interrupt context! * Warning: This function is called from interrupt context!
*/ */
void lcd_buttons_update() { void lcd_buttons_update() {
#ifdef NEWPANEL #if ENABLED(NEWPANEL)
uint8_t newbutton = 0; uint8_t newbutton = 0;
if (READ(BTN_EN1) == 0) newbutton |= EN_A; if (READ(BTN_EN1) == 0) newbutton |= EN_A;
if (READ(BTN_EN2) == 0) newbutton |= EN_B; if (READ(BTN_EN2) == 0) newbutton |= EN_B;
@ -1691,10 +1691,10 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C; if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C;
#endif #endif
buttons = newbutton; buttons = newbutton;
#ifdef LCD_HAS_SLOW_BUTTONS #if ENABLED(LCD_HAS_SLOW_BUTTONS)
buttons |= slow_buttons; buttons |= slow_buttons;
#endif #endif
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
// for the reprapworld_keypad // for the reprapworld_keypad
uint8_t newbutton_reprapworld_keypad=0; uint8_t newbutton_reprapworld_keypad=0;
WRITE(SHIFT_LD, LOW); WRITE(SHIFT_LD, LOW);
@ -1749,7 +1749,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
} }
bool lcd_detected(void) { bool lcd_detected(void) {
#if (defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE) #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
return lcd.LcdDetected() == 1; return lcd.LcdDetected() == 1;
#else #else
return true; return true;
@ -1993,7 +1993,7 @@ char *ftostr52(const float &x) {
return conv; return conv;
} }
#ifdef MANUAL_BED_LEVELING #if ENABLED(MANUAL_BED_LEVELING)
static int _lcd_level_bed_position; static int _lcd_level_bed_position;

18
Marlin/ultralcd.h

@ -4,7 +4,7 @@
#include "Marlin.h" #include "Marlin.h"
#include "buzzer.h" #include "buzzer.h"
#ifdef ULTRA_LCD #if ENABLED(ULTRA_LCD)
int lcd_strlen(char *s); int lcd_strlen(char *s);
int lcd_strlen_P(const char *s); int lcd_strlen_P(const char *s);
void lcd_update(); void lcd_update();
@ -16,15 +16,15 @@
void lcd_reset_alert_level(); void lcd_reset_alert_level();
bool lcd_detected(void); bool lcd_detected(void);
#ifdef LCD_USE_I2C_BUZZER #if ENABLED(LCD_USE_I2C_BUZZER)
void lcd_buzz(long duration, uint16_t freq); void lcd_buzz(long duration, uint16_t freq);
#endif #endif
#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
void dontExpireStatus(); void dontExpireStatus();
#endif #endif
#ifdef DOGLCD #if ENABLED(DOGLCD)
extern int lcd_contrast; extern int lcd_contrast;
void lcd_setcontrast(uint8_t value); void lcd_setcontrast(uint8_t value);
#endif #endif
@ -35,10 +35,10 @@
#define LCD_UPDATE_INTERVAL 100 #define LCD_UPDATE_INTERVAL 100
#define LCD_TIMEOUT_TO_STATUS 15000 #define LCD_TIMEOUT_TO_STATUS 15000
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
void lcd_buttons_update(); void lcd_buttons_update();
extern volatile uint8_t buttons; //the last checked buttons in a bit array. extern volatile uint8_t buttons; //the last checked buttons in a bit array.
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif #endif
#else #else
@ -54,7 +54,7 @@
extern bool cancel_heatup; extern bool cancel_heatup;
#ifdef FILAMENT_LCD_DISPLAY #if ENABLED(FILAMENT_LCD_DISPLAY)
extern millis_t previous_lcd_status_ms; extern millis_t previous_lcd_status_ms;
#endif #endif
void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
@ -62,13 +62,13 @@
void lcd_ignore_click(bool b=true); void lcd_ignore_click(bool b=true);
#ifdef NEWPANEL #if ENABLED(NEWPANEL)
#define EN_C BIT(BLEN_C) #define EN_C BIT(BLEN_C)
#define EN_B BIT(BLEN_B) #define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A) #define EN_A BIT(BLEN_A)
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#ifdef REPRAPWORLD_KEYPAD #if ENABLED(REPRAPWORLD_KEYPAD)
#define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3)) #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2)) #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
#define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1)) #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))

60
Marlin/ultralcd_implementation_hitachi_HD44780.h

@ -19,7 +19,7 @@
// macro name. The mapping is independent of whether the button is directly connected or // macro name. The mapping is independent of whether the button is directly connected or
// via a shift/i2c register. // via a shift/i2c register.
#ifdef ULTIPANEL #if ENABLED(ULTIPANEL)
// All UltiPanels might have an encoder - so this is always be mapped onto first two bits // All UltiPanels might have an encoder - so this is always be mapped onto first two bits
#define BLEN_B 1 #define BLEN_B 1
#define BLEN_A 0 #define BLEN_A 0
@ -36,7 +36,7 @@
// //
// Setup other button mappings of each panel // Setup other button mappings of each panel
// //
#if defined(LCD_I2C_VIKI) #if ENABLED(LCD_I2C_VIKI)
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
// button and encoder bit positions within 'buttons' // button and encoder bit positions within 'buttons'
@ -57,7 +57,7 @@
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
#define LCD_HAS_SLOW_BUTTONS #define LCD_HAS_SLOW_BUTTONS
#elif defined(LCD_I2C_PANELOLU2) #elif ENABLED(LCD_I2C_PANELOLU2)
// encoder click can be read through I2C if not directly connected // encoder click can be read through I2C if not directly connected
#if BTN_ENC <= 0 #if BTN_ENC <= 0
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
@ -72,7 +72,7 @@
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#endif #endif
#elif defined(REPRAPWORLD_KEYPAD) #elif ENABLED(REPRAPWORLD_KEYPAD)
// define register bit values, don't change it // define register bit values, don't change it
#define BLEN_REPRAPWORLD_KEYPAD_F3 0 #define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1 #define BLEN_REPRAPWORLD_KEYPAD_F2 1
@ -99,7 +99,7 @@
//#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP) //#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
//#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE) //#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
#elif defined(NEWPANEL) #elif ENABLED(NEWPANEL)
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#else // old style ULTIPANEL #else // old style ULTIPANEL
@ -127,7 +127,7 @@
//////////////////////////////////// ////////////////////////////////////
// Create LCD class instance and chipset-specific information // Create LCD class instance and chipset-specific information
#if defined(LCD_I2C_TYPE_PCF8575) #if ENABLED(LCD_I2C_TYPE_PCF8575)
// note: these are register mapped pins on the PCF8575 controller not Arduino pins // note: these are register mapped pins on the PCF8575 controller not Arduino pins
#define LCD_I2C_PIN_BL 3 #define LCD_I2C_PIN_BL 3
#define LCD_I2C_PIN_EN 2 #define LCD_I2C_PIN_EN 2
@ -144,7 +144,7 @@
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7); LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
#elif defined(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
//for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators()) //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
#define LED_A 0x04 //100 #define LED_A 0x04 //100
#define LED_B 0x02 //010 #define LED_B 0x02 //010
@ -155,30 +155,30 @@
#include <Wire.h> #include <Wire.h>
#include <LiquidTWI2.h> #include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2 #define LCD_CLASS LiquidTWI2
#if defined(DETECT_DEVICE) #if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else #else
LCD_CLASS lcd(LCD_I2C_ADDRESS); LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif #endif
#elif defined(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
#include <Wire.h> #include <Wire.h>
#include <LiquidTWI2.h> #include <LiquidTWI2.h>
#define LCD_CLASS LiquidTWI2 #define LCD_CLASS LiquidTWI2
#if defined(DETECT_DEVICE) #if ENABLED(DETECT_DEVICE)
LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
#else #else
LCD_CLASS lcd(LCD_I2C_ADDRESS); LCD_CLASS lcd(LCD_I2C_ADDRESS);
#endif #endif
#elif defined(LCD_I2C_TYPE_PCA8574) #elif ENABLED(LCD_I2C_TYPE_PCA8574)
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C #define LCD_CLASS LiquidCrystal_I2C
LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
// 2 wire Non-latching LCD SR from: // 2 wire Non-latching LCD SR from:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
#elif defined(SR_LCD_2W_NL) #elif ENABLED(SR_LCD_2W_NL)
extern "C" void __cxa_pure_virtual() { while (1); } extern "C" void __cxa_pure_virtual() { while (1); }
#include <LCD.h> #include <LCD.h>
#include <LiquidCrystal_SR.h> #include <LiquidCrystal_SR.h>
@ -193,7 +193,7 @@
#include "utf_mapper.h" #include "utf_mapper.h"
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
static millis_t progress_bar_ms = 0; static millis_t progress_bar_ms = 0;
#if PROGRESS_MSG_EXPIRE > 0 #if PROGRESS_MSG_EXPIRE > 0
static millis_t expire_status_ms = 0; static millis_t expire_status_ms = 0;
@ -202,7 +202,7 @@
#endif #endif
static void lcd_set_custom_characters( static void lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set=true bool progress_bar_set=true
#endif #endif
) { ) {
@ -287,7 +287,7 @@ static void lcd_set_custom_characters(
B00000 B00000
}; //thanks Sonny Mounicou }; //thanks Sonny Mounicou
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
static bool char_mode = false; static bool char_mode = false;
byte progress[3][8] = { { byte progress[3][8] = { {
B00000, B00000,
@ -348,28 +348,28 @@ static void lcd_set_custom_characters(
} }
static void lcd_implementation_init( static void lcd_implementation_init(
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set=true bool progress_bar_set=true
#endif #endif
) { ) {
#if defined(LCD_I2C_TYPE_PCF8575) #if ENABLED(LCD_I2C_TYPE_PCF8575)
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#ifdef LCD_I2C_PIN_BL #ifdef LCD_I2C_PIN_BL
lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE); lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
lcd.setBacklight(HIGH); lcd.setBacklight(HIGH);
#endif #endif
#elif defined(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
lcd.setMCPType(LTI_TYPE_MCP23017); lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.setBacklight(0); //set all the LEDs off to begin with lcd.setBacklight(0); //set all the LEDs off to begin with
#elif defined(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
lcd.setMCPType(LTI_TYPE_MCP23008); lcd.setMCPType(LTI_TYPE_MCP23008);
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#elif defined(LCD_I2C_TYPE_PCA8574) #elif ENABLED(LCD_I2C_TYPE_PCA8574)
lcd.init(); lcd.init();
lcd.backlight(); lcd.backlight();
@ -378,7 +378,7 @@ static void lcd_implementation_init(
#endif #endif
lcd_set_custom_characters( lcd_set_custom_characters(
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
progress_bar_set progress_bar_set
#endif #endif
); );
@ -499,7 +499,7 @@ static void lcd_implementation_status_screen() {
#if LCD_WIDTH < 20 #if LCD_WIDTH < 20
#ifdef SDSUPPORT #if ENABLED(SDSUPPORT)
lcd.setCursor(0, 2); lcd.setCursor(0, 2);
lcd_printPGM(PSTR("SD")); lcd_printPGM(PSTR("SD"));
if (IS_SD_PRINTING) if (IS_SD_PRINTING)
@ -558,7 +558,7 @@ static void lcd_implementation_status_screen() {
lcd.print(itostr3(feedrate_multiplier)); lcd.print(itostr3(feedrate_multiplier));
lcd.print('%'); lcd.print('%');
#if LCD_WIDTH > 19 && defined(SDSUPPORT) #if LCD_WIDTH > 19 && ENABLED(SDSUPPORT)
lcd.setCursor(7, 2); lcd.setCursor(7, 2);
lcd_printPGM(PSTR("SD")); lcd_printPGM(PSTR("SD"));
@ -591,7 +591,7 @@ static void lcd_implementation_status_screen() {
lcd.setCursor(0, LCD_HEIGHT - 1); lcd.setCursor(0, LCD_HEIGHT - 1);
#ifdef LCD_PROGRESS_BAR #if ENABLED(LCD_PROGRESS_BAR)
if (card.isFileOpen()) { if (card.isFileOpen()) {
// Draw the progress bar if the message has shown long enough // Draw the progress bar if the message has shown long enough
@ -613,7 +613,7 @@ static void lcd_implementation_status_screen() {
} }
} //card.isFileOpen } //card.isFileOpen
#elif defined(FILAMENT_LCD_DISPLAY) #elif ENABLED(FILAMENT_LCD_DISPLAY)
// Show Filament Diameter and Volumetric Multiplier % // Show Filament Diameter and Volumetric Multiplier %
// After allowing lcd_status_message to show for 5 seconds // After allowing lcd_status_message to show for 5 seconds
@ -730,10 +730,10 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#ifdef LCD_HAS_STATUS_INDICATORS #if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators() { static void lcd_implementation_update_indicators() {
#if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI) #if ENABLED(LCD_I2C_PANELOLU2) || ENABLED(LCD_I2C_VIKI)
// Set the LEDS - referred to as backlights by the LiquidTWI2 library // Set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0; static uint8_t ledsprev = 0;
uint8_t leds = 0; uint8_t leds = 0;
@ -752,17 +752,17 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
#endif // LCD_HAS_STATUS_INDICATORS #endif // LCD_HAS_STATUS_INDICATORS
#ifdef LCD_HAS_SLOW_BUTTONS #if ENABLED(LCD_HAS_SLOW_BUTTONS)
extern millis_t next_button_update_ms; extern millis_t next_button_update_ms;
static uint8_t lcd_implementation_read_slow_buttons() { static uint8_t lcd_implementation_read_slow_buttons() {
#ifdef LCD_I2C_TYPE_MCP23017 #if ENABLED(LCD_I2C_TYPE_MCP23017)
uint8_t slow_buttons; uint8_t slow_buttons;
// Reading these buttons this is likely to be too slow to call inside interrupt context // Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update // so they are called during normal lcd_update
slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET; slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET;
#ifdef LCD_I2C_VIKI #if ENABLED(LCD_I2C_VIKI)
if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked
slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated
#endif #endif

Loading…
Cancel
Save