diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 3fa9c33b1f..cf12a11696 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/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. */ -#ifdef ULTIPANEL +#if ENABLED(ULTIPANEL) #define BLEN_A 0 #define BLEN_B 1 #define BLEN_C 2 @@ -35,12 +35,12 @@ #include "ultralcd_st7920_u8glib_rrd.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 #endif -#ifdef USE_SMALL_INFOFONT +#if ENABLED(USE_SMALL_INFOFONT) #include "dogm_font_data_6x9_marlin.h" #define FONT_STATUSMENU_NAME u8g_font_6x9 #else @@ -50,17 +50,17 @@ #include "dogm_font_data_Marlin_symbols.h" // The Marlin special symbols #define FONT_SPECIAL_NAME Marlin_symbols -#ifndef SIMULATE_ROMFONT - #if defined( DISPLAY_CHARSET_ISO10646_1 ) +#if DISABLED(SIMULATE_ROMFONT) + #if ENABLED(DISPLAY_CHARSET_ISO10646_1) #include "dogm_font_data_ISO10646_1.h" #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" #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" #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" #define FONT_MENU_NAME ISO10646_CN #define TALL_FONT_CORRECTION 1 @@ -69,13 +69,13 @@ #define FONT_MENU_NAME ISO10646_1_5x7 #endif #else // SIMULATE_ROMFONT - #if defined( DISPLAY_CHARSET_HD44780_JAPAN ) + #if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN) #include "dogm_font_data_HD44780_J.h" #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" #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" #define FONT_MENU_NAME HD44780_C_5x7 #else // fall-back @@ -94,7 +94,7 @@ // DOGM parameters (size in pixels) #define DOG_CHAR_WIDTH 6 #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 DOG_CHAR_WIDTH_EDIT 9 #define DOG_CHAR_HEIGHT_EDIT 18 @@ -113,16 +113,16 @@ #define START_ROW 0 // LCD selection -#ifdef U8GLIB_ST7920 +#if ENABLED(U8GLIB_ST7920) //U8GLIB_ST7920_128X64_RRD u8g(0,0,0); U8GLIB_ST7920_128X64_RRD u8g(0); -#elif defined(MAKRPANEL) +#elif ENABLED(MAKRPANEL) // The MaKrPanel display, ST7565 controller as well 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 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) U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0); #elif defined U8GLIB_SSD1306 @@ -195,12 +195,12 @@ static bool show_splashscreen = true; /* Warning: This function is called from interrupt context */ 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); digitalWrite(LCD_PIN_BL, HIGH); #endif - #ifdef LCD_PIN_RESET + #if ENABLED(LCD_PIN_RESET) pinMode(LCD_PIN_RESET, OUTPUT); digitalWrite(LCD_PIN_RESET, HIGH); #endif @@ -212,17 +212,17 @@ static void lcd_implementation_init() { // pinMode(17, OUTPUT); // Enable LCD backlight // digitalWrite(17, HIGH); - #ifdef LCD_SCREEN_ROT_90 + #if ENABLED(LCD_SCREEN_ROT_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° - #elif defined(LCD_SCREEN_ROT_270) + #elif ENABLED(LCD_SCREEN_ROT_270) u8g.setRot270(); // Rotate screen by 270° #endif // Show splashscreen int offx = (u8g.getWidth() - START_BMPWIDTH) / 2; - #ifdef START_BMPHIGH + #if ENABLED(START_BMPHIGH) int offy = 0; #else int offy = DOG_CHAR_HEIGHT; @@ -277,7 +277,7 @@ static void lcd_implementation_status_screen() { // Symbols menu graphics, animated fan 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 u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7); u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5); @@ -332,7 +332,7 @@ static void lcd_implementation_status_screen() { #define XYZ_BASELINE 38 lcd_setFont(FONT_STATUSMENU); - #ifdef USE_SMALL_INFOFONT + #if ENABLED(USE_SMALL_INFOFONT) u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10); #else u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9); @@ -378,12 +378,12 @@ static void lcd_implementation_status_screen() { // Status line lcd_setFont(FONT_STATUSMENU); - #ifdef USE_SMALL_INFOFONT + #if ENABLED(USE_SMALL_INFOFONT) u8g.setPrintPos(0,62); #else u8g.setPrintPos(0,63); #endif - #ifndef FILAMENT_LCD_DISPLAY + #if DISABLED(FILAMENT_LCD_DISPLAY) lcd_print(lcd_status_message); #else 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 vallen = lcd_strlen(value); - #ifdef USE_BIG_EDIT_FONT + #if ENABLED(USE_BIG_EDIT_FONT) if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) { lcd_setFont(FONT_MENU_EDIT); lcd_width = LCD_WIDTH_EDIT + 1; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 30c174031a..88e60de711 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1,5 +1,5 @@ #include "ultralcd.h" -#ifdef ULTRA_LCD +#if ENABLED(ULTRA_LCD) #include "Marlin.h" #include "language.h" #include "cardreader.h" @@ -20,7 +20,7 @@ int absPreheatHotendTemp; int absPreheatHPBTemp; int absPreheatFanSpeed; -#ifdef FILAMENT_LCD_DISPLAY +#if ENABLED(FILAMENT_LCD_DISPLAY) millis_t previous_lcd_status_ms = 0; #endif @@ -30,7 +30,7 @@ typedef void (*menuFunc_t)(); 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 -#ifdef DOGLCD +#if ENABLED(DOGLCD) #include "dogm_lcd_implementation.h" #else #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 static void lcd_status_screen(); -#ifdef ULTIPANEL +#if ENABLED(ULTIPANEL) #if HAS_POWER_SWITCH 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_motion_menu(); static void lcd_control_volumetric_menu(); - #ifdef HAS_LCD_CONTRAST + #if ENABLED(HAS_LCD_CONTRAST) static void lcd_set_contrast(); #endif - #ifdef FWRETRACT + #if ENABLED(FWRETRACT) static void lcd_control_retract_menu(); #endif static void lcd_sdcard_menu(); - #ifdef DELTA_CALIBRATION_MENU + #if ENABLED(DELTA_CALIBRATION_MENU) static void lcd_delta_calibrate_menu(); #endif - #if defined(MANUAL_BED_LEVELING) + #if ENABLED(MANUAL_BED_LEVELING) #include "mesh_bed_leveling.h" static void _lcd_level_bed(); static void _lcd_level_bed_homing(); @@ -102,7 +102,7 @@ static void lcd_status_screen(); #define ENCODER_FEEDRATE_DEADZONE 10 - #if !defined(LCD_I2C_VIKI) + #if DISABLED(LCD_I2C_VIKI) #ifndef ENCODER_STEPS_PER_MENU_ITEM #define ENCODER_STEPS_PER_MENU_ITEM 5 #endif @@ -169,7 +169,7 @@ static void lcd_status_screen(); _menuItemNr++; \ } 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 @@ -196,7 +196,7 @@ static void lcd_status_screen(); #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_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_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args) #else //!ENCODER_RATE_MULTIPLIER @@ -210,11 +210,11 @@ static void lcd_status_screen(); /** Used variables to keep track of the menu */ 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 #endif - #ifdef LCD_HAS_SLOW_BUTTONS + #if ENABLED(LCD_HAS_SLOW_BUTTONS) volatile uint8_t slow_buttons; // Bits of the pressed buttons. #endif 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) { if (currentMenu != menu) { currentMenu = menu; - #ifdef NEWPANEL + #if ENABLED(NEWPANEL) encoderPosition = encoder; if (feedback) lcd_quick_feedback(); #endif // 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); #endif } @@ -273,7 +273,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint static void lcd_status_screen() { encoderRateMultiplierEnabled = false; - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) millis_t ms = millis(); #ifndef PROGRESS_MSG_ONCE 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(); - #ifdef ULTIPANEL + #if ENABLED(ULTIPANEL) bool current_click = LCD_CLICKED; @@ -326,16 +326,16 @@ static void lcd_status_screen() { if (current_click) { lcd_goto_menu(lcd_main_menu, true); 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 #endif ); - #ifdef FILAMENT_LCD_DISPLAY + #if ENABLED(FILAMENT_LCD_DISPLAY) previous_lcd_status_ms = millis(); // get status message to show up for a while #endif } - #ifdef ULTIPANEL_FEEDMULTIPLY + #if ENABLED(ULTIPANEL_FEEDMULTIPLY) // Dead zone at 100% feedrate if ((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 } -#ifdef ULTIPANEL +#if ENABLED(ULTIPANEL) static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); } @@ -394,13 +394,13 @@ static void lcd_main_menu() { } else { 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); #endif } MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu); - #ifdef SDSUPPORT + #if ENABLED(SDSUPPORT) if (card.cardOK) { if (card.isFileOpen()) { if (card.sdprinting) @@ -427,7 +427,7 @@ static void lcd_main_menu() { END_MENU(); } -#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) +#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART) static void lcd_autostart_sd() { card.autostart_index = 0; 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) { 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); #endif - #ifdef BABYSTEPPING - #ifdef BABYSTEP_XY + #if ENABLED(BABYSTEPPING) + #if ENABLED(BABYSTEP_XY) MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x); MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y); #endif //BABYSTEP_XY MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); #endif - #ifdef FILAMENTCHANGEENABLE + #if ENABLED(FILAMENTCHANGEENABLE) MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600")); #endif END_MENU(); @@ -638,10 +638,10 @@ static void lcd_prepare_menu() { // // Level Bed // - #ifdef ENABLE_AUTO_BED_LEVELING + #if ENABLED(ENABLE_AUTO_BED_LEVELING) if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS]) 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); #endif @@ -687,14 +687,14 @@ static void lcd_prepare_menu() { // // Autostart // - #if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART) + #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART) MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd); #endif END_MENU(); } -#ifdef DELTA_CALIBRATION_MENU +#if ENABLED(DELTA_CALIBRATION_MENU) static void lcd_delta_calibrate_menu() { START_MENU(); @@ -710,7 +710,7 @@ static void lcd_prepare_menu() { #endif // DELTA_CALIBRATION_MENU inline void line_to_current(AxisEnum axis) { - #ifdef DELTA + #if ENABLED(DELTA) 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); #else @@ -814,14 +814,14 @@ static void lcd_control_menu() { MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_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(submenu, MSG_CONTRAST, lcd_set_contrast); #endif - #ifdef FWRETRACT + #if ENABLED(FWRETRACT) MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu); #endif - #ifdef EEPROM_SETTINGS + #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings); #endif @@ -835,7 +835,7 @@ static void lcd_control_menu() { * */ -#ifdef PIDTEMP +#if ENABLED(PIDTEMP) // Helpers for editing PID Ki & Kd values // 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_d_E1() { copy_and_scalePID_d(0); } - #ifdef PID_PARAMS_PER_EXTRUDER + #if ENABLED(PID_PARAMS_PER_EXTRUDER) #if EXTRUDERS > 1 void copy_and_scalePID_i_E2() { copy_and_scalePID_i(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 // - #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(float3, MSG_MIN, &autotemp_min, 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 // - #ifdef PIDTEMP + #if ENABLED(PIDTEMP) // set up temp variables - undo the default scaling raw_Ki = unscalePID_i(PID_PARAM(Ki,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 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); - #ifdef PID_ADD_EXTRUSION_RATE + #if ENABLED(PID_ADD_EXTRUSION_RATE) MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990); #endif//PID_ADD_EXTRUSION_RATE - #ifdef PID_PARAMS_PER_EXTRUDER + #if ENABLED(PID_PARAMS_PER_EXTRUDER) #if EXTRUDERS > 1 // set up temp variables - undo the default scaling 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 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); - #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); #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 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); - #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); #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 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); - #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); #endif//PID_ADD_EXTRUSION_RATE #endif//EXTRUDERS > 3 @@ -1006,7 +1006,7 @@ static void lcd_control_temperature_preheat_pla_settings_menu() { #if TEMP_SENSOR_BED != 0 MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15); #endif - #ifdef EEPROM_SETTINGS + #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); #endif END_MENU(); @@ -1027,7 +1027,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() { #if TEMP_SENSOR_BED != 0 MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15); #endif - #ifdef EEPROM_SETTINGS + #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings); #endif END_MENU(); @@ -1041,7 +1041,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() { static void lcd_control_motion_menu() { START_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); #endif 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(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); - #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); #endif - #ifdef SCARA + #if ENABLED(SCARA) 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); #endif @@ -1106,10 +1106,10 @@ static void lcd_control_volumetric_menu() { * "Control" > "Contrast" submenu * */ -#ifdef HAS_LCD_CONTRAST +#if ENABLED(HAS_LCD_CONTRAST) static void lcd_set_contrast() { if (encoderPosition != 0) { - #ifdef U8GLIB_LM6059_AF + #if ENABLED(U8GLIB_LM6059_AF) lcd_contrast += encoderPosition; lcd_contrast &= 0xFF; #else @@ -1121,7 +1121,7 @@ static void lcd_control_volumetric_menu() { u8g.setContrast(lcd_contrast); } if (lcdDrawUpdate) { - #ifdef U8GLIB_LM6059_AF + #if ENABLED(U8GLIB_LM6059_AF) lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast)); #else lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast)); @@ -1136,7 +1136,7 @@ static void lcd_control_volumetric_menu() { * "Control" > "Retract" submenu * */ -#ifdef FWRETRACT +#if ENABLED(FWRETRACT) static void lcd_control_retract_menu() { START_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++) { if (_menuItemNr == _lineNr) { card.getfilename( - #ifdef SDCARD_RATHERRECENTFIRST + #if ENABLED(SDCARD_RATHERRECENTFIRST) fileCnt-1 - #endif i @@ -1264,7 +1264,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01) * Handlers for RepRap World Keypad input * */ -#ifdef REPRAPWORLD_KEYPAD +#if ENABLED(REPRAPWORLD_KEYPAD) static void reprapworld_keypad_move_z_up() { encoderPosition = 1; 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 lcd.buzz(duration, freq); } @@ -1317,7 +1317,7 @@ void lcd_quick_feedback() { lcdDrawUpdate = 2; next_button_update_ms = millis() + 500; - #ifdef LCD_USE_I2C_BUZZER + #if ENABLED(LCD_USE_I2C_BUZZER) #ifndef LCD_FEEDBACK_FREQUENCY_HZ #define LCD_FEEDBACK_FREQUENCY_HZ 100 #endif @@ -1375,7 +1375,7 @@ static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, void lcd_init() { lcd_implementation_init(); - #ifdef NEWPANEL + #if ENABLED(NEWPANEL) SET_INPUT(BTN_EN1); SET_INPUT(BTN_EN2); @@ -1385,7 +1385,7 @@ void lcd_init() { SET_INPUT(BTN_ENC); WRITE(BTN_ENC,HIGH); #endif - #ifdef REPRAPWORLD_KEYPAD + #if ENABLED(REPRAPWORLD_KEYPAD) pinMode(SHIFT_CLK,OUTPUT); pinMode(SHIFT_LD,OUTPUT); pinMode(SHIFT_OUT,INPUT); @@ -1393,7 +1393,7 @@ void lcd_init() { WRITE(SHIFT_LD,HIGH); #endif #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_CLK_PIN, OUTPUT); #elif defined(SHIFT_CLK) @@ -1407,19 +1407,19 @@ void lcd_init() { #endif // SR_LCD_2W_NL #endif//!NEWPANEL - #if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) + #if ENABLED(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) pinMode(SDCARDDETECT, INPUT); WRITE(SDCARDDETECT, HIGH); lcd_oldcardstatus = IS_SD_INSERTED; #endif //(SDCARDDETECT > 0) - #ifdef LCD_HAS_SLOW_BUTTONS + #if ENABLED(LCD_HAS_SLOW_BUTTONS) slow_buttons = 0; #endif lcd_buttons_update(); - #ifdef ULTIPANEL + #if ENABLED(ULTIPANEL) encoderDiff = 0; #endif } @@ -1456,11 +1456,11 @@ int lcd_strlen_P(const char *s) { * Warning: This function is called from interrupt context! */ void lcd_update() { - #ifdef ULTIPANEL + #if ENABLED(ULTIPANEL) static millis_t return_to_status_ms = 0; #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 #endif @@ -1471,7 +1471,7 @@ void lcd_update() { lcdDrawUpdate = 2; lcd_oldcardstatus = IS_SD_INSERTED; 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 #endif ); @@ -1490,9 +1490,9 @@ void lcd_update() { millis_t ms = millis(); 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_DOWN) reprapworld_keypad_move_z_down(); if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left(); @@ -1507,7 +1507,7 @@ void lcd_update() { if (encoderPastThreshold) { int32_t encoderMultiplier = 1; - #ifdef ENCODER_RATE_MULTIPLIER + #if ENABLED(ENCODER_RATE_MULTIPLIER) if (encoderRateMultiplierEnabled) { 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; 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("Enc Step Rate: "); SERIAL_ECHO(encoderStepRate); @@ -1554,7 +1554,7 @@ void lcd_update() { 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) { blink++; // Variable for fan animation and alive dot u8g.firstPage(); @@ -1571,15 +1571,15 @@ void lcd_update() { (*currentMenu)(); #endif - #ifdef LCD_HAS_STATUS_INDICATORS + #if ENABLED(LCD_HAS_STATUS_INDICATORS) lcd_implementation_update_indicators(); #endif - #ifdef ULTIPANEL + #if ENABLED(ULTIPANEL) // Return to Status Screen after a timeout if (currentMenu != lcd_status_screen && - #ifdef MANUAL_BED_LEVELING + #if ENABLED(MANUAL_BED_LEVELING) currentMenu != _lcd_level_bed && currentMenu != _lcd_level_bed_homing && #endif @@ -1603,7 +1603,7 @@ void lcd_ignore_click(bool b) { } void lcd_finishstatus(bool persist=false) { - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) progress_bar_ms = millis(); #if PROGRESS_MSG_EXPIRE > 0 expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE; @@ -1611,12 +1611,12 @@ void lcd_finishstatus(bool persist=false) { #endif 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 #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; } #endif @@ -1650,21 +1650,21 @@ void lcd_setstatuspgm(const char* message, uint8_t level) { void lcd_setalertstatuspgm(const char* message) { lcd_setstatuspgm(message, 1); - #ifdef ULTIPANEL + #if ENABLED(ULTIPANEL) lcd_return_to_status(); #endif } 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) { lcd_contrast = value & 0x3F; u8g.setContrast(lcd_contrast); } #endif -#ifdef ULTIPANEL +#if ENABLED(ULTIPANEL) /** * 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! */ void lcd_buttons_update() { - #ifdef NEWPANEL + #if ENABLED(NEWPANEL) uint8_t newbutton = 0; if (READ(BTN_EN1) == 0) newbutton |= EN_A; 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; #endif buttons = newbutton; - #ifdef LCD_HAS_SLOW_BUTTONS + #if ENABLED(LCD_HAS_SLOW_BUTTONS) buttons |= slow_buttons; #endif - #ifdef REPRAPWORLD_KEYPAD + #if ENABLED(REPRAPWORLD_KEYPAD) // for the reprapworld_keypad uint8_t newbutton_reprapworld_keypad=0; WRITE(SHIFT_LD, LOW); @@ -1749,7 +1749,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; } } 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; #else return true; @@ -1993,7 +1993,7 @@ char *ftostr52(const float &x) { return conv; } -#ifdef MANUAL_BED_LEVELING +#if ENABLED(MANUAL_BED_LEVELING) static int _lcd_level_bed_position; diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 0eb94db4f2..94a54b8b54 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -4,7 +4,7 @@ #include "Marlin.h" #include "buzzer.h" -#ifdef ULTRA_LCD +#if ENABLED(ULTRA_LCD) int lcd_strlen(char *s); int lcd_strlen_P(const char *s); void lcd_update(); @@ -16,15 +16,15 @@ void lcd_reset_alert_level(); bool lcd_detected(void); - #ifdef LCD_USE_I2C_BUZZER + #if ENABLED(LCD_USE_I2C_BUZZER) void lcd_buzz(long duration, uint16_t freq); #endif - #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 + #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0 void dontExpireStatus(); #endif - #ifdef DOGLCD + #if ENABLED(DOGLCD) extern int lcd_contrast; void lcd_setcontrast(uint8_t value); #endif @@ -35,10 +35,10 @@ #define LCD_UPDATE_INTERVAL 100 #define LCD_TIMEOUT_TO_STATUS 15000 - #ifdef ULTIPANEL + #if ENABLED(ULTIPANEL) void lcd_buttons_update(); 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 #endif #else @@ -54,7 +54,7 @@ extern bool cancel_heatup; - #ifdef FILAMENT_LCD_DISPLAY + #if ENABLED(FILAMENT_LCD_DISPLAY) extern millis_t previous_lcd_status_ms; #endif 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); - #ifdef NEWPANEL + #if ENABLED(NEWPANEL) #define EN_C BIT(BLEN_C) #define EN_B BIT(BLEN_B) #define EN_A BIT(BLEN_A) #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_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2)) #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1)) diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index ab4fb101fc..f9c85a2a49 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -19,7 +19,7 @@ // macro name. The mapping is independent of whether the button is directly connected or // 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 #define BLEN_B 1 #define BLEN_A 0 @@ -36,7 +36,7 @@ // // 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) // 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 #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 #if BTN_ENC <= 0 #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) #endif -#elif defined(REPRAPWORLD_KEYPAD) +#elif ENABLED(REPRAPWORLD_KEYPAD) // define register bit values, don't change it #define BLEN_REPRAPWORLD_KEYPAD_F3 0 #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_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE) -#elif defined(NEWPANEL) +#elif ENABLED(NEWPANEL) #define LCD_CLICKED (buttons&EN_C) #else // old style ULTIPANEL @@ -127,7 +127,7 @@ //////////////////////////////////// // 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 #define LCD_I2C_PIN_BL 3 #define LCD_I2C_PIN_EN 2 @@ -144,7 +144,7 @@ #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); -#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()) #define LED_A 0x04 //100 #define LED_B 0x02 //010 @@ -155,30 +155,30 @@ #include #include #define LCD_CLASS LiquidTWI2 - #if defined(DETECT_DEVICE) + #if ENABLED(DETECT_DEVICE) LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); #else LCD_CLASS lcd(LCD_I2C_ADDRESS); #endif -#elif defined(LCD_I2C_TYPE_MCP23008) +#elif ENABLED(LCD_I2C_TYPE_MCP23008) #include #include #define LCD_CLASS LiquidTWI2 - #if defined(DETECT_DEVICE) + #if ENABLED(DETECT_DEVICE) LCD_CLASS lcd(LCD_I2C_ADDRESS, 1); #else LCD_CLASS lcd(LCD_I2C_ADDRESS); #endif -#elif defined(LCD_I2C_TYPE_PCA8574) +#elif ENABLED(LCD_I2C_TYPE_PCA8574) #include #define LCD_CLASS LiquidCrystal_I2C LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT); // 2 wire Non-latching LCD SR from: // 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); } #include #include @@ -193,7 +193,7 @@ #include "utf_mapper.h" -#ifdef LCD_PROGRESS_BAR +#if ENABLED(LCD_PROGRESS_BAR) static millis_t progress_bar_ms = 0; #if PROGRESS_MSG_EXPIRE > 0 static millis_t expire_status_ms = 0; @@ -202,7 +202,7 @@ #endif static void lcd_set_custom_characters( - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) bool progress_bar_set=true #endif ) { @@ -287,7 +287,7 @@ static void lcd_set_custom_characters( B00000 }; //thanks Sonny Mounicou - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) static bool char_mode = false; byte progress[3][8] = { { B00000, @@ -348,28 +348,28 @@ static void lcd_set_custom_characters( } static void lcd_implementation_init( - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) bool progress_bar_set=true #endif ) { - #if defined(LCD_I2C_TYPE_PCF8575) + #if ENABLED(LCD_I2C_TYPE_PCF8575) lcd.begin(LCD_WIDTH, LCD_HEIGHT); #ifdef LCD_I2C_PIN_BL lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE); lcd.setBacklight(HIGH); #endif - #elif defined(LCD_I2C_TYPE_MCP23017) + #elif ENABLED(LCD_I2C_TYPE_MCP23017) lcd.setMCPType(LTI_TYPE_MCP23017); lcd.begin(LCD_WIDTH, LCD_HEIGHT); 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.begin(LCD_WIDTH, LCD_HEIGHT); - #elif defined(LCD_I2C_TYPE_PCA8574) + #elif ENABLED(LCD_I2C_TYPE_PCA8574) lcd.init(); lcd.backlight(); @@ -378,7 +378,7 @@ static void lcd_implementation_init( #endif lcd_set_custom_characters( - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) progress_bar_set #endif ); @@ -499,7 +499,7 @@ static void lcd_implementation_status_screen() { #if LCD_WIDTH < 20 - #ifdef SDSUPPORT + #if ENABLED(SDSUPPORT) lcd.setCursor(0, 2); lcd_printPGM(PSTR("SD")); if (IS_SD_PRINTING) @@ -558,7 +558,7 @@ static void lcd_implementation_status_screen() { lcd.print(itostr3(feedrate_multiplier)); lcd.print('%'); - #if LCD_WIDTH > 19 && defined(SDSUPPORT) + #if LCD_WIDTH > 19 && ENABLED(SDSUPPORT) lcd.setCursor(7, 2); lcd_printPGM(PSTR("SD")); @@ -591,7 +591,7 @@ static void lcd_implementation_status_screen() { lcd.setCursor(0, LCD_HEIGHT - 1); - #ifdef LCD_PROGRESS_BAR + #if ENABLED(LCD_PROGRESS_BAR) if (card.isFileOpen()) { // Draw the progress bar if the message has shown long enough @@ -613,7 +613,7 @@ static void lcd_implementation_status_screen() { } } //card.isFileOpen - #elif defined(FILAMENT_LCD_DISPLAY) + #elif ENABLED(FILAMENT_LCD_DISPLAY) // Show Filament Diameter and Volumetric Multiplier % // 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_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() { - #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 static uint8_t ledsprev = 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 -#ifdef LCD_HAS_SLOW_BUTTONS +#if ENABLED(LCD_HAS_SLOW_BUTTONS) extern millis_t next_button_update_ms; static uint8_t lcd_implementation_read_slow_buttons() { - #ifdef LCD_I2C_TYPE_MCP23017 + #if ENABLED(LCD_I2C_TYPE_MCP23017) uint8_t slow_buttons; // Reading these buttons this is likely to be too slow to call inside interrupt context // so they are called during normal lcd_update 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 slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated #endif