Reorder Conditionals_post.h and add comments

master
Scott Lahteine 8 years ago
parent 5135be14ea
commit f4685c28b7

@ -435,18 +435,100 @@
/**
* Shorthand for pin tests, used wherever needed
*/
// Steppers
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
#define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X_MICROSTEPS (PIN_EXISTS(X_MS1))
#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_Y_MICROSTEPS (PIN_EXISTS(Y_MS1))
#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
#define HAS_Z_MICROSTEPS (PIN_EXISTS(Z_MS1))
#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
#define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
#define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
// Extruder steppers and solenoids
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
#define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
#define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
#define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1))
#define HAS_SOLENOID_0 (PIN_EXISTS(SOL0))
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE))
#define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
#define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
#define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1))
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
// Endstops and bed probe
#define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
// Thermistors
#define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
#define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
#define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
#define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
#define HAS_TEMP_4 (PIN_EXISTS(TEMP_4) && TEMP_SENSOR_4 != 0 && TEMP_SENSOR_4 > -2)
#define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
#define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
// Heaters
#define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
#define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
#define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
#define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
#define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
// Thermal protection
#define HAS_THERMALLY_PROTECTED_BED (ENABLED(THERMAL_PROTECTION_BED) && HAS_TEMP_BED && HAS_HEATER_BED)
#define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
#define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
// Auto fans
#define HAS_AUTO_FAN_0 (PIN_EXISTS(E0_AUTO_FAN))
#define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN))
#define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN))
@ -463,91 +545,38 @@
#define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
#define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
#define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
// Other fans
#define HAS_FAN0 (PIN_EXISTS(FAN))
#define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && E0_AUTO_FAN_PIN != FAN1_PIN && E1_AUTO_FAN_PIN != FAN1_PIN && E2_AUTO_FAN_PIN != FAN1_PIN && E3_AUTO_FAN_PIN != FAN1_PIN)
#define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && E0_AUTO_FAN_PIN != FAN2_PIN && E1_AUTO_FAN_PIN != FAN2_PIN && E2_AUTO_FAN_PIN != FAN2_PIN && E3_AUTO_FAN_PIN != FAN2_PIN)
#define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
// Servos
#define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0)
#define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
#define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
#define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
#define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
// Sensors
#define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
#define HAS_FIL_RUNOUT (PIN_EXISTS(FIL_RUNOUT))
// User Interface
#define HAS_HOME (PIN_EXISTS(HOME))
#define HAS_KILL (PIN_EXISTS(KILL))
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
#define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X_MIN_PIN))
#define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X_MAX_PIN))
#define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y_MIN_PIN))
#define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y_MAX_PIN))
#define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z_MIN_PIN))
#define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z_MAX_PIN))
#define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
#define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
#define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
#define HAS_SOLENOID_0 (PIN_EXISTS(SOL0))
#define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
#define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
#define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
#define HAS_SOLENOID_4 (PIN_EXISTS(SOL4))
#define HAS_MICROSTEPS_X (PIN_EXISTS(X_MS1))
#define HAS_MICROSTEPS_Y (PIN_EXISTS(Y_MS1))
#define HAS_MICROSTEPS_Z (PIN_EXISTS(Z_MS1))
#define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
#define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
#define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
#define HAS_MICROSTEPS_E3 (PIN_EXISTS(E3_MS1))
#define HAS_MICROSTEPS_E4 (PIN_EXISTS(E4_MS1))
#define HAS_MICROSTEPS (HAS_MICROSTEPS_X || HAS_MICROSTEPS_Y || HAS_MICROSTEPS_Z || HAS_MICROSTEPS_E0 || HAS_MICROSTEPS_E1 || HAS_MICROSTEPS_E2)
#define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
#define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
#define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
#define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
#define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
#define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
#define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
#define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
#define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
#define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
#define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
#define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE))
#define HAS_X_DIR (PIN_EXISTS(X_DIR))
#define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
#define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
#define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
#define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
#define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
#define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
#define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
#define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
#define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
#define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
#define HAS_X_STEP (PIN_EXISTS(X_STEP))
#define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
#define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
#define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
#define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
#define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
#define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
#define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
#define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
#define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
#define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT))
// Digital control
#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS)
#define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
#define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
#define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
#define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
#define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
#define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
/**
* This setting is also used by M109 when trying to calculate
* a ballpark safe margin to prevent wait-forever situation.

@ -1464,31 +1464,31 @@ void Stepper::report_positions() {
void Stepper::microstep_init() {
SET_OUTPUT(X_MS1_PIN);
SET_OUTPUT(X_MS2_PIN);
#if HAS_MICROSTEPS_Y
#if HAS_Y_MICROSTEPS
SET_OUTPUT(Y_MS1_PIN);
SET_OUTPUT(Y_MS2_PIN);
#endif
#if HAS_MICROSTEPS_Z
#if HAS_Z_MICROSTEPS
SET_OUTPUT(Z_MS1_PIN);
SET_OUTPUT(Z_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E0
#if HAS_E0_MICROSTEPS
SET_OUTPUT(E0_MS1_PIN);
SET_OUTPUT(E0_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E1
#if HAS_E1_MICROSTEPS
SET_OUTPUT(E1_MS1_PIN);
SET_OUTPUT(E1_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E2
#if HAS_E2_MICROSTEPS
SET_OUTPUT(E2_MS1_PIN);
SET_OUTPUT(E2_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E3
#if HAS_E3_MICROSTEPS
SET_OUTPUT(E3_MS1_PIN);
SET_OUTPUT(E3_MS2_PIN);
#endif
#if HAS_MICROSTEPS_E4
#if HAS_E4_MICROSTEPS
SET_OUTPUT(E4_MS1_PIN);
SET_OUTPUT(E4_MS2_PIN);
#endif
@ -1500,49 +1500,49 @@ void Stepper::report_positions() {
void Stepper::microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2) {
if (ms1 >= 0) switch (driver) {
case 0: WRITE(X_MS1_PIN, ms1); break;
#if HAS_MICROSTEPS_Y
#if HAS_Y_MICROSTEPS
case 1: WRITE(Y_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_Z
#if HAS_Z_MICROSTEPS
case 2: WRITE(Z_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E0
#if HAS_E0_MICROSTEPS
case 3: WRITE(E0_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E1
#if HAS_E1_MICROSTEPS
case 4: WRITE(E1_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E2
#if HAS_E2_MICROSTEPS
case 5: WRITE(E2_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E3
#if HAS_E3_MICROSTEPS
case 6: WRITE(E3_MS1_PIN, ms1); break;
#endif
#if HAS_MICROSTEPS_E4
#if HAS_E4_MICROSTEPS
case 7: WRITE(E4_MS1_PIN, ms1); break;
#endif
}
if (ms2 >= 0) switch (driver) {
case 0: WRITE(X_MS2_PIN, ms2); break;
#if HAS_MICROSTEPS_Y
#if HAS_Y_MICROSTEPS
case 1: WRITE(Y_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_Z
#if HAS_Z_MICROSTEPS
case 2: WRITE(Z_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E0
#if HAS_E0_MICROSTEPS
case 3: WRITE(E0_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E1
#if HAS_E1_MICROSTEPS
case 4: WRITE(E1_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E2
#if HAS_E2_MICROSTEPS
case 5: WRITE(E2_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E3
#if HAS_E3_MICROSTEPS
case 6: WRITE(E3_MS2_PIN, ms2); break;
#endif
#if HAS_MICROSTEPS_E4
#if HAS_E4_MICROSTEPS
case 7: WRITE(E4_MS2_PIN, ms2); break;
#endif
}
@ -1563,37 +1563,37 @@ void Stepper::report_positions() {
SERIAL_PROTOCOLPGM("X: ");
SERIAL_PROTOCOL(READ(X_MS1_PIN));
SERIAL_PROTOCOLLN(READ(X_MS2_PIN));
#if HAS_MICROSTEPS_Y
#if HAS_Y_MICROSTEPS
SERIAL_PROTOCOLPGM("Y: ");
SERIAL_PROTOCOL(READ(Y_MS1_PIN));
SERIAL_PROTOCOLLN(READ(Y_MS2_PIN));
#endif
#if HAS_MICROSTEPS_Z
#if HAS_Z_MICROSTEPS
SERIAL_PROTOCOLPGM("Z: ");
SERIAL_PROTOCOL(READ(Z_MS1_PIN));
SERIAL_PROTOCOLLN(READ(Z_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E0
#if HAS_E0_MICROSTEPS
SERIAL_PROTOCOLPGM("E0: ");
SERIAL_PROTOCOL(READ(E0_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E0_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E1
#if HAS_E1_MICROSTEPS
SERIAL_PROTOCOLPGM("E1: ");
SERIAL_PROTOCOL(READ(E1_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E1_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E2
#if HAS_E2_MICROSTEPS
SERIAL_PROTOCOLPGM("E2: ");
SERIAL_PROTOCOL(READ(E2_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E2_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E3
#if HAS_E3_MICROSTEPS
SERIAL_PROTOCOLPGM("E3: ");
SERIAL_PROTOCOL(READ(E3_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E3_MS2_PIN));
#endif
#if HAS_MICROSTEPS_E4
#if HAS_E4_MICROSTEPS
SERIAL_PROTOCOLPGM("E4: ");
SERIAL_PROTOCOL(READ(E4_MS1_PIN));
SERIAL_PROTOCOLLN(READ(E4_MS2_PIN));

Loading…
Cancel
Save