From 46453905d63638e6082dcc32a48714a5c258002a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 3 Aug 2015 12:30:37 -0700 Subject: [PATCH 1/4] Apply remaining ENABLED/DISABLED conditionals --- Marlin/Conditionals.h | 2 +- Marlin/M100_Free_Mem_Chk.cpp | 6 ++-- Marlin/Marlin_main.cpp | 14 +++++----- Marlin/buzzer.cpp | 2 +- Marlin/dogm_lcd_implementation.h | 6 ++-- .../Felix/Configuration.h | 2 +- .../Felix/Configuration_DUAL.h | 4 +-- .../Hephestos/Configuration.h | 2 +- .../K8200/Configuration.h | 2 +- .../RepRapWorld/Megatronics/Configuration.h | 2 +- .../SCARA/Configuration.h | 2 +- .../WITBOX/Configuration.h | 2 +- .../adafruit/ST7565/Configuration.h | 2 +- .../delta/biv2.5/Configuration.h | 2 +- .../delta/generic/Configuration.h | 2 +- .../delta/kossel_mini/Configuration.h | 2 +- .../delta/kossel_pro/Configuration.h | 2 +- .../makibox/Configuration.h | 2 +- .../tvrrug/Round2/Configuration.h | 2 +- Marlin/pins_MEGACONTROLLER.h | 2 +- Marlin/pins_MEGATRONICS.h | 2 +- Marlin/pins_PRINTRBOARD.h | 2 +- Marlin/pins_RAMPS_13.h | 2 +- Marlin/pins_RIGIDBOARD.h | 8 +++--- Marlin/planner.cpp | 12 ++++---- Marlin/servo.cpp | 2 +- Marlin/stepper.cpp | 28 +++++++++---------- Marlin/ultralcd.cpp | 2 +- .../ultralcd_implementation_hitachi_HD44780.h | 2 +- 29 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index f3896d1f6c..8ea88b6e07 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -75,7 +75,7 @@ #define NEWPANEL #endif - #ifdef MINIPANEL + #if ENABLED(MINIPANEL) #define DOGLCD #define SDSUPPORT #define ULTIPANEL diff --git a/Marlin/M100_Free_Mem_Chk.cpp b/Marlin/M100_Free_Mem_Chk.cpp index 4ce8717d37..21f2b43caf 100644 --- a/Marlin/M100_Free_Mem_Chk.cpp +++ b/Marlin/M100_Free_Mem_Chk.cpp @@ -23,7 +23,7 @@ #include "Marlin.h" -#ifdef M100_FREE_MEMORY_WATCHER +#if ENABLED(M100_FREE_MEMORY_WATCHER) extern void *__brkval; extern size_t __heap_start, __heap_end, __flp; @@ -73,7 +73,7 @@ int i, j, n; // the right hand column to help spotting them. // -#ifdef M100_FREE_MEMORY_DUMPER // Comment out to remove Dump sub-command +#if ENABLED(M100_FREE_MEMORY_DUMPER) // Disable to remove Dump sub-command if ( code_seen('D') ) { ptr = (unsigned char *) __brkval; @@ -163,7 +163,7 @@ int i, j, n; // M100 C x Corrupts x locations in the free memory pool and reports the locations of the corruption. // This is useful to check the correctness of the M100 D and the M100 F commands. // -#ifdef M100_FREE_MEMORY_CORRUPTOR +#if ENABLED(M100_FREE_MEMORY_CORRUPTOR) if ( code_seen('C') ) { int x; // x gets the # of locations to corrupt within the memory pool x = code_value(); diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index e702b84bad..8f1239eb48 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4900,7 +4900,7 @@ inline void gcode_M503() { LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE); millis_t next_tick = 0; while (!lcd_clicked()) { - #ifndef AUTO_FILAMENT_CHANGE + #if DISABLED(AUTO_FILAMENT_CHANGE) millis_t ms = millis(); if (ms >= next_tick) { lcd_quick_feedback(); @@ -4918,7 +4918,7 @@ inline void gcode_M503() { } // while(!lcd_clicked) lcd_quick_feedback(); // click sound feedback - #ifdef AUTO_FILAMENT_CHANGE + #if ENABLED(AUTO_FILAMENT_CHANGE) current_position[E_AXIS] = 0; st_synchronize(); #endif @@ -5377,7 +5377,7 @@ void process_next_command() { break; #endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST - #ifdef M100_FREE_MEMORY_WATCHER + #if ENABLED(M100_FREE_MEMORY_WATCHER) case 100: gcode_M100(); break; @@ -6228,9 +6228,9 @@ void plan_arc( clamp_to_software_endstops(arc_target); - #if defined(DELTA) || defined(SCARA) + #if ENABLED(DELTA) || ENABLED(SCARA) calculate_delta(arc_target); - #ifdef ENABLE_AUTO_BED_LEVELING + #if ENABLED(ENABLE_AUTO_BED_LEVELING) adjust_delta(arc_target); #endif plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder); @@ -6240,9 +6240,9 @@ void plan_arc( } // Ensure last segment arrives at target location. - #if defined(DELTA) || defined(SCARA) + #if ENABLED(DELTA) || ENABLED(SCARA) calculate_delta(target); - #ifdef ENABLE_AUTO_BED_LEVELING + #if ENABLED(ENABLE_AUTO_BED_LEVELING) adjust_delta(target); #endif plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder); diff --git a/Marlin/buzzer.cpp b/Marlin/buzzer.cpp index a419cffbb7..fb914c5b04 100644 --- a/Marlin/buzzer.cpp +++ b/Marlin/buzzer.cpp @@ -9,7 +9,7 @@ lcd_buzz(duration, freq); #elif PIN_EXISTS(BEEPER) // on-board buzzers have no further condition SET_OUTPUT(BEEPER_PIN); - #ifdef SPEAKER // a speaker needs a AC ore a pulsed DC + #if ENABLED(SPEAKER) // a speaker needs a AC ore a pulsed DC //tone(BEEPER_PIN, freq, duration); // needs a PWMable pin unsigned int delay = 1000000 / freq / 2; int i = duration * freq / 1000; diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index daf2c0d689..5e0b270d9c 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -125,10 +125,10 @@ #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 +#elif ENABLED(U8GLIB_SSD1306) // Generic support for SSD1306 OLED I2C LCDs U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); -#elif defined(MINIPANEL) +#elif ENABLED(MINIPANEL) // The MINIPanel display U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0); #else @@ -206,7 +206,7 @@ static void lcd_implementation_init() { pinMode(LCD_PIN_RESET, OUTPUT); digitalWrite(LCD_PIN_RESET, HIGH); #endif - #ifndef MINIPANEL//setContrast not working for Mini Panel + #if DISABLED(MINIPANEL) // setContrast not working for Mini Panel u8g.setContrast(lcd_contrast); #endif // FIXME: remove this workaround diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index eed4b979cc..0ffcc9c1a9 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -301,7 +301,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 3a6ae8d721..1f59243194 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -286,7 +286,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX @@ -727,7 +727,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic // With this option servos are powered only during movement, then turned off to prevent jitter. //#define DEACTIVATE_SERVOS_AFTER_MOVE -#ifdef DEACTIVATE_SERVOS_AFTER_MOVE +#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) // Delay (in microseconds) before turning the servo off. This depends on the servo speed. // 300ms is a good value but you can try less delay. // If the servo can't reach the requested position, increase it. diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index b6fc265656..d053b1b0be 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -311,7 +311,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index f0a766f27c..2a3a062cfa 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -307,7 +307,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index 6c80e9fb21..45b73393a1 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -319,7 +319,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index ce57bd9877..458e24cc8f 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -327,7 +327,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings //#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 718c1518d1..b191e0eca7 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -311,7 +311,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 31b8ec589d..bc8d66f4a1 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -319,7 +319,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index 8a9d9395b9..124b3a56ce 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -354,7 +354,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 6564673aa1..01739f5e15 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -354,7 +354,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 04a1e46840..90d9c18e8c 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -354,7 +354,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index d4fbcb326d..2b6f429603 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -341,7 +341,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 2fd0783673..411f344be3 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -322,7 +322,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 2067a215ab..eba86a7a50 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -309,7 +309,7 @@ Here are some standard links for getting your machine calibrated: // coarse Endstop Settings #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors -#ifndef ENDSTOPPULLUPS +#if DISABLED(ENDSTOPPULLUPS) // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined // #define ENDSTOPPULLUP_XMAX // #define ENDSTOPPULLUP_YMAX diff --git a/Marlin/pins_MEGACONTROLLER.h b/Marlin/pins_MEGACONTROLLER.h index d12fcb218e..c472a9d384 100644 --- a/Marlin/pins_MEGACONTROLLER.h +++ b/Marlin/pins_MEGACONTROLLER.h @@ -80,7 +80,7 @@ #define TEMP_BED_PIN 1 // ANALOG NUMBERING #endif -#ifdef MINIPANEL +#if ENABLED(MINIPANEL) #define BEEPER_PIN 46 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 47 diff --git a/Marlin/pins_MEGATRONICS.h b/Marlin/pins_MEGATRONICS.h index 31812a773a..134c888834 100644 --- a/Marlin/pins_MEGATRONICS.h +++ b/Marlin/pins_MEGATRONICS.h @@ -60,7 +60,7 @@ #define BEEPER_PIN 33 // AUX-4 -#if defined(ULTRA_LCD) && defined(NEWPANEL) +#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 diff --git a/Marlin/pins_PRINTRBOARD.h b/Marlin/pins_PRINTRBOARD.h index f6eff9c9b5..4dbb104a71 100644 --- a/Marlin/pins_PRINTRBOARD.h +++ b/Marlin/pins_PRINTRBOARD.h @@ -45,7 +45,7 @@ #endif #define X_STOP_PIN 35 -#ifdef SDSUPPORT +#if ENABLED(SDSUPPORT) #define Y_STOP_PIN 37 // Move Ystop to Estop socket #else #define Y_STOP_PIN 8 // Ystop in Ystop socket diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index 625341c268..f0cbe29c39 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -182,7 +182,7 @@ #define DOGLCD_CS 29 #define DOGLCD_A0 27 #define LCD_PIN_BL 33 - #elif defined(MINIPANEL) + #elif ENABLED(MINIPANEL) #define BEEPER_PIN 42 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 44 diff --git a/Marlin/pins_RIGIDBOARD.h b/Marlin/pins_RIGIDBOARD.h index 881b0ad37b..e1b3a32d8f 100644 --- a/Marlin/pins_RIGIDBOARD.h +++ b/Marlin/pins_RIGIDBOARD.h @@ -46,7 +46,7 @@ #undef SD_DETECT_PIN #define SD_DETECT_PIN 22 -#elif defined(REPRAP_DISCOUNT_SMART_CONTROLLER) +#elif ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) #undef BEEPER_PIN #define BEEPER_PIN -1 @@ -61,10 +61,10 @@ // SPI for Max6675 Thermocouple #undef MAX6675_SS -#ifndef SDSUPPORT - #define MAX6675_SS 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card -#else +#if ENABLED(SDSUPPORT) #define MAX6675_SS 49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present +#else + #define MAX6675_SS 53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card #endif // RigidBot swaps E0 / E1 plugs vs RAMPS 1.3 diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index b1c7a46e25..caa9228ed6 100644 --- a/Marlin/planner.cpp +++ b/Marlin/planner.cpp @@ -542,7 +542,7 @@ float junction_deviation = 0.1; block->steps[A_AXIS] = labs(dx + dy); block->steps[B_AXIS] = labs(dx - dy); block->steps[Z_AXIS] = labs(dz); - #elif defined(COREXZ) + #elif ENABLED(COREXZ) // corexz planning block->steps[A_AXIS] = labs(dx + dz); block->steps[Y_AXIS] = labs(dy); @@ -577,7 +577,7 @@ float junction_deviation = 0.1; if (dz < 0) db |= BIT(Z_AXIS); if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction - #elif defined(COREXZ) + #elif ENABLED(COREXZ) if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis if (dy < 0) db |= BIT(Y_AXIS); if (dz < 0) db |= BIT(Z_HEAD); // ...and Z @@ -599,10 +599,10 @@ float junction_deviation = 0.1; enable_x(); enable_y(); } - #ifndef Z_LATE_ENABLE + #if DISABLED(Z_LATE_ENABLE) if (block->steps[Z_AXIS]) enable_z(); #endif - #elif defined(COREXZ) + #elif ENABLED(COREXZ) if (block->steps[A_AXIS] || block->steps[C_AXIS]) { enable_x(); enable_z(); @@ -611,7 +611,7 @@ float junction_deviation = 0.1; #else if (block->steps[X_AXIS]) enable_x(); if (block->steps[Y_AXIS]) enable_y(); - #ifndef Z_LATE_ENABLE + #if DISABLED(Z_LATE_ENABLE) if (block->steps[Z_AXIS]) enable_z(); #endif #endif @@ -700,7 +700,7 @@ float junction_deviation = 0.1; delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS]; delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS]; delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS]; - #elif defined(COREXZ) + #elif ENABLED(COREXZ) float delta_mm[6]; delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS]; delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS]; diff --git a/Marlin/servo.cpp b/Marlin/servo.cpp index f259891d2d..ff2e46f759 100644 --- a/Marlin/servo.cpp +++ b/Marlin/servo.cpp @@ -307,7 +307,7 @@ bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; } void Servo::move(int value) { if (this->attach(0) >= 0) { this->write(value); - #ifdef DEACTIVATE_SERVOS_AFTER_MOVE + #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE) delay(SERVO_DEACTIVATION_DELAY); this->detach(); #endif diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 80f1bb272f..3bf61315d8 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -289,7 +289,7 @@ void enable_endstops(bool check) { check_endstops = check; } // Check endstops inline void update_endstops() { - #ifdef Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) uint16_t #else byte @@ -317,12 +317,12 @@ inline void update_endstops() { step_events_completed = current_block->step_event_count; \ } - #ifdef COREXY + #if ENABLED(COREXY) // Head direction in -X axis for CoreXY bots. // If DeltaX == -DeltaY, the movement is only in Y axis if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) { if (TEST(out_bits, X_HEAD)) - #elif defined(COREXZ) + #elif ENABLED(COREXZ) // Head direction in -X axis for CoreXZ bots. // If DeltaX == -DeltaZ, the movement is only in Z axis if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, C_AXIS))) { @@ -331,7 +331,7 @@ inline void update_endstops() { if (TEST(out_bits, X_AXIS)) // stepping along -X axis (regular Cartesian bot) #endif { // -direction - #ifdef DUAL_X_CARRIAGE + #if ENABLED(DUAL_X_CARRIAGE) // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1)) #endif @@ -342,7 +342,7 @@ inline void update_endstops() { } } else { // +direction - #ifdef DUAL_X_CARRIAGE + #if ENABLED(DUAL_X_CARRIAGE) // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1)) #endif @@ -352,11 +352,11 @@ inline void update_endstops() { #endif } } - #if defined(COREXY) || defined(COREXZ) + #if ENABLED(COREXY) || ENABLED(COREXZ) } #endif - #ifdef COREXY + #if ENABLED(COREXY) // Head direction in -Y axis for CoreXY bots. // If DeltaX == DeltaY, the movement is only in X axis if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) { @@ -374,11 +374,11 @@ inline void update_endstops() { UPDATE_ENDSTOP(Y, MAX); #endif } - #if defined(COREXY) + #if ENABLED(COREXY) } #endif - #ifdef COREXZ + #if ENABLED(COREXZ) // Head direction in -Z axis for CoreXZ bots. // If DeltaX == DeltaZ, the movement is only in X axis if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) { @@ -389,7 +389,7 @@ inline void update_endstops() { { // z -direction #if HAS_Z_MIN - #ifdef Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) SET_ENDSTOP_BIT(Z, MIN); #if HAS_Z2_MIN SET_ENDSTOP_BIT(Z2, MIN); @@ -411,7 +411,7 @@ inline void update_endstops() { #endif // !Z_DUAL_ENDSTOPS #endif // Z_MIN_PIN - #ifdef Z_PROBE_ENDSTOP + #if ENABLED(Z_PROBE_ENDSTOP) UPDATE_ENDSTOP(Z, PROBE); if (TEST_ENDSTOP(Z_PROBE)) @@ -424,7 +424,7 @@ inline void update_endstops() { else { // z +direction #if HAS_Z_MAX - #ifdef Z_DUAL_ENDSTOPS + #if ENABLED(Z_DUAL_ENDSTOPS) SET_ENDSTOP_BIT(Z, MAX); #if HAS_Z2_MAX @@ -449,7 +449,7 @@ inline void update_endstops() { #endif // !Z_DUAL_ENDSTOPS #endif // Z_MAX_PIN - #ifdef Z_PROBE_ENDSTOP + #if ENABLED(Z_PROBE_ENDSTOP) UPDATE_ENDSTOP(Z, PROBE); if (TEST_ENDSTOP(Z_PROBE)) @@ -459,7 +459,7 @@ inline void update_endstops() { } #endif } - #if defined(COREXZ) + #if ENABLED(COREXZ) } #endif old_endstop_bits = current_endstop_bits; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index e4c10ccfd8..12910085a4 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -275,7 +275,7 @@ static void lcd_status_screen() { #if ENABLED(LCD_PROGRESS_BAR) millis_t ms = millis(); - #ifndef PROGRESS_MSG_ONCE + #if DISABLED(PROGRESS_MSG_ONCE) if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) { progress_bar_ms = ms; } diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index eab93b4ce0..5b3f4307cf 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -6,7 +6,7 @@ * When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters. **/ -//#ifndef REPRAPWORLD_KEYPAD +//#if DISABLED(REPRAPWORLD_KEYPAD) // extern volatile uint8_t buttons; //the last checked buttons in a bit array. //#else extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array. From c30b7693e0d3de566289c3aa6c83cc9b8b7f3ac9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 3 Aug 2015 12:31:02 -0700 Subject: [PATCH 2/4] Clean up RUMBA pins conditions --- Marlin/pins_RUMBA.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Marlin/pins_RUMBA.h b/Marlin/pins_RUMBA.h index 3b6c7adf60..f21f219173 100644 --- a/Marlin/pins_RUMBA.h +++ b/Marlin/pins_RUMBA.h @@ -48,36 +48,36 @@ #define PS_ON_PIN 45 #define KILL_PIN 46 -#if (TEMP_SENSOR_0==0) +#if TEMP_SENSOR_0 == 0 #define TEMP_0_PIN -1 #define HEATER_0_PIN -1 #else #define HEATER_0_PIN 2 // EXTRUDER 1 - #if (TEMP_SENSOR_0==-1) + #if TEMP_SENSOR_0 == -1 #define TEMP_0_PIN 6 // ANALOG NUMBERING - connector *K1* on RUMBA thermocouple ADD ON is used #else #define TEMP_0_PIN 15 // ANALOG NUMBERING - default connector for thermistor *T0* on rumba board is used #endif #endif -#if (TEMP_SENSOR_1==0) +#if TEMP_SENSOR_1 == 0 #define TEMP_1_PIN -1 #define HEATER_1_PIN -1 #else #define HEATER_1_PIN 3 // EXTRUDER 2 - #if (TEMP_SENSOR_1==-1) + #if TEMP_SENSOR_1 == -1 #define TEMP_1_PIN 5 // ANALOG NUMBERING - connector *K2* on RUMBA thermocouple ADD ON is used #else #define TEMP_1_PIN 14 // ANALOG NUMBERING - default connector for thermistor *T1* on rumba board is used #endif #endif -#if (TEMP_SENSOR_2==0) +#if TEMP_SENSOR_2 == 0 #define TEMP_2_PIN -1 #define HEATER_2_PIN -1 #else #define HEATER_2_PIN 6 // EXTRUDER 3 - #if (TEMP_SENSOR_2==-1) + #if TEMP_SENSOR_2 == -1 #define TEMP_2_PIN 7 // ANALOG NUMBERING - connector *K3* on RUMBA thermocouple ADD ON is used <-- this can not be used when TEMP_SENSOR_BED is defined as thermocouple #else #define TEMP_2_PIN 13 // ANALOG NUMBERING - default connector for thermistor *T2* on rumba board is used @@ -87,12 +87,12 @@ //optional for extruder 4 or chamber: #define TEMP_X_PIN 12 // ANALOG NUMBERING - default connector for thermistor *T3* on rumba board is used //optional FAN1 can be used as 4th heater output: #define HEATER_3_PIN 8 // EXTRUDER 4 -#if (TEMP_SENSOR_BED==0) +#if TEMP_SENSOR_BED == 0 #define TEMP_BED_PIN -1 #define HEATER_BED_PIN -1 #else #define HEATER_BED_PIN 9 // BED - #if (TEMP_SENSOR_BED==-1) + #if TEMP_SENSOR_BED == -1 #define TEMP_BED_PIN 7 // ANALOG NUMBERING - connector *K3* on RUMBA thermocouple ADD ON is used <-- this can not be used when TEMP_SENSOR_2 is defined as thermocouple #else #define TEMP_BED_PIN 11 // ANALOG NUMBERING - default connector for thermistor *THB* on rumba board is used From edeb58288e4a0b0d0bb2b69bf02b6b27f98eff01 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 3 Aug 2015 12:31:17 -0700 Subject: [PATCH 3/4] Use PIN_EXISTS in sanity check --- Marlin/SanityCheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 14368839a4..78aac3cae7 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -146,7 +146,7 @@ * Require a Z Probe Pin if Z_PROBE_ENDSTOP is enabled. */ #if ENABLED(Z_PROBE_ENDSTOP) - #ifndef Z_PROBE_PIN + #if !PIN_EXISTS(Z_PROBE) #error You must have a Z_PROBE_PIN defined in your pins_XXXX.h file if you enable Z_PROBE_ENDSTOP. #endif #if Z_PROBE_PIN == -1 From 6af75f4b5dd4b117b8ce6e324e45c3c2e33726ff Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 3 Aug 2015 12:32:15 -0700 Subject: [PATCH 4/4] Squish down deprecated tests in sanity check --- Marlin/SanityCheck.h | 58 ++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/Marlin/SanityCheck.h b/Marlin/SanityCheck.h index 78aac3cae7..a3ee86d0f6 100644 --- a/Marlin/SanityCheck.h +++ b/Marlin/SanityCheck.h @@ -338,51 +338,29 @@ /** * Warnings for old configurations */ - #ifdef X_HOME_RETRACT_MM - #error [XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM. - #endif - #if WATCH_TEMP_PERIOD > 500 #error WATCH_TEMP_PERIOD now uses seconds instead of milliseconds. - #endif - - #if DISABLED(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD)) - #error Thermal Runaway Protection for hotends must now be enabled with THERMAL_PROTECTION_HOTENDS. - #endif - - #if DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD) - #error Thermal Runaway Protection for the bed must now be enabled with THERMAL_PROTECTION_BED. - #endif - - #ifdef PROBE_SERVO_DEACTIVATION_DELAY - #error PROBE_SERVO_DEACTIVATION_DELAY has been replaced with DEACTIVATE_SERVOS_AFTER_MOVE and SERVO_DEACTIVATION_DELAY. - #endif - - #if defined(COREXZ) && defined(Z_LATE_ENABLE) + #elif DISABLED(THERMAL_PROTECTION_HOTENDS) && (defined(WATCH_TEMP_PERIOD) || defined(THERMAL_PROTECTION_PERIOD)) + #error Thermal Runaway Protection for hotends is now enabled with THERMAL_PROTECTION_HOTENDS. + #elif DISABLED(THERMAL_PROTECTION_BED) && defined(THERMAL_PROTECTION_BED_PERIOD) + #error Thermal Runaway Protection for the bed is now enabled with THERMAL_PROTECTION_BED. + #elif ENABLED(COREXZ) && ENABLED(Z_LATE_ENABLE) #error "Z_LATE_ENABLE can't be used with COREXZ." - #endif - - #ifdef BEEPER - #error BEEPER has been replaced with BEEPER_PIN. Please update your pins definitions. - #endif - - #ifdef SDCARDDETECT + #elif defined(X_HOME_RETRACT_MM) + #error [XYZ]_HOME_RETRACT_MM settings have been renamed [XYZ]_HOME_BUMP_MM. + #elif defined(PROBE_SERVO_DEACTIVATION_DELAY) + #error PROBE_SERVO_DEACTIVATION_DELAY has been replaced with DEACTIVATE_SERVOS_AFTER_MOVE and SERVO_DEACTIVATION_DELAY. + #elif defined(BEEPER) + #error BEEPER is now BEEPER_PIN. Please update your pins definitions. + #elif defined(SDCARDDETECT) #error SDCARDDETECT is now SD_DETECT_PIN. Please update your pins definitions. - #endif - - #ifdef SDCARDDETECTINVERTED + #elif defined(SDCARDDETECTINVERTED) #error SDCARDDETECTINVERTED is now SD_DETECT_INVERTED. Please update your configuration. - #endif - - #ifdef BTENABLED - #error BTENABLED has been replaced with BLUETOOTH. Please update your configuration. - #endif - - #ifdef CUSTOM_MENDEL_NAME - #error CUSTOM_MENDEL_NAME deprecated - use CUSTOM_MACHINE_NAME instead - #endif - - #ifdef HAS_AUTOMATIC_VERSIONING + #elif defined(BTENABLED) + #error BTENABLED is now BLUETOOTH. Please update your configuration. + #elif defined(CUSTOM_MENDEL_NAME) + #error CUSTOM_MENDEL_NAME is now CUSTOM_MACHINE_NAME. Please update your configuration. + #elif defined(HAS_AUTOMATIC_VERSIONING) #error HAS_AUTOMATIC_VERSIONING deprecated - use USE_AUTOMATIC_VERSIONING instead #endif