Scott Lahteine преди 5 години
родител
ревизия
c4db8e49a7

+ 1
- 0
Marlin/src/core/types.h Целия файл

483
 #undef FI
483
 #undef FI
484
 
484
 
485
 const xyze_char_t axis_codes { 'X', 'Y', 'Z', 'E' };
485
 const xyze_char_t axis_codes { 'X', 'Y', 'Z', 'E' };
486
+#define XYZ_CHAR(A) ('X' + char(A))

+ 12
- 12
Marlin/src/core/utility.cpp Целия файл

139
     #endif
139
     #endif
140
 
140
 
141
     #if HAS_ABL_OR_UBL
141
     #if HAS_ABL_OR_UBL
142
-      SERIAL_ECHOLNPGM("Auto Bed Leveling: "
143
-        #if ENABLED(AUTO_BED_LEVELING_LINEAR)
144
-          "LINEAR"
145
-        #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
146
-          "BILINEAR"
147
-        #elif ENABLED(AUTO_BED_LEVELING_3POINT)
148
-          "3POINT"
149
-        #elif ENABLED(AUTO_BED_LEVELING_UBL)
150
-          "UBL"
151
-        #endif
152
-      );
142
+      SERIAL_ECHOPGM("Auto Bed Leveling: ");
143
+      #if ENABLED(AUTO_BED_LEVELING_LINEAR)
144
+        SERIAL_ECHOLNPGM("LINEAR");
145
+      #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
146
+        SERIAL_ECHOLNPGM("BILINEAR");
147
+      #elif ENABLED(AUTO_BED_LEVELING_3POINT)
148
+        SERIAL_ECHOLNPGM("3POINT");
149
+      #elif ENABLED(AUTO_BED_LEVELING_UBL)
150
+        SERIAL_ECHOLNPGM("UBL");
151
+      #endif
152
+
153
       if (planner.leveling_active) {
153
       if (planner.leveling_active) {
154
         SERIAL_ECHOLNPGM(" (enabled)");
154
         SERIAL_ECHOLNPGM(" (enabled)");
155
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
155
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
160
           SERIAL_ECHOPGM("ABL Adjustment X");
160
           SERIAL_ECHOPGM("ABL Adjustment X");
161
           LOOP_XYZ(a) {
161
           LOOP_XYZ(a) {
162
             float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
162
             float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
163
-            SERIAL_CHAR(' ', 'X' + char(a));
163
+            SERIAL_CHAR(' ', XYZ_CHAR(a));
164
             if (v > 0) SERIAL_CHAR('+');
164
             if (v > 0) SERIAL_CHAR('+');
165
             SERIAL_ECHO(v);
165
             SERIAL_ECHO(v);
166
           }
166
           }

+ 3
- 3
Marlin/src/gcode/calibrate/M425.cpp Целия файл

47
   bool noArgs = true;
47
   bool noArgs = true;
48
 
48
 
49
   LOOP_XYZ(a) {
49
   LOOP_XYZ(a) {
50
-    if (parser.seen(axis_codes[a])) {
50
+    if (parser.seen(XYZ_CHAR(a))) {
51
       planner.synchronize();
51
       planner.synchronize();
52
       backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
52
       backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
53
       noArgs = false;
53
       noArgs = false;
75
     SERIAL_ECHOLNPAIR("  Correction Amount/Fade-out:     F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
75
     SERIAL_ECHOLNPAIR("  Correction Amount/Fade-out:     F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
76
     SERIAL_ECHOPGM("  Backlash Distance (mm):        ");
76
     SERIAL_ECHOPGM("  Backlash Distance (mm):        ");
77
     LOOP_XYZ(a) {
77
     LOOP_XYZ(a) {
78
-      SERIAL_CHAR(' ', axis_codes[a]);
78
+      SERIAL_CHAR(' ', XYZ_CHAR(a));
79
       SERIAL_ECHO(backlash.distance_mm[a]);
79
       SERIAL_ECHO(backlash.distance_mm[a]);
80
       SERIAL_EOL();
80
       SERIAL_EOL();
81
     }
81
     }
88
       SERIAL_ECHOPGM("  Average measured backlash (mm):");
88
       SERIAL_ECHOPGM("  Average measured backlash (mm):");
89
       if (backlash.has_any_measurement()) {
89
       if (backlash.has_any_measurement()) {
90
         LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) {
90
         LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) {
91
-          SERIAL_CHAR(' ', axis_codes[a]);
91
+          SERIAL_CHAR(' ', XYZ_CHAR(a));
92
           SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
92
           SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
93
         }
93
         }
94
       }
94
       }

+ 2
- 2
Marlin/src/gcode/calibrate/M666.cpp Целия файл

40
   void GcodeSuite::M666() {
40
   void GcodeSuite::M666() {
41
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> M666");
41
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> M666");
42
     LOOP_XYZ(i) {
42
     LOOP_XYZ(i) {
43
-      if (parser.seen(axis_codes[i])) {
43
+      if (parser.seen(XYZ_CHAR(i))) {
44
         const float v = parser.value_linear_units();
44
         const float v = parser.value_linear_units();
45
         if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
45
         if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
46
-        if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", axis_codes[i], "] = ", delta_endstop_adj[i]);
46
+        if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", XYZ_CHAR(i), "] = ", delta_endstop_adj[i]);
47
       }
47
       }
48
     }
48
     }
49
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< M666");
49
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< M666");

+ 1
- 1
Marlin/src/gcode/control/M605.cpp Целия файл

138
 
138
 
139
         HOTEND_LOOP() {
139
         HOTEND_LOOP() {
140
           DEBUG_ECHOPAIR_P(SP_T_STR, int(e));
140
           DEBUG_ECHOPAIR_P(SP_T_STR, int(e));
141
-          LOOP_XYZ(a) DEBUG_ECHOPAIR("  hotend_offset[", int(e), "].", axis_codes[a] | 0x20, "=", hotend_offset[e][a]);
141
+          LOOP_XYZ(a) DEBUG_ECHOPAIR("  hotend_offset[", int(e), "].", XYZ_CHAR(a) | 0x20, "=", hotend_offset[e][a]);
142
           DEBUG_EOL();
142
           DEBUG_EOL();
143
         }
143
         }
144
         DEBUG_EOL();
144
         DEBUG_EOL();

+ 2
- 2
Marlin/src/gcode/feature/pause/G61.cpp Целия файл

56
 
56
 
57
   SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
57
   SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
58
   LOOP_XYZ(i) {
58
   LOOP_XYZ(i) {
59
-    destination[i] = parser.seen(axis_codes[i])
59
+    destination[i] = parser.seen(XYZ_CHAR(i))
60
       ? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)
60
       ? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)
61
       : current_position[i];
61
       : current_position[i];
62
-    SERIAL_CHAR(' ', axis_codes[i]);
62
+    SERIAL_CHAR(' ', XYZ_CHAR(i));
63
     SERIAL_ECHO_F(destination[i]);
63
     SERIAL_ECHO_F(destination[i]);
64
   }
64
   }
65
   SERIAL_EOL();
65
   SERIAL_EOL();

+ 1
- 1
Marlin/src/gcode/feature/trinamic/M911-M914.cpp Целия файл

348
 
348
 
349
     bool report = true;
349
     bool report = true;
350
     const uint8_t index = parser.byteval('I');
350
     const uint8_t index = parser.byteval('I');
351
-    LOOP_XYZ(i) if (parser.seen(axis_codes[i])) {
351
+    LOOP_XYZ(i) if (parser.seen(XYZ_CHAR(i))) {
352
       const int16_t value = parser.value_int();
352
       const int16_t value = parser.value_int();
353
       report = false;
353
       report = false;
354
       switch (i) {
354
       switch (i) {

+ 1
- 1
Marlin/src/gcode/gcode.cpp Целия файл

135
 
135
 
136
   // Get new XYZ position, whether absolute or relative
136
   // Get new XYZ position, whether absolute or relative
137
   LOOP_XYZ(i) {
137
   LOOP_XYZ(i) {
138
-    if ( (seen[i] = parser.seenval(axis_codes[i])) ) {
138
+    if ( (seen[i] = parser.seenval(XYZ_CHAR(i))) ) {
139
       const float v = parser.value_axis_units((AxisEnum)i);
139
       const float v = parser.value_axis_units((AxisEnum)i);
140
       if (skip_move)
140
       if (skip_move)
141
         destination[i] = current_position[i];
141
         destination[i] = current_position[i];

+ 1
- 1
Marlin/src/gcode/geometry/M206_M428.cpp Целия файл

38
  */
38
  */
39
 void GcodeSuite::M206() {
39
 void GcodeSuite::M206() {
40
   LOOP_XYZ(i)
40
   LOOP_XYZ(i)
41
-    if (parser.seen(axis_codes[i]))
41
+    if (parser.seen(XYZ_CHAR(i)))
42
       set_home_offset((AxisEnum)i, parser.value_linear_units());
42
       set_home_offset((AxisEnum)i, parser.value_linear_units());
43
 
43
 
44
   #if ENABLED(MORGAN_SCARA)
44
   #if ENABLED(MORGAN_SCARA)

+ 2
- 2
Marlin/src/gcode/host/M114.cpp Целия файл

45
 
45
 
46
   void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
46
   void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
47
     char str[12];
47
     char str[12];
48
-    for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) {
49
-      SERIAL_CHAR(' ', axis_codes[a], ':');
48
+    LOOP_XYZ(a) {
49
+      SERIAL_CHAR(' ', XYZ_CHAR(a), ':');
50
       SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
50
       SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
51
     }
51
     }
52
     SERIAL_EOL();
52
     SERIAL_EOL();

+ 2
- 2
Marlin/src/gcode/motion/M290.cpp Целия файл

76
  */
76
  */
77
 void GcodeSuite::M290() {
77
 void GcodeSuite::M290() {
78
   #if ENABLED(BABYSTEP_XY)
78
   #if ENABLED(BABYSTEP_XY)
79
-    for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
80
-      if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
79
+    LOOP_XYZ(a)
80
+      if (parser.seenval(XYZ_CHAR(a)) || (a == Z_AXIS && parser.seenval('S'))) {
81
         const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
81
         const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
82
         babystep.add_mm((AxisEnum)a, offs);
82
         babystep.add_mm((AxisEnum)a, offs);
83
         #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
83
         #if ENABLED(BABYSTEP_ZPROBE_OFFSET)

+ 2
- 2
Marlin/src/module/motion.cpp Целия файл

587
     #endif
587
     #endif
588
 
588
 
589
   if (DEBUGGING(LEVELING))
589
   if (DEBUGGING(LEVELING))
590
-    SERIAL_ECHOLNPAIR("Axis ", axis_codes[axis], " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
590
+    SERIAL_ECHOLNPAIR("Axis ", XYZ_CHAR(axis), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
591
 }
591
 }
592
 
592
 
593
   /**
593
   /**
1779
 #if HAS_WORKSPACE_OFFSET
1779
 #if HAS_WORKSPACE_OFFSET
1780
   void update_workspace_offset(const AxisEnum axis) {
1780
   void update_workspace_offset(const AxisEnum axis) {
1781
     workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1781
     workspace_offset[axis] = home_offset[axis] + position_shift[axis];
1782
-    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", axis_codes[axis], " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
1782
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", XYZ_CHAR(axis), " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
1783
   }
1783
   }
1784
 #endif
1784
 #endif
1785
 
1785
 

Loading…
Отказ
Запис