Apply _AXIS macro
This commit is contained in:
parent
99ecdf59af
commit
08e36e264e
10 changed files with 20 additions and 20 deletions
|
@ -156,8 +156,6 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
|
||||||
/**
|
/**
|
||||||
* The axis order in all axis related arrays is X, Y, Z, E
|
* The axis order in all axis related arrays is X, Y, Z, E
|
||||||
*/
|
*/
|
||||||
#define _AXIS(AXIS) AXIS ##_AXIS
|
|
||||||
|
|
||||||
void enable_all_steppers();
|
void enable_all_steppers();
|
||||||
void disable_e_stepper(const uint8_t e);
|
void disable_e_stepper(const uint8_t e);
|
||||||
void disable_e_steppers();
|
void disable_e_steppers();
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#define ABC 3
|
#define ABC 3
|
||||||
#define XYZ 3
|
#define XYZ 3
|
||||||
|
|
||||||
|
#define _AXIS(A) (A##_AXIS)
|
||||||
|
|
||||||
#define _XMIN_ 100
|
#define _XMIN_ 100
|
||||||
#define _YMIN_ 200
|
#define _YMIN_ 200
|
||||||
#define _ZMIN_ 300
|
#define _ZMIN_ 300
|
||||||
|
|
|
@ -293,7 +293,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
|
||||||
error = (encoderCountInStepperTicksScaled - target);
|
error = (encoderCountInStepperTicksScaled - target);
|
||||||
|
|
||||||
//suppress discontinuities (might be caused by bad I2C readings...?)
|
//suppress discontinuities (might be caused by bad I2C readings...?)
|
||||||
bool suppressOutput = (ABS(error - errorPrev) > 100);
|
const bool suppressOutput = (ABS(error - errorPrev) > 100);
|
||||||
|
|
||||||
if (report) {
|
if (report) {
|
||||||
SERIAL_ECHO(axis_codes[encoderAxis]);
|
SERIAL_ECHO(axis_codes[encoderAxis]);
|
||||||
|
|
|
@ -362,7 +362,7 @@ float bilinear_z_offset(const float raw[XYZ]) {
|
||||||
|
|
||||||
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
|
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
|
||||||
|
|
||||||
#define CELL_INDEX(A,V) ((V - bilinear_start[A##_AXIS]) * ABL_BG_FACTOR(A##_AXIS))
|
#define CELL_INDEX(A,V) ((V - bilinear_start[_AXIS(A)]) * ABL_BG_FACTOR(_AXIS(A)))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare a bilinear-leveled linear move on Cartesian,
|
* Prepare a bilinear-leveled linear move on Cartesian,
|
||||||
|
|
|
@ -151,8 +151,8 @@ void GcodeSuite::M912() {
|
||||||
*/
|
*/
|
||||||
#if ENABLED(HYBRID_THRESHOLD)
|
#if ENABLED(HYBRID_THRESHOLD)
|
||||||
void GcodeSuite::M913() {
|
void GcodeSuite::M913() {
|
||||||
#define TMC_SAY_PWMTHRS(P,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[P##_AXIS])
|
#define TMC_SAY_PWMTHRS(A,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[_AXIS(A)])
|
||||||
#define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[P##_AXIS])
|
#define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[_AXIS(A)])
|
||||||
#define TMC_SAY_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
#define TMC_SAY_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
||||||
#define TMC_SET_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
#define TMC_SET_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
#if HAS_TRINAMIC
|
#if HAS_TRINAMIC
|
||||||
#include "stepper_indirection.h"
|
#include "stepper_indirection.h"
|
||||||
#include "../feature/tmc_util.h"
|
#include "../feature/tmc_util.h"
|
||||||
#define TMC_GET_PWMTHRS(P,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[P##_AXIS])
|
#define TMC_GET_PWMTHRS(A,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[_AXIS(A)])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
|
@ -1329,7 +1329,7 @@ void MarlinSettings::postprocess() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HYBRID_THRESHOLD)
|
#if ENABLED(HYBRID_THRESHOLD)
|
||||||
#define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[P##_AXIS])
|
#define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[_AXIS(A)])
|
||||||
uint32_t tmc_hybrid_threshold[TMC_AXES];
|
uint32_t tmc_hybrid_threshold[TMC_AXES];
|
||||||
EEPROM_READ(tmc_hybrid_threshold);
|
EEPROM_READ(tmc_hybrid_threshold);
|
||||||
if (!validating) {
|
if (!validating) {
|
||||||
|
|
|
@ -1247,7 +1247,7 @@ void homeaxis(const AxisEnum axis) {
|
||||||
if (axis != Z_AXIS) { BUZZ(100, 880); return; }
|
if (axis != Z_AXIS) { BUZZ(100, 880); return; }
|
||||||
#else
|
#else
|
||||||
#define CAN_HOME(A) \
|
#define CAN_HOME(A) \
|
||||||
(axis == A##_AXIS && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
|
(axis == _AXIS(A) && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
|
||||||
if (!CAN_HOME(X) && !CAN_HOME(Y) && !CAN_HOME(Z)) return;
|
if (!CAN_HOME(X) && !CAN_HOME(Y) && !CAN_HOME(Z)) return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ void clean_up_after_endstop_or_probe_move();
|
||||||
void set_axis_is_at_home(const AxisEnum axis);
|
void set_axis_is_at_home(const AxisEnum axis);
|
||||||
|
|
||||||
void homeaxis(const AxisEnum axis);
|
void homeaxis(const AxisEnum axis);
|
||||||
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
#define HOMEAXIS(A) homeaxis(_AXIS(A))
|
||||||
|
|
||||||
#if ENABLED(SENSORLESS_HOMING)
|
#if ENABLED(SENSORLESS_HOMING)
|
||||||
void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
|
void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
|
||||||
|
|
|
@ -2212,11 +2212,11 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
|
||||||
// Always split the first move into two (if not homing or probing)
|
// Always split the first move into two (if not homing or probing)
|
||||||
if (!has_blocks_queued()) {
|
if (!has_blocks_queued()) {
|
||||||
|
|
||||||
#define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
|
#define _BETWEEN(A) (position[_AXIS(A)] + target[_AXIS(A)]) >> 1
|
||||||
const int32_t between[ABCE] = { _BETWEEN(A), _BETWEEN(B), _BETWEEN(C), _BETWEEN(E) };
|
const int32_t between[ABCE] = { _BETWEEN(A), _BETWEEN(B), _BETWEEN(C), _BETWEEN(E) };
|
||||||
|
|
||||||
#if HAS_POSITION_FLOAT
|
#if HAS_POSITION_FLOAT
|
||||||
#define _BETWEEN_F(A) (position_float[A##_AXIS] + target_float[A##_AXIS]) * 0.5
|
#define _BETWEEN_F(A) (position_float[_AXIS(A)] + target_float[_AXIS(A)]) * 0.5
|
||||||
const float between_float[ABCE] = { _BETWEEN_F(A), _BETWEEN_F(B), _BETWEEN_F(C), _BETWEEN_F(E) };
|
const float between_float[ABCE] = { _BETWEEN_F(A), _BETWEEN_F(B), _BETWEEN_F(C), _BETWEEN_F(E) };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -182,20 +182,20 @@ volatile int32_t Stepper::endstops_trigsteps[XYZ];
|
||||||
#define LOCKED_X2_MOTOR locked_x2_motor
|
#define LOCKED_X2_MOTOR locked_x2_motor
|
||||||
#define LOCKED_Y2_MOTOR locked_y2_motor
|
#define LOCKED_Y2_MOTOR locked_y2_motor
|
||||||
#define LOCKED_Z2_MOTOR locked_z2_motor
|
#define LOCKED_Z2_MOTOR locked_z2_motor
|
||||||
#define DUAL_ENDSTOP_APPLY_STEP(AXIS,v) \
|
#define DUAL_ENDSTOP_APPLY_STEP(A,V) \
|
||||||
if (performing_homing) { \
|
if (performing_homing) { \
|
||||||
if (AXIS##_HOME_DIR < 0) { \
|
if (A##_HOME_DIR < 0) { \
|
||||||
if (!(TEST(endstops.old_endstop_bits, AXIS##_MIN) && count_direction[AXIS##_AXIS] < 0) && !LOCKED_##AXIS##_MOTOR) AXIS##_STEP_WRITE(v); \
|
if (!(TEST(endstops.old_endstop_bits, A##_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V); \
|
||||||
if (!(TEST(endstops.old_endstop_bits, AXIS##2_MIN) && count_direction[AXIS##_AXIS] < 0) && !LOCKED_##AXIS##2_MOTOR) AXIS##2_STEP_WRITE(v); \
|
if (!(TEST(endstops.old_endstop_bits, A##2_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V); \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
if (!(TEST(endstops.old_endstop_bits, AXIS##_MAX) && count_direction[AXIS##_AXIS] > 0) && !LOCKED_##AXIS##_MOTOR) AXIS##_STEP_WRITE(v); \
|
if (!(TEST(endstops.old_endstop_bits, A##_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V); \
|
||||||
if (!(TEST(endstops.old_endstop_bits, AXIS##2_MAX) && count_direction[AXIS##_AXIS] > 0) && !LOCKED_##AXIS##2_MOTOR) AXIS##2_STEP_WRITE(v); \
|
if (!(TEST(endstops.old_endstop_bits, A##2_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
AXIS##_STEP_WRITE(v); \
|
A##_STEP_WRITE(V); \
|
||||||
AXIS##2_STEP_WRITE(v); \
|
A##2_STEP_WRITE(V); \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Reference in a new issue