Pārlūkot izejas kodu

Apply _AXIS macro

Scott Lahteine 6 gadus atpakaļ
vecāks
revīzija
08e36e264e

+ 0
- 2
Marlin/src/Marlin.h Parādīt failu

@@ -156,8 +156,6 @@ void manage_inactivity(const bool ignore_stepper_queue=false);
156 156
 /**
157 157
  * The axis order in all axis related arrays is X, Y, Z, E
158 158
  */
159
-#define _AXIS(AXIS) AXIS ##_AXIS
160
-
161 159
 void enable_all_steppers();
162 160
 void disable_e_stepper(const uint8_t e);
163 161
 void disable_e_steppers();

+ 2
- 0
Marlin/src/core/macros.h Parādīt failu

@@ -29,6 +29,8 @@
29 29
 #define ABC  3
30 30
 #define XYZ  3
31 31
 
32
+#define _AXIS(A) (A##_AXIS)
33
+
32 34
 #define _XMIN_ 100
33 35
 #define _YMIN_ 200
34 36
 #define _ZMIN_ 300

+ 1
- 1
Marlin/src/feature/I2CPositionEncoder.cpp Parādīt failu

@@ -293,7 +293,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
293 293
           error = (encoderCountInStepperTicksScaled - target);
294 294
 
295 295
   //suppress discontinuities (might be caused by bad I2C readings...?)
296
-  bool suppressOutput = (ABS(error - errorPrev) > 100);
296
+  const bool suppressOutput = (ABS(error - errorPrev) > 100);
297 297
 
298 298
   if (report) {
299 299
     SERIAL_ECHO(axis_codes[encoderAxis]);

+ 1
- 1
Marlin/src/feature/bedlevel/abl/abl.cpp Parādīt failu

@@ -362,7 +362,7 @@ float bilinear_z_offset(const float raw[XYZ]) {
362 362
 
363 363
 #if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
364 364
 
365
-  #define CELL_INDEX(A,V) ((V - bilinear_start[A##_AXIS]) * ABL_BG_FACTOR(A##_AXIS))
365
+  #define CELL_INDEX(A,V) ((V - bilinear_start[_AXIS(A)]) * ABL_BG_FACTOR(_AXIS(A)))
366 366
 
367 367
   /**
368 368
    * Prepare a bilinear-leveled linear move on Cartesian,

+ 2
- 2
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Parādīt failu

@@ -151,8 +151,8 @@ void GcodeSuite::M912() {
151 151
  */
152 152
 #if ENABLED(HYBRID_THRESHOLD)
153 153
   void GcodeSuite::M913() {
154
-    #define TMC_SAY_PWMTHRS(P,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[P##_AXIS])
155
-    #define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[P##_AXIS])
154
+    #define TMC_SAY_PWMTHRS(A,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[_AXIS(A)])
155
+    #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[_AXIS(A)])
156 156
     #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)
157 157
     #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)
158 158
 

+ 2
- 2
Marlin/src/module/configuration_store.cpp Parādīt failu

@@ -77,7 +77,7 @@
77 77
 #if HAS_TRINAMIC
78 78
   #include "stepper_indirection.h"
79 79
   #include "../feature/tmc_util.h"
80
-  #define TMC_GET_PWMTHRS(P,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[P##_AXIS])
80
+  #define TMC_GET_PWMTHRS(A,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[_AXIS(A)])
81 81
 #endif
82 82
 
83 83
 #if ENABLED(FWRETRACT)
@@ -1329,7 +1329,7 @@ void MarlinSettings::postprocess() {
1329 1329
       #endif
1330 1330
 
1331 1331
       #if ENABLED(HYBRID_THRESHOLD)
1332
-        #define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[P##_AXIS])
1332
+        #define TMC_SET_PWMTHRS(A,Q) tmc_set_pwmthrs(stepper##Q, tmc_hybrid_threshold[TMC_##Q], planner.axis_steps_per_mm[_AXIS(A)])
1333 1333
         uint32_t tmc_hybrid_threshold[TMC_AXES];
1334 1334
         EEPROM_READ(tmc_hybrid_threshold);
1335 1335
         if (!validating) {

+ 1
- 1
Marlin/src/module/motion.cpp Parādīt failu

@@ -1247,7 +1247,7 @@ void homeaxis(const AxisEnum axis) {
1247 1247
     if (axis != Z_AXIS) { BUZZ(100, 880); return; }
1248 1248
   #else
1249 1249
     #define CAN_HOME(A) \
1250
-      (axis == A##_AXIS && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
1250
+      (axis == _AXIS(A) && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
1251 1251
     if (!CAN_HOME(X) && !CAN_HOME(Y) && !CAN_HOME(Z)) return;
1252 1252
   #endif
1253 1253
 

+ 1
- 1
Marlin/src/module/motion.h Parādīt failu

@@ -189,7 +189,7 @@ void clean_up_after_endstop_or_probe_move();
189 189
 void set_axis_is_at_home(const AxisEnum axis);
190 190
 
191 191
 void homeaxis(const AxisEnum axis);
192
-#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
192
+#define HOMEAXIS(A) homeaxis(_AXIS(A))
193 193
 
194 194
 #if ENABLED(SENSORLESS_HOMING)
195 195
   void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);

+ 2
- 2
Marlin/src/module/planner.cpp Parādīt failu

@@ -2212,11 +2212,11 @@ void Planner::buffer_segment(const float &a, const float &b, const float &c, con
2212 2212
   // Always split the first move into two (if not homing or probing)
2213 2213
   if (!has_blocks_queued()) {
2214 2214
 
2215
-    #define _BETWEEN(A) (position[A##_AXIS] + target[A##_AXIS]) >> 1
2215
+    #define _BETWEEN(A) (position[_AXIS(A)] + target[_AXIS(A)]) >> 1
2216 2216
     const int32_t between[ABCE] = { _BETWEEN(A), _BETWEEN(B), _BETWEEN(C), _BETWEEN(E) };
2217 2217
 
2218 2218
     #if HAS_POSITION_FLOAT
2219
-      #define _BETWEEN_F(A) (position_float[A##_AXIS] + target_float[A##_AXIS]) * 0.5
2219
+      #define _BETWEEN_F(A) (position_float[_AXIS(A)] + target_float[_AXIS(A)]) * 0.5
2220 2220
       const float between_float[ABCE] = { _BETWEEN_F(A), _BETWEEN_F(B), _BETWEEN_F(C), _BETWEEN_F(E) };
2221 2221
     #endif
2222 2222
 

+ 8
- 8
Marlin/src/module/stepper.cpp Parādīt failu

@@ -182,20 +182,20 @@ volatile int32_t Stepper::endstops_trigsteps[XYZ];
182 182
   #define LOCKED_X2_MOTOR locked_x2_motor
183 183
   #define LOCKED_Y2_MOTOR locked_y2_motor
184 184
   #define LOCKED_Z2_MOTOR locked_z2_motor
185
-  #define DUAL_ENDSTOP_APPLY_STEP(AXIS,v)                                                                                                           \
185
+  #define DUAL_ENDSTOP_APPLY_STEP(A,V)                                                                                                           \
186 186
     if (performing_homing) {                                                                                                                        \
187
-      if (AXIS##_HOME_DIR < 0) {                                                                                                                    \
188
-        if (!(TEST(endstops.old_endstop_bits, AXIS##_MIN) && count_direction[AXIS##_AXIS] < 0) && !LOCKED_##AXIS##_MOTOR) AXIS##_STEP_WRITE(v);     \
189
-        if (!(TEST(endstops.old_endstop_bits, AXIS##2_MIN) && count_direction[AXIS##_AXIS] < 0) && !LOCKED_##AXIS##2_MOTOR) AXIS##2_STEP_WRITE(v);  \
187
+      if (A##_HOME_DIR < 0) {                                                                                                                    \
188
+        if (!(TEST(endstops.old_endstop_bits, A##_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V);     \
189
+        if (!(TEST(endstops.old_endstop_bits, A##2_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V);  \
190 190
       }                                                                                                                                             \
191 191
       else {                                                                                                                                        \
192
-        if (!(TEST(endstops.old_endstop_bits, AXIS##_MAX) && count_direction[AXIS##_AXIS] > 0) && !LOCKED_##AXIS##_MOTOR) AXIS##_STEP_WRITE(v);     \
193
-        if (!(TEST(endstops.old_endstop_bits, AXIS##2_MAX) && count_direction[AXIS##_AXIS] > 0) && !LOCKED_##AXIS##2_MOTOR) AXIS##2_STEP_WRITE(v);  \
192
+        if (!(TEST(endstops.old_endstop_bits, A##_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V);     \
193
+        if (!(TEST(endstops.old_endstop_bits, A##2_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V);  \
194 194
       }                                                                                                                                             \
195 195
     }                                                                                                                                               \
196 196
     else {                                                                                                                                          \
197
-      AXIS##_STEP_WRITE(v);                                                                                                                         \
198
-      AXIS##2_STEP_WRITE(v);                                                                                                                        \
197
+      A##_STEP_WRITE(V);                                                                                                                         \
198
+      A##2_STEP_WRITE(V);                                                                                                                        \
199 199
     }
200 200
 #endif
201 201
 

Notiek ielāde…
Atcelt
Saglabāt