Remove invariant code from Configurations
- Add `Conditionals.h` with calculated configuration values - Add `SanityCheck.h` with checks for configuration errors - Remove equivalent code from all configurations - Move error checks from some sources to `SanityCheck.h` also - Fix initialization of count_direction in stepper.cpp
This commit is contained in:
		| @@ -99,56 +99,6 @@ | ||||
|  | ||||
| #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing | ||||
|  | ||||
|  | ||||
| // @section hidden | ||||
|  | ||||
|  | ||||
| //// AUTOSET LOCATIONS OF LIMIT SWITCHES | ||||
| //// Added by ZetaPhoenix 09-15-2012 | ||||
| #ifdef MANUAL_HOME_POSITIONS  // Use manual limit switch locations | ||||
|   #define X_HOME_POS MANUAL_X_HOME_POS | ||||
|   #define Y_HOME_POS MANUAL_Y_HOME_POS | ||||
|   #define Z_HOME_POS MANUAL_Z_HOME_POS | ||||
| #else //Set min/max homing switch positions based upon homing direction and min/max travel limits | ||||
|   //X axis | ||||
|   #if X_HOME_DIR == -1 | ||||
|     #ifdef BED_CENTER_AT_0_0 | ||||
|       #define X_HOME_POS X_MAX_LENGTH * -0.5 | ||||
|     #else | ||||
|       #define X_HOME_POS X_MIN_POS | ||||
|     #endif //BED_CENTER_AT_0_0 | ||||
|   #else | ||||
|     #ifdef BED_CENTER_AT_0_0 | ||||
|       #define X_HOME_POS X_MAX_LENGTH * 0.5 | ||||
|     #else | ||||
|       #define X_HOME_POS X_MAX_POS | ||||
|     #endif //BED_CENTER_AT_0_0 | ||||
|   #endif //X_HOME_DIR == -1 | ||||
|  | ||||
|   //Y axis | ||||
|   #if Y_HOME_DIR == -1 | ||||
|     #ifdef BED_CENTER_AT_0_0 | ||||
|       #define Y_HOME_POS Y_MAX_LENGTH * -0.5 | ||||
|     #else | ||||
|       #define Y_HOME_POS Y_MIN_POS | ||||
|     #endif //BED_CENTER_AT_0_0 | ||||
|   #else | ||||
|     #ifdef BED_CENTER_AT_0_0 | ||||
|       #define Y_HOME_POS Y_MAX_LENGTH * 0.5 | ||||
|     #else | ||||
|       #define Y_HOME_POS Y_MAX_POS | ||||
|     #endif //BED_CENTER_AT_0_0 | ||||
|   #endif //Y_HOME_DIR == -1 | ||||
|  | ||||
|   // Z axis | ||||
|   #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used | ||||
|     #define Z_HOME_POS Z_MIN_POS | ||||
|   #else | ||||
|     #define Z_HOME_POS Z_MAX_POS | ||||
|   #endif //Z_HOME_DIR == -1 | ||||
| #endif //End auto min/max positions | ||||
| //END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP | ||||
|  | ||||
| // @section extras | ||||
|  | ||||
| //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats. | ||||
| @@ -160,26 +110,12 @@ | ||||
| // On a RAMPS (or other 5 driver) motherboard, using this feature will limit you to using 1 extruder. | ||||
| //#define Z_DUAL_STEPPER_DRIVERS | ||||
|  | ||||
| #ifdef Z_DUAL_STEPPER_DRIVERS | ||||
|   #undef EXTRUDERS | ||||
|   #define EXTRUDERS 1 | ||||
| #endif | ||||
|  | ||||
| // Same again but for Y Axis. | ||||
| //#define Y_DUAL_STEPPER_DRIVERS | ||||
|  | ||||
| // Define if the two Y drives need to rotate in opposite directions | ||||
| #define INVERT_Y2_VS_Y_DIR true | ||||
|  | ||||
| #ifdef Y_DUAL_STEPPER_DRIVERS | ||||
|   #undef EXTRUDERS | ||||
|   #define EXTRUDERS 1 | ||||
| #endif | ||||
|  | ||||
| #if defined (Z_DUAL_STEPPER_DRIVERS) && defined (Y_DUAL_STEPPER_DRIVERS) | ||||
|   #error "You cannot have dual drivers for both Y and Z" | ||||
| #endif | ||||
|  | ||||
| // Enable this for dual x-carriage printers. | ||||
| // A dual x-carriage design has the advantage that the inactive extruder can be parked which | ||||
| // prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage | ||||
| @@ -236,14 +172,6 @@ | ||||
|  | ||||
| #define AXIS_RELATIVE_MODES {false, false, false, false} | ||||
|  | ||||
| // @section hidden | ||||
|  | ||||
| #ifdef CONFIG_STEPPERS_TOSHIBA | ||||
|   #define MAX_STEP_FREQUENCY 10000 // Max step frequency for Toshiba Stepper Controllers | ||||
| #else | ||||
|   #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step) | ||||
| #endif | ||||
|  | ||||
| // @section machine | ||||
|  | ||||
| //By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step. | ||||
| @@ -262,12 +190,12 @@ | ||||
|  | ||||
| // Feedrates for manual moves along X, Y, Z, E from panel | ||||
| #ifdef ULTIPANEL | ||||
| #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min) | ||||
|   #define MANUAL_FEEDRATE {50*60, 50*60, 4*60, 60}  // set the speeds for manual moves (mm/min) | ||||
| #endif | ||||
|  | ||||
| //Comment to disable setting feedrate multiplier via encoder | ||||
| #ifdef ULTIPANEL | ||||
|     #define ULTIPANEL_FEEDMULTIPLY | ||||
|   #define ULTIPANEL_FEEDMULTIPLY | ||||
| #endif | ||||
|  | ||||
| // @section extras | ||||
| @@ -288,13 +216,6 @@ | ||||
| // if unwanted behavior is observed on a user's machine when running at very slow speeds. | ||||
| #define MINIMUM_PLANNER_SPEED 0.05// (mm/sec) | ||||
|  | ||||
| // MS1 MS2 Stepper Driver Microstepping mode table | ||||
| #define MICROSTEP1 LOW,LOW | ||||
| #define MICROSTEP2 HIGH,LOW | ||||
| #define MICROSTEP4 LOW,HIGH | ||||
| #define MICROSTEP8 HIGH,HIGH | ||||
| #define MICROSTEP16 HIGH,HIGH | ||||
|  | ||||
| // Microstep setting (Only functional when stepper driver microstep pins are connected to MCU. | ||||
| #define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16] | ||||
|  | ||||
| @@ -342,12 +263,6 @@ | ||||
|   #define PROGRESS_MSG_EXPIRE   0 | ||||
|   // Enable this to show messages for MSG_TIME then hide them | ||||
|   //#define PROGRESS_MSG_ONCE | ||||
|   #ifdef DOGLCD | ||||
|     #warning LCD_PROGRESS_BAR does not apply to graphical displays at this time. | ||||
|   #endif | ||||
|   #ifdef FILAMENT_LCD_DISPLAY | ||||
|     #error LCD_PROGRESS_BAR and FILAMENT_LCD_DISPLAY are not fully compatible. Comment out this line to use both. | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| // @section more | ||||
| @@ -373,16 +288,6 @@ | ||||
|   #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions | ||||
|   #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z | ||||
|   #define BABYSTEP_Z_MULTIPLICATOR 2 //faster z movements | ||||
|  | ||||
|   #ifdef COREXY | ||||
|     #error BABYSTEPPING not implemented for COREXY yet. | ||||
|   #endif | ||||
|  | ||||
|   #ifdef DELTA | ||||
|     #ifdef BABYSTEP_XY | ||||
|       #error BABYSTEPPING only implemented for Z axis on deltabots. | ||||
|     #endif | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| // extruder advance constant (s2/mm3) | ||||
| @@ -418,28 +323,6 @@ const unsigned int dropsegments=5; //everything with less than this number of st | ||||
| // be commented out otherwise | ||||
| #define SDCARDDETECTINVERTED | ||||
|  | ||||
| // @section hidden | ||||
|  | ||||
| #ifdef ULTIPANEL | ||||
|  #undef SDCARDDETECTINVERTED | ||||
| #endif | ||||
|  | ||||
| // Power Signal Control Definitions | ||||
| // By default use ATX definition | ||||
| #ifndef POWER_SUPPLY | ||||
|   #define POWER_SUPPLY 1 | ||||
| #endif | ||||
| // 1 = ATX | ||||
| #if (POWER_SUPPLY == 1) | ||||
|   #define PS_ON_AWAKE  LOW | ||||
|   #define PS_ON_ASLEEP HIGH | ||||
| #endif | ||||
| // 2 = X-Box 360 203W | ||||
| #if (POWER_SUPPLY == 2) | ||||
|   #define PS_ON_AWAKE  HIGH | ||||
|   #define PS_ON_ASLEEP LOW | ||||
| #endif | ||||
|  | ||||
| // @section temperature | ||||
|  | ||||
| // Control heater 0 and heater 1 in parallel. | ||||
| @@ -497,88 +380,4 @@ const unsigned int dropsegments=5; //everything with less than this number of st | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| #ifdef FILAMENTCHANGEENABLE | ||||
|   #ifdef EXTRUDER_RUNOUT_PREVENT | ||||
|     #error EXTRUDER_RUNOUT_PREVENT currently incompatible with FILAMENTCHANGE | ||||
|   #endif | ||||
| #endif | ||||
|  | ||||
| //=========================================================================== | ||||
| //=============================  Define Defines  ============================ | ||||
| //=========================================================================== | ||||
|  | ||||
| // @section hidden | ||||
|  | ||||
| #if defined (ENABLE_AUTO_BED_LEVELING) && defined (DELTA) | ||||
|   #error "Bed Auto Leveling is still not compatible with Delta Kinematics." | ||||
| #endif | ||||
|  | ||||
| #if EXTRUDERS > 1 && defined TEMP_SENSOR_1_AS_REDUNDANT | ||||
|   #error "You cannot use TEMP_SENSOR_1_AS_REDUNDANT if EXTRUDERS > 1" | ||||
| #endif | ||||
|  | ||||
| #if EXTRUDERS > 1 && defined HEATERS_PARALLEL | ||||
|   #error "You cannot use HEATERS_PARALLEL if EXTRUDERS > 1" | ||||
| #endif | ||||
|  | ||||
| #if TEMP_SENSOR_0 > 0 | ||||
|   #define THERMISTORHEATER_0 TEMP_SENSOR_0 | ||||
|   #define HEATER_0_USES_THERMISTOR | ||||
| #endif | ||||
| #if TEMP_SENSOR_1 > 0 | ||||
|   #define THERMISTORHEATER_1 TEMP_SENSOR_1 | ||||
|   #define HEATER_1_USES_THERMISTOR | ||||
| #endif | ||||
| #if TEMP_SENSOR_2 > 0 | ||||
|   #define THERMISTORHEATER_2 TEMP_SENSOR_2 | ||||
|   #define HEATER_2_USES_THERMISTOR | ||||
| #endif | ||||
| #if TEMP_SENSOR_3 > 0 | ||||
|   #define THERMISTORHEATER_3 TEMP_SENSOR_3 | ||||
|   #define HEATER_3_USES_THERMISTOR | ||||
| #endif | ||||
| #if TEMP_SENSOR_BED > 0 | ||||
|   #define THERMISTORBED TEMP_SENSOR_BED | ||||
|   #define BED_USES_THERMISTOR | ||||
| #endif | ||||
| #if TEMP_SENSOR_0 == -1 | ||||
|   #define HEATER_0_USES_AD595 | ||||
| #endif | ||||
| #if TEMP_SENSOR_1 == -1 | ||||
|   #define HEATER_1_USES_AD595 | ||||
| #endif | ||||
| #if TEMP_SENSOR_2 == -1 | ||||
|   #define HEATER_2_USES_AD595 | ||||
| #endif | ||||
| #if TEMP_SENSOR_3 == -1 | ||||
|   #define HEATER_3_USES_AD595 | ||||
| #endif | ||||
| #if TEMP_SENSOR_BED == -1 | ||||
|   #define BED_USES_AD595 | ||||
| #endif | ||||
| #if TEMP_SENSOR_0 == -2 | ||||
|   #define HEATER_0_USES_MAX6675 | ||||
| #endif | ||||
| #if TEMP_SENSOR_0 == 0 | ||||
|   #undef HEATER_0_MINTEMP | ||||
|   #undef HEATER_0_MAXTEMP | ||||
| #endif | ||||
| #if TEMP_SENSOR_1 == 0 | ||||
|   #undef HEATER_1_MINTEMP | ||||
|   #undef HEATER_1_MAXTEMP | ||||
| #endif | ||||
| #if TEMP_SENSOR_2 == 0 | ||||
|   #undef HEATER_2_MINTEMP | ||||
|   #undef HEATER_2_MAXTEMP | ||||
| #endif | ||||
| #if TEMP_SENSOR_3 == 0 | ||||
|   #undef HEATER_3_MINTEMP | ||||
|   #undef HEATER_3_MAXTEMP | ||||
| #endif | ||||
| #if TEMP_SENSOR_BED == 0 | ||||
|   #undef BED_MINTEMP | ||||
|   #undef BED_MAXTEMP | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #endif //__CONFIGURATION_ADV_H | ||||
| #endif //CONFIGURATION_ADV_H | ||||
|   | ||||
		Reference in New Issue
	
	Block a user