Browse Source

Move stepper enable/disable to stepper_indirection.h (#12562)

pull/1/head
Scott Lahteine 6 years ago
committed by GitHub
parent
commit
3c58b16c9f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 120
      Marlin/src/Marlin.h
  2. 8
      Marlin/src/module/probe.cpp
  3. 123
      Marlin/src/module/stepper_indirection.h
  4. 2
      Marlin/src/pins/pins_ANET_10.h

120
Marlin/src/Marlin.h

@ -41,126 +41,6 @@ void idle(
void manage_inactivity(const bool ignore_stepper_queue=false);
#if HAS_X2_ENABLE
#define enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#elif HAS_X_ENABLE
#define enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#else
#define enable_X() NOOP
#define disable_X() NOOP
#endif
#if HAS_Y2_ENABLE
#define enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#elif HAS_Y_ENABLE
#define enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#else
#define enable_Y() NOOP
#define disable_Y() NOOP
#endif
#if HAS_Z3_ENABLE
#define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); Z3_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); Z3_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#elif HAS_Z2_ENABLE
#define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#elif HAS_Z_ENABLE
#define enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#else
#define enable_Z() NOOP
#define disable_Z() NOOP
#endif
#if ENABLED(MIXING_EXTRUDER)
/**
* Mixing steppers synchronize their enable (and direction) together
*/
#if MIXING_STEPPERS > 5
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); E5_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); E5_ENABLE_WRITE(!E_ENABLE_ON); }
#elif MIXING_STEPPERS > 4
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); }
#elif MIXING_STEPPERS > 3
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
#elif MIXING_STEPPERS > 2
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
#else
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
#endif
#define enable_E1() NOOP
#define disable_E1() NOOP
#define enable_E2() NOOP
#define disable_E2() NOOP
#define enable_E3() NOOP
#define disable_E3() NOOP
#define enable_E4() NOOP
#define disable_E4() NOOP
#define enable_E5() NOOP
#define disable_E5() NOOP
#else // !MIXING_EXTRUDER
#if HAS_E0_ENABLE
#define enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E0() NOOP
#define disable_E0() NOOP
#endif
#if E_STEPPERS > 1 && HAS_E1_ENABLE
#define enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E1() NOOP
#define disable_E1() NOOP
#endif
#if E_STEPPERS > 2 && HAS_E2_ENABLE
#define enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E2() NOOP
#define disable_E2() NOOP
#endif
#if E_STEPPERS > 3 && HAS_E3_ENABLE
#define enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E3() NOOP
#define disable_E3() NOOP
#endif
#if E_STEPPERS > 4 && HAS_E4_ENABLE
#define enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E4() NOOP
#define disable_E4() NOOP
#endif
#if E_STEPPERS > 5 && HAS_E5_ENABLE
#define enable_E5() E5_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E5() E5_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E5() NOOP
#define disable_E5() NOOP
#endif
#endif // !MIXING_EXTRUDER
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "feature/twibus.h"
extern TWIBus i2c;

8
Marlin/src/module/probe.cpp

@ -38,7 +38,9 @@
#include "../gcode/gcode.h"
#include "../lcd/ultralcd.h"
#include "../Marlin.h"
#if ENABLED(BLTOUCH) || ENABLED(Z_PROBE_SLED) || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST)
#include "../Marlin.h" // for stop()
#endif
#if HAS_LEVELING
#include "../feature/bedlevel/bedlevel.h"
@ -63,6 +65,10 @@ float zprobe_zoffset; // Initialized by settings.load()
#include "../feature/tmc_util.h"
#endif
#if QUIET_PROBING
#include "stepper_indirection.h"
#endif
#if ENABLED(Z_PROBE_SLED)
#ifndef SLED_DOCKING_OFFSET

123
Marlin/src/module/stepper_indirection.h

@ -613,3 +613,126 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#define NORM_E_DIR(E) E0_DIR_WRITE(!INVERT_E0_DIR)
#define REV_E_DIR(E) E0_DIR_WRITE( INVERT_E0_DIR)
#endif
//
// Stepper enable / disable
//
#if HAS_X2_ENABLE
#define enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#elif HAS_X_ENABLE
#define enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
#define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
#else
#define enable_X() NOOP
#define disable_X() NOOP
#endif
#if HAS_Y2_ENABLE
#define enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#elif HAS_Y_ENABLE
#define enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
#define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
#else
#define enable_Y() NOOP
#define disable_Y() NOOP
#endif
#if HAS_Z3_ENABLE
#define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); Z3_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); Z3_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#elif HAS_Z2_ENABLE
#define enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#elif HAS_Z_ENABLE
#define enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
#define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
#else
#define enable_Z() NOOP
#define disable_Z() NOOP
#endif
#if ENABLED(MIXING_EXTRUDER)
/**
* Mixing steppers synchronize their enable (and direction) together
*/
#if MIXING_STEPPERS > 5
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); E5_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); E5_ENABLE_WRITE(!E_ENABLE_ON); }
#elif MIXING_STEPPERS > 4
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); }
#elif MIXING_STEPPERS > 3
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
#elif MIXING_STEPPERS > 2
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
#else
#define enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
#define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
#endif
#define enable_E1() NOOP
#define disable_E1() NOOP
#define enable_E2() NOOP
#define disable_E2() NOOP
#define enable_E3() NOOP
#define disable_E3() NOOP
#define enable_E4() NOOP
#define disable_E4() NOOP
#define enable_E5() NOOP
#define disable_E5() NOOP
#else // !MIXING_EXTRUDER
#if HAS_E0_ENABLE
#define enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E0() NOOP
#define disable_E0() NOOP
#endif
#if E_STEPPERS > 1 && HAS_E1_ENABLE
#define enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E1() NOOP
#define disable_E1() NOOP
#endif
#if E_STEPPERS > 2 && HAS_E2_ENABLE
#define enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E2() NOOP
#define disable_E2() NOOP
#endif
#if E_STEPPERS > 3 && HAS_E3_ENABLE
#define enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E3() NOOP
#define disable_E3() NOOP
#endif
#if E_STEPPERS > 4 && HAS_E4_ENABLE
#define enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E4() NOOP
#define disable_E4() NOOP
#endif
#if E_STEPPERS > 5 && HAS_E5_ENABLE
#define enable_E5() E5_ENABLE_WRITE( E_ENABLE_ON)
#define disable_E5() E5_ENABLE_WRITE(!E_ENABLE_ON)
#else
#define enable_E5() NOOP
#define disable_E5() NOOP
#endif
#endif // !MIXING_EXTRUDER

2
Marlin/src/pins/pins_ANET_10.h

@ -89,7 +89,7 @@
*/
#ifndef __AVR_ATmega1284P__
#error "Oops! Select 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.'"
#error "Oops! Select 'Sanguino' in 'Tools > Board' and 'ATmega1284P' in 'Tools > Processor.' (For PlatformIO, use 'melzi' or 'melzi_optiboot.')"
#endif
#define BOARD_NAME "Anet 1.0"

Loading…
Cancel
Save