Selaa lähdekoodia

🎨 Misc cleanup and fixes

Scott Lahteine 3 vuotta sitten
vanhempi
commit
abbe3f0dc7

+ 1
- 1
Marlin/src/core/debug_section.h Näytä tiedosto

@@ -44,6 +44,6 @@ private:
44 44
       SERIAL_ECHOPGM_P(the_msg);
45 45
     }
46 46
     SERIAL_CHAR(' ');
47
-    print_xyz(current_position);
47
+    print_pos(current_position);
48 48
   }
49 49
 };

+ 8
- 8
Marlin/src/core/language.h Näytä tiedosto

@@ -277,14 +277,6 @@
277 277
 #define STR_REMINDER_SAVE_SETTINGS          "Remember to save!"
278 278
 #define STR_PASSWORD_SET                    "Password is "
279 279
 
280
-// LCD Menu Messages
281
-
282
-#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(fontdata/langdata_##M.h)
283
-#define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M)
284
-
285
-#define LANGUAGE_INCL_(M) STRINGIFY_(../lcd/language/language_##M.h)
286
-#define LANGUAGE_INCL(M) LANGUAGE_INCL_(M)
287
-
288 280
 #define STR_X "X"
289 281
 #define STR_Y "Y"
290 282
 #define STR_Z "Z"
@@ -386,6 +378,14 @@
386 378
 #define LCD_STR_E6 "E" LCD_STR_N6
387 379
 #define LCD_STR_E7 "E" LCD_STR_N7
388 380
 
381
+// Include localized LCD Menu Messages
382
+
383
+#define LANGUAGE_DATA_INCL_(M) STRINGIFY_(fontdata/langdata_##M.h)
384
+#define LANGUAGE_DATA_INCL(M) LANGUAGE_DATA_INCL_(M)
385
+
386
+#define LANGUAGE_INCL_(M) STRINGIFY_(../lcd/language/language_##M.h)
387
+#define LANGUAGE_INCL(M) LANGUAGE_INCL_(M)
388
+
389 389
 // Use superscripts, if possible. Evaluated at point of use.
390 390
 #define SUPERSCRIPT_TWO   TERN(NOT_EXTENDED_ISO10646_1_5X7, "^2", "²")
391 391
 #define SUPERSCRIPT_THREE TERN(NOT_EXTENDED_ISO10646_1_5X7, "^3", "³")

+ 1
- 1
Marlin/src/core/serial.cpp Näytä tiedosto

@@ -101,7 +101,7 @@ void print_bin(uint16_t val) {
101 101
   }
102 102
 }
103 103
 
104
-void print_xyz(const_float_t x, const_float_t y, const_float_t z, PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) {
104
+void print_pos(const_float_t x, const_float_t y, const_float_t z, PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) {
105 105
   if (prefix) serialprintPGM(prefix);
106 106
   SERIAL_ECHOPAIR_P(SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z);
107 107
   if (suffix) serialprintPGM(suffix); else SERIAL_EOL();

+ 5
- 5
Marlin/src/core/serial.h Näytä tiedosto

@@ -310,11 +310,11 @@ void serialprint_truefalse(const bool tf);
310 310
 void serial_spaces(uint8_t count);
311 311
 
312 312
 void print_bin(const uint16_t val);
313
-void print_xyz(const_float_t x, const_float_t y, const_float_t z, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr);
313
+void print_pos(const_float_t x, const_float_t y, const_float_t z, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr);
314 314
 
315
-inline void print_xyz(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) {
316
-  print_xyz(xyz.x, xyz.y, xyz.z, prefix, suffix);
315
+inline void print_pos(const xyz_pos_t &xyz, PGM_P const prefix=nullptr, PGM_P const suffix=nullptr) {
316
+  print_pos(xyz.x, xyz.y, xyz.z, prefix, suffix);
317 317
 }
318 318
 
319
-#define SERIAL_POS(SUFFIX,VAR) do { print_xyz(VAR, PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n")); }while(0)
320
-#define SERIAL_XYZ(PREFIX,V...) do { print_xyz(V, PSTR(PREFIX), nullptr); }while(0)
319
+#define SERIAL_POS(SUFFIX,VAR) do { print_pos(VAR, PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n")); }while(0)
320
+#define SERIAL_XYZ(PREFIX,V...) do { print_pos(V, PSTR(PREFIX), nullptr); }while(0)

+ 10
- 10
Marlin/src/core/types.h Näytä tiedosto

@@ -30,6 +30,16 @@ class __FlashStringHelper;
30 30
 typedef const __FlashStringHelper *progmem_str;
31 31
 
32 32
 //
33
+// Conditional type assignment magic. For example...
34
+//
35
+// typename IF<(MYOPT==12), int, float>::type myvar;
36
+//
37
+template <bool, class L, class R>
38
+struct IF { typedef R type; };
39
+template <class L, class R>
40
+struct IF<true, L, R> { typedef L type; };
41
+
42
+//
33 43
 // Enumerated axis indices
34 44
 //
35 45
 //  - X_AXIS, Y_AXIS, and Z_AXIS should be used for axes in Cartesian space
@@ -58,16 +68,6 @@ enum AxisEnum : uint8_t {
58 68
 #define LOOP_ABCE_N(VAR) LOOP_S_L_N(VAR, A_AXIS, XYZE_N)
59 69
 
60 70
 //
61
-// Conditional type assignment magic. For example...
62
-//
63
-// typename IF<(MYOPT==12), int, float>::type myvar;
64
-//
65
-template <bool, class L, class R>
66
-struct IF { typedef R type; };
67
-template <class L, class R>
68
-struct IF<true, L, R> { typedef L type; };
69
-
70
-//
71 71
 // feedRate_t is just a humble float
72 72
 //
73 73
 typedef float feedRate_t;

+ 16
- 20
Marlin/src/gcode/calibrate/G425.cpp Näytä tiedosto

@@ -194,16 +194,20 @@ float measuring_movement(const AxisEnum axis, const int dir, const bool stop_sta
194 194
 inline float measure(const AxisEnum axis, const int dir, const bool stop_state, float * const backlash_ptr, const float uncertainty) {
195 195
   const bool fast = uncertainty == CALIBRATION_MEASUREMENT_UNKNOWN;
196 196
 
197
-  // Save position
198
-  destination = current_position;
199
-  const float start_pos = destination[axis];
197
+  // Save the current position of the specified axis
198
+  const float start_pos = current_position[axis];
199
+
200
+  // Take a measurement. Only the specified axis will be affected.
200 201
   const float measured_pos = measuring_movement(axis, dir, stop_state, fast);
202
+
201 203
   // Measure backlash
202 204
   if (backlash_ptr && !fast) {
203 205
     const float release_pos = measuring_movement(axis, -dir, !stop_state, fast);
204 206
     *backlash_ptr = ABS(release_pos - measured_pos);
205 207
   }
206
-  // Return to starting position
208
+
209
+  // Move back to the starting position
210
+  destination = current_position;
207 211
   destination[axis] = start_pos;
208 212
   do_blocking_move_to(destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));
209 213
   return measured_pos;
@@ -235,12 +239,12 @@ inline void probe_side(measurements_t &m, const float uncertainty, const side_t
235 239
       }
236 240
     #endif
237 241
     #if AXIS_CAN_CALIBRATE(X)
242
+      case RIGHT: dir = -1;
238 243
       case LEFT:  axis = X_AXIS; break;
239
-      case RIGHT: axis = X_AXIS; dir = -1; break;
240 244
     #endif
241 245
     #if AXIS_CAN_CALIBRATE(Y)
246
+      case BACK:  dir = -1;
242 247
       case FRONT: axis = Y_AXIS; break;
243
-      case BACK:  axis = Y_AXIS; dir = -1; break;
244 248
     #endif
245 249
     default: return;
246 250
   }
@@ -303,16 +307,8 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
303 307
 
304 308
   // The difference between the known and the measured location
305 309
   // of the calibration object is the positional error
306
-  m.pos_error.x = (0
307
-    #if HAS_X_CENTER
308
-      + true_center.x - m.obj_center.x
309
-    #endif
310
-  );
311
-  m.pos_error.y = (0
312
-    #if HAS_Y_CENTER
313
-      + true_center.y - m.obj_center.y
314
-    #endif
315
-  );
310
+  m.pos_error.x = TERN0(HAS_X_CENTER, true_center.x - m.obj_center.x);
311
+  m.pos_error.y = TERN0(HAS_Y_CENTER, true_center.y - m.obj_center.y);
316 312
   m.pos_error.z = true_center.z - m.obj_center.z;
317 313
 }
318 314
 
@@ -589,12 +585,12 @@ void GcodeSuite::G425() {
589 585
   SET_SOFT_ENDSTOP_LOOSE(true);
590 586
 
591 587
   measurements_t m;
592
-  float uncertainty = parser.seenval('U') ? parser.value_float() : CALIBRATION_MEASUREMENT_UNCERTAIN;
588
+  const float uncertainty = parser.floatval('U', CALIBRATION_MEASUREMENT_UNCERTAIN);
593 589
 
594
-  if (parser.seen('B'))
590
+  if (parser.seen_test('B'))
595 591
     calibrate_backlash(m, uncertainty);
596
-  else if (parser.seen('T'))
597
-    calibrate_toolhead(m, uncertainty, parser.has_value() ? parser.value_int() : active_extruder);
592
+  else if (parser.seen_test('T'))
593
+    calibrate_toolhead(m, uncertainty, parser.intval('T', active_extruder));
598 594
   #if ENABLED(CALIBRATION_REPORTING)
599 595
     else if (parser.seen('V')) {
600 596
       probe_sides(m, uncertainty);

+ 11
- 21
Marlin/src/gcode/config/M200-M205.cpp Näytä tiedosto

@@ -87,7 +87,7 @@ void GcodeSuite::M201() {
87 87
   #endif
88 88
 
89 89
   LOOP_XYZE(i) {
90
-    if (parser.seen(axis_codes[i])) {
90
+    if (parser.seenval(axis_codes[i])) {
91 91
       const uint8_t a = (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i);
92 92
       planner.set_max_acceleration(a, parser.value_axis_units((AxisEnum)a));
93 93
     }
@@ -105,7 +105,7 @@ void GcodeSuite::M203() {
105 105
   if (target_extruder < 0) return;
106 106
 
107 107
   LOOP_XYZE(i)
108
-    if (parser.seen(axis_codes[i])) {
108
+    if (parser.seenval(axis_codes[i])) {
109 109
       const uint8_t a = (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i);
110 110
       planner.set_max_feedrate(a, parser.value_axis_units((AxisEnum)a));
111 111
     }
@@ -147,24 +147,14 @@ void GcodeSuite::M204() {
147 147
  *    J = Junction Deviation (mm) (If not using CLASSIC_JERK)
148 148
  */
149 149
 void GcodeSuite::M205() {
150
-  #if HAS_JUNCTION_DEVIATION
151
-    #define J_PARAM  "J"
152
-  #else
153
-    #define J_PARAM
154
-  #endif
155
-  #if HAS_CLASSIC_JERK
156
-    #define XYZE_PARAM "XYZE"
157
-  #else
158
-    #define XYZE_PARAM
159
-  #endif
160
-  if (!parser.seen("BST" J_PARAM XYZE_PARAM)) return;
150
+  if (!parser.seen("BST" TERN_(HAS_JUNCTION_DEVIATION, "J") TERN_(HAS_CLASSIC_JERK, "XYZE"))) return;
161 151
 
162 152
   //planner.synchronize();
163
-  if (parser.seen('B')) planner.settings.min_segment_time_us = parser.value_ulong();
164
-  if (parser.seen('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
165
-  if (parser.seen('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
153
+  if (parser.seenval('B')) planner.settings.min_segment_time_us = parser.value_ulong();
154
+  if (parser.seenval('S')) planner.settings.min_feedrate_mm_s = parser.value_linear_units();
155
+  if (parser.seenval('T')) planner.settings.min_travel_feedrate_mm_s = parser.value_linear_units();
166 156
   #if HAS_JUNCTION_DEVIATION
167
-    if (parser.seen('J')) {
157
+    if (parser.seenval('J')) {
168 158
       const float junc_dev = parser.value_linear_units();
169 159
       if (WITHIN(junc_dev, 0.01f, 0.3f)) {
170 160
         planner.junction_deviation_mm = junc_dev;
@@ -175,9 +165,9 @@ void GcodeSuite::M205() {
175 165
     }
176 166
   #endif
177 167
   #if HAS_CLASSIC_JERK
178
-    if (parser.seen('X')) planner.set_max_jerk(X_AXIS, parser.value_linear_units());
179
-    if (parser.seen('Y')) planner.set_max_jerk(Y_AXIS, parser.value_linear_units());
180
-    if (parser.seen('Z')) {
168
+    if (parser.seenval('X')) planner.set_max_jerk(X_AXIS, parser.value_linear_units());
169
+    if (parser.seenval('Y')) planner.set_max_jerk(Y_AXIS, parser.value_linear_units());
170
+    if (parser.seenval('Z')) {
181 171
       planner.set_max_jerk(Z_AXIS, parser.value_linear_units());
182 172
       #if HAS_MESH && DISABLED(LIMITED_JERK_EDITING)
183 173
         if (planner.max_jerk.z <= 0.1f)
@@ -185,7 +175,7 @@ void GcodeSuite::M205() {
185 175
       #endif
186 176
     }
187 177
     #if HAS_CLASSIC_E_JERK
188
-      if (parser.seen('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units());
178
+      if (parser.seenval('E')) planner.set_max_jerk(E_AXIS, parser.value_linear_units());
189 179
     #endif
190 180
   #endif
191 181
 }

+ 3
- 6
Marlin/src/gcode/config/M92.cpp Näytä tiedosto

@@ -42,7 +42,7 @@ void report_M92(const bool echo=true, const int8_t e=-1) {
42 42
     }
43 43
   #endif
44 44
 
45
-  UNUSED_E(e);
45
+  UNUSED(e);
46 46
 }
47 47
 
48 48
 /**
@@ -64,11 +64,8 @@ void GcodeSuite::M92() {
64 64
   if (target_extruder < 0) return;
65 65
 
66 66
   // No arguments? Show M92 report.
67
-  if (!parser.seen("XYZE"
68
-    #if ENABLED(MAGIC_NUMBERS_GCODE)
69
-      "HL"
70
-    #endif
71
-  )) return report_M92(true, target_extruder);
67
+  if (!parser.seen("XYZE" TERN_(MAGIC_NUMBERS_GCODE, "HL")))
68
+    return report_M92(true, target_extruder);
72 69
 
73 70
   LOOP_XYZE(i) {
74 71
     if (parser.seenval(axis_codes[i])) {

+ 8
- 8
Marlin/src/gcode/control/M17_M18_M84.cpp Näytä tiedosto

@@ -34,10 +34,10 @@
34 34
  */
35 35
 void GcodeSuite::M17() {
36 36
   if (parser.seen("XYZE")) {
37
-    if (parser.seen('X')) ENABLE_AXIS_X();
38
-    if (parser.seen('Y')) ENABLE_AXIS_Y();
39
-    if (parser.seen('Z')) ENABLE_AXIS_Z();
40
-    if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) enable_e_steppers();
37
+    if (parser.seen_test('X')) ENABLE_AXIS_X();
38
+    if (parser.seen_test('Y')) ENABLE_AXIS_Y();
39
+    if (parser.seen_test('Z')) ENABLE_AXIS_Z();
40
+    if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen_test('E'))) enable_e_steppers();
41 41
   }
42 42
   else {
43 43
     LCD_MESSAGEPGM(MSG_NO_MOVE);
@@ -56,10 +56,10 @@ void GcodeSuite::M18_M84() {
56 56
   else {
57 57
     if (parser.seen("XYZE")) {
58 58
       planner.synchronize();
59
-      if (parser.seen('X')) DISABLE_AXIS_X();
60
-      if (parser.seen('Y')) DISABLE_AXIS_Y();
61
-      if (parser.seen('Z')) DISABLE_AXIS_Z();
62
-      if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen('E'))) disable_e_steppers();
59
+      if (parser.seen_test('X')) DISABLE_AXIS_X();
60
+      if (parser.seen_test('Y')) DISABLE_AXIS_Y();
61
+      if (parser.seen_test('Z')) DISABLE_AXIS_Z();
62
+      if (TERN0(HAS_E_STEPPER_ENABLE, parser.seen_test('E'))) disable_e_steppers();
63 63
     }
64 64
     else
65 65
       planner.finish_and_disable();

+ 2
- 2
Marlin/src/gcode/control/M211.cpp Näytä tiedosto

@@ -39,8 +39,8 @@ void GcodeSuite::M211() {
39 39
   SERIAL_ECHOPGM(STR_SOFT_ENDSTOPS);
40 40
   if (parser.seen('S')) soft_endstop._enabled = parser.value_bool();
41 41
   serialprint_onoff(soft_endstop._enabled);
42
-  print_xyz(l_soft_min, PSTR(STR_SOFT_MIN), PSTR(" "));
43
-  print_xyz(l_soft_max, PSTR(STR_SOFT_MAX));
42
+  print_pos(l_soft_min, PSTR(STR_SOFT_MIN), PSTR(" "));
43
+  print_pos(l_soft_max, PSTR(STR_SOFT_MAX));
44 44
 }
45 45
 
46 46
 #endif

+ 18
- 28
Marlin/src/gcode/feature/trinamic/M911-M914.cpp Näytä tiedosto

@@ -35,10 +35,19 @@
35 35
   #define M91x_USE(ST) (AXIS_DRIVER_TYPE(ST, TMC2130) || AXIS_DRIVER_TYPE(ST, TMC2160) || AXIS_DRIVER_TYPE(ST, TMC2208) || AXIS_DRIVER_TYPE(ST, TMC2209) || AXIS_DRIVER_TYPE(ST, TMC2660) || AXIS_DRIVER_TYPE(ST, TMC5130) || AXIS_DRIVER_TYPE(ST, TMC5160))
36 36
   #define M91x_USE_E(N) (E_STEPPERS > N && M91x_USE(E##N))
37 37
 
38
-  #define M91x_SOME_X (M91x_USE(X) || M91x_USE(X2))
39
-  #define M91x_SOME_Y (M91x_USE(Y) || M91x_USE(Y2))
40
-  #define M91x_SOME_Z (M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3) || M91x_USE(Z4))
41
-  #define M91x_SOME_E (M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) || M91x_USE_E(6) || M91x_USE_E(7))
38
+  #if M91x_USE(X) || M91x_USE(X2)
39
+    #define M91x_SOME_X 1
40
+  #endif
41
+  #if M91x_USE(Y) || M91x_USE(Y2)
42
+    #define M91x_SOME_Y 1
43
+  #endif
44
+  #if M91x_USE(Z) || M91x_USE(Z2) || M91x_USE(Z3) || M91x_USE(Z4)
45
+    #define M91x_SOME_Z 1
46
+  #endif
47
+
48
+  #if M91x_USE_E(0) || M91x_USE_E(1) || M91x_USE_E(2) || M91x_USE_E(3) || M91x_USE_E(4) || M91x_USE_E(5) || M91x_USE_E(6) || M91x_USE_E(7)
49
+    #define M91x_SOME_E 1
50
+  #endif
42 51
 
43 52
   #if !M91x_SOME_X && !M91x_SOME_Y && !M91x_SOME_Z && !M91x_SOME_E
44 53
     #error "MONITOR_DRIVER_STATUS requires at least one TMC2130, 2160, 2208, 2209, 2660, 5130, or 5160."
@@ -112,31 +121,12 @@
112 121
    *       M912 E1  ; clear E1 only
113 122
    */
114 123
   void GcodeSuite::M912() {
115
-    #if M91x_SOME_X
116
-      const bool hasX = parser.seen(axis_codes.x);
117
-    #else
118
-      constexpr bool hasX = false;
119
-    #endif
120
-
121
-    #if M91x_SOME_Y
122
-      const bool hasY = parser.seen(axis_codes.y);
123
-    #else
124
-      constexpr bool hasY = false;
125
-    #endif
126
-
127
-    #if M91x_SOME_Z
128
-      const bool hasZ = parser.seen(axis_codes.z);
129
-    #else
130
-      constexpr bool hasZ = false;
131
-    #endif
132
-
133
-    #if M91x_SOME_E
134
-      const bool hasE = parser.seen(axis_codes.e);
135
-    #else
136
-      constexpr bool hasE = false;
137
-    #endif
124
+    const bool hasX = TERN0(M91x_SOME_X, parser.seen(axis_codes.x)),
125
+               hasY = TERN0(M91x_SOME_Y, parser.seen(axis_codes.y)),
126
+               hasZ = TERN0(M91x_SOME_Z, parser.seen(axis_codes.z)),
127
+               hasE = TERN0(M91x_SOME_E, parser.seen(axis_codes.e));
138 128
 
139
-    const bool hasNone = !hasX && !hasY && !hasZ && !hasE;
129
+    const bool hasNone = !hasE && !hasX && !hasY && !hasZ;
140 130
 
141 131
     #if M91x_SOME_X
142 132
       const int8_t xval = int8_t(parser.byteval(axis_codes.x, 0xFF));

+ 1
- 1
Marlin/src/gcode/gcode.cpp Näytä tiedosto

@@ -140,7 +140,7 @@ int8_t GcodeSuite::get_target_e_stepper_from_command() {
140 140
  *  - Set the feedrate, if included
141 141
  */
142 142
 void GcodeSuite::get_destination_from_command() {
143
-  xyze_bool_t seen = { false, false, false, false };
143
+  xyze_bool_t seen{false};
144 144
 
145 145
   #if ENABLED(CANCEL_OBJECTS)
146 146
     const bool &skip_move = cancelable.skipping;

+ 11
- 11
Marlin/src/gcode/host/M114.cpp Näytä tiedosto

@@ -34,7 +34,7 @@
34 34
     #include "../../core/debug_out.h"
35 35
   #endif
36 36
 
37
-  void report_xyze(const xyze_pos_t &pos, const uint8_t n=XYZE, const uint8_t precision=3) {
37
+  void report_all_axis_pos(const xyze_pos_t &pos, const uint8_t n=XYZE, const uint8_t precision=3) {
38 38
     char str[12];
39 39
     LOOP_L_N(a, n) {
40 40
       SERIAL_CHAR(' ', axis_codes[a], ':');
@@ -43,9 +43,9 @@
43 43
     }
44 44
     SERIAL_EOL();
45 45
   }
46
-  inline void report_xyz(const xyze_pos_t &pos) { report_xyze(pos, XYZ); }
46
+  inline void report_linear_axis_pos(const xyze_pos_t &pos) { report_all_axis_pos(pos, XYZ); }
47 47
 
48
-  void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
48
+  void report_linear_axis_pos(const xyz_pos_t &pos, const uint8_t precision=3) {
49 49
     char str[12];
50 50
     LOOP_XYZ(a) {
51 51
       SERIAL_CHAR(' ', XYZ_CHAR(a), ':');
@@ -57,11 +57,11 @@
57 57
   void report_current_position_detail() {
58 58
     // Position as sent by G-code
59 59
     SERIAL_ECHOPGM("\nLogical:");
60
-    report_xyz(current_position.asLogical());
60
+    report_linear_axis_pos(current_position.asLogical());
61 61
 
62 62
     // Cartesian position in native machine space
63 63
     SERIAL_ECHOPGM("Raw:    ");
64
-    report_xyz(current_position);
64
+    report_linear_axis_pos(current_position);
65 65
 
66 66
     xyze_pos_t leveled = current_position;
67 67
 
@@ -69,20 +69,20 @@
69 69
       // Current position with leveling applied
70 70
       SERIAL_ECHOPGM("Leveled:");
71 71
       planner.apply_leveling(leveled);
72
-      report_xyz(leveled);
72
+      report_linear_axis_pos(leveled);
73 73
 
74 74
       // Test planner un-leveling. This should match the Raw result.
75 75
       SERIAL_ECHOPGM("UnLevel:");
76 76
       xyze_pos_t unleveled = leveled;
77 77
       planner.unapply_leveling(unleveled);
78
-      report_xyz(unleveled);
78
+      report_linear_axis_pos(unleveled);
79 79
     #endif
80 80
 
81 81
     #if IS_KINEMATIC
82 82
       // Kinematics applied to the leveled position
83 83
       SERIAL_ECHOPGM(TERN(IS_SCARA, "ScaraK: ", "DeltaK: "));
84 84
       inverse_kinematics(leveled);  // writes delta[]
85
-      report_xyz(delta);
85
+      report_linear_axis_pos(delta);
86 86
     #endif
87 87
 
88 88
     planner.synchronize();
@@ -165,17 +165,17 @@
165 165
         planner.get_axis_position_degrees(B_AXIS)
166 166
       };
167 167
       SERIAL_ECHOPGM("Degrees:");
168
-      report_xyze(deg, 2);
168
+      report_all_axis_pos(deg, 2);
169 169
     #endif
170 170
 
171 171
     SERIAL_ECHOPGM("FromStp:");
172 172
     get_cartesian_from_steppers();  // writes 'cartes' (with forward kinematics)
173 173
     xyze_pos_t from_steppers = { cartes.x, cartes.y, cartes.z, planner.get_axis_position_mm(E_AXIS) };
174
-    report_xyze(from_steppers);
174
+    report_all_axis_pos(from_steppers);
175 175
 
176 176
     const xyze_float_t diff = from_steppers - leveled;
177 177
     SERIAL_ECHOPGM("Diff:   ");
178
-    report_xyze(diff);
178
+    report_all_axis_pos(diff);
179 179
 
180 180
     TERN_(FULL_REPORT_TO_HOST_FEATURE, report_current_grblstate_moving());
181 181
   }

+ 1
- 1
Marlin/src/gcode/motion/G0_G1.cpp Näytä tiedosto

@@ -83,7 +83,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
83 83
 
84 84
       if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
85 85
         // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
86
-        if (fwretract.autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
86
+        if (fwretract.autoretract_enabled && parser.seen('E') && !parser.seen("XYZ")) {
87 87
           const float echange = destination.e - current_position.e;
88 88
           // Is this a retract or recover move?
89 89
           if (WITHIN(ABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && fwretract.retracted[active_extruder] == (echange > 0.0)) {

+ 4
- 4
Marlin/src/gcode/motion/G2_G3.cpp Näytä tiedosto

@@ -291,12 +291,12 @@ void plan_arc(
291 291
  *    Mixing IJ/JK/KI with R will throw an error.
292 292
  *
293 293
  *  - R specifies the radius. X or Y (Y or Z / Z or X) is required.
294
- *    Omitting both XY/YZ/ZX will throw an error.
295
- *    XY/YZ/ZX must differ from the current XY/YZ/ZX.
296
- *    Mixing R with IJ/JK/KI will throw an error.
294
+ *      Omitting both XY/YZ/ZX will throw an error.
295
+ *      XY/YZ/ZX must differ from the current XY/YZ/ZX.
296
+ *      Mixing R with IJ/JK/KI will throw an error.
297 297
  *
298 298
  *  - P specifies the number of full circles to do
299
- *    before the specified arc move.
299
+ *      before the specified arc move.
300 300
  *
301 301
  *  Examples:
302 302
  *

+ 1
- 1
Marlin/src/gcode/parser.cpp Näytä tiedosto

@@ -222,7 +222,7 @@ void GCodeParser::parse(char *p) {
222 222
 
223 223
       #if ENABLED(GCODE_MOTION_MODES)
224 224
         if (letter == 'G'
225
-          && (codenum <= TERN(ARC_SUPPORT, 3, 1) || codenum == 5 || TERN0(G38_PROBE_TARGET, codenum == 38))
225
+          && (codenum <= TERN(ARC_SUPPORT, 3, 1) || TERN0(BEZIER_CURVE_SUPPORT, codenum == 5) || TERN0(G38_PROBE_TARGET, codenum == 38))
226 226
         ) {
227 227
           motion_mode_codenum = codenum;
228 228
           TERN_(USE_GCODE_SUBCODES, motion_mode_subcode = subcode);

+ 1
- 1
Marlin/src/gcode/parser.h Näytä tiedosto

@@ -226,7 +226,7 @@ public:
226 226
 
227 227
   // Seen any axis parameter
228 228
   static inline bool seen_axis() {
229
-    return seen_test('X') || seen_test('Y') || seen_test('Z') || seen_test('E');
229
+    return seen("XYZE");
230 230
   }
231 231
 
232 232
   #if ENABLED(GCODE_QUOTED_STRINGS)

+ 1
- 1
Marlin/src/inc/Conditionals_post.h Näytä tiedosto

@@ -125,7 +125,7 @@
125 125
   #if EITHER(IS_CORE, MARKFORGED_XY)
126 126
     #define CAN_CALIBRATE(A,B) (_AXIS(A) == B)
127 127
   #else
128
-    #define CAN_CALIBRATE(A,B) 1
128
+    #define CAN_CALIBRATE(A,B) true
129 129
   #endif
130 130
 #endif
131 131
 #define AXIS_CAN_CALIBRATE(A) CAN_CALIBRATE(A,NORMAL_AXIS)

+ 1
- 1
Marlin/src/inc/SanityCheck.h Näytä tiedosto

@@ -3247,7 +3247,7 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
3247 3247
 /**
3248 3248
  * Sanity check for MIXING_EXTRUDER & DISTINCT_E_FACTORS these are not compatible
3249 3249
  */
3250
-#if ENABLED(MIXING_EXTRUDER) && ENABLED(DISTINCT_E_FACTORS)
3250
+#if BOTH(MIXING_EXTRUDER, DISTINCT_E_FACTORS)
3251 3251
   #error "MIXING_EXTRUDER can't be used with DISTINCT_E_FACTORS. But you may use SINGLENOZZLE with DISTINCT_E_FACTORS."
3252 3252
 #endif
3253 3253
 

+ 1
- 0
Marlin/src/lcd/extui/dgus/dgus_extui.cpp Näytä tiedosto

@@ -147,6 +147,7 @@ namespace ExtUI {
147 147
         case PID_DONE:
148 148
           ScreenHandler.setstatusmessagePGM(GET_TEXT(MSG_PID_AUTOTUNE_DONE));
149 149
           break;
150
+        case PID_STARTED: break;
150 151
       }
151 152
       ScreenHandler.GotoScreen(DGUSLCD_SCREEN_MAIN);
152 153
     }

+ 6
- 6
Marlin/src/lcd/extui/ui_api.cpp Näytä tiedosto

@@ -569,7 +569,7 @@ namespace ExtUI {
569 569
   }
570 570
 
571 571
   float getAxisSteps_per_mm(const extruder_t extruder) {
572
-    UNUSED_E(extruder);
572
+    UNUSED(extruder);
573 573
     return planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)];
574 574
   }
575 575
 
@@ -579,7 +579,7 @@ namespace ExtUI {
579 579
   }
580 580
 
581 581
   void setAxisSteps_per_mm(const_float_t value, const extruder_t extruder) {
582
-    UNUSED_E(extruder);
582
+    UNUSED(extruder);
583 583
     planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)] = value;
584 584
     planner.refresh_positioning();
585 585
   }
@@ -589,7 +589,7 @@ namespace ExtUI {
589 589
   }
590 590
 
591 591
   feedRate_t getAxisMaxFeedrate_mm_s(const extruder_t extruder) {
592
-    UNUSED_E(extruder);
592
+    UNUSED(extruder);
593 593
     return planner.settings.max_feedrate_mm_s[E_AXIS_N(extruder - E0)];
594 594
   }
595 595
 
@@ -598,7 +598,7 @@ namespace ExtUI {
598 598
   }
599 599
 
600 600
   void setAxisMaxFeedrate_mm_s(const feedRate_t value, const extruder_t extruder) {
601
-    UNUSED_E(extruder);
601
+    UNUSED(extruder);
602 602
     planner.set_max_feedrate(E_AXIS_N(extruder - E0), value);
603 603
   }
604 604
 
@@ -607,7 +607,7 @@ namespace ExtUI {
607 607
   }
608 608
 
609 609
   float getAxisMaxAcceleration_mm_s2(const extruder_t extruder) {
610
-    UNUSED_E(extruder);
610
+    UNUSED(extruder);
611 611
     return planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(extruder - E0)];
612 612
   }
613 613
 
@@ -616,7 +616,7 @@ namespace ExtUI {
616 616
   }
617 617
 
618 618
   void setAxisMaxAcceleration_mm_s2(const_float_t value, const extruder_t extruder) {
619
-    UNUSED_E(extruder);
619
+    UNUSED(extruder);
620 620
     planner.set_max_acceleration(E_AXIS_N(extruder - E0), value);
621 621
   }
622 622
 

+ 1
- 2
Marlin/src/lcd/menu/menu_mmu2.cpp Näytä tiedosto

@@ -37,8 +37,7 @@ inline void action_mmu2_load_filament_to_nozzle(const uint8_t tool) {
37 37
   ui.reset_status();
38 38
   ui.return_to_status();
39 39
   ui.status_printf_P(0,  GET_TEXT(MSG_MMU2_LOADING_FILAMENT), int(tool + 1));
40
-  if (mmu2.load_filament_to_nozzle(tool))
41
-    ui.reset_status();
40
+  if (mmu2.load_filament_to_nozzle(tool)) ui.reset_status();
42 41
   ui.return_to_status();
43 42
 }
44 43
 

+ 2
- 2
Marlin/src/module/endstops.cpp Näytä tiedosto

@@ -508,7 +508,7 @@ void Endstops::update() {
508 508
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
509 509
   #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT))
510 510
 
511
-  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
511
+  #if BOTH(G38_PROBE_TARGET, HAS_Z_MIN_PROBE_PIN) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
512 512
     // If G38 command is active check Z_MIN_PROBE for ALL movement
513 513
     if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
514 514
   #endif
@@ -747,7 +747,7 @@ void Endstops::update() {
747 747
     #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX)
748 748
   #endif
749 749
 
750
-  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
750
+  #if BOTH(G38_PROBE_TARGET, HAS_Z_MIN_PROBE_PIN) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY)
751 751
     #if ENABLED(G38_PROBE_AWAY)
752 752
       #define _G38_OPEN_STATE (G38_move >= 4)
753 753
     #else

+ 8
- 12
Marlin/src/module/motion.cpp Näytä tiedosto

@@ -83,13 +83,13 @@ bool relative_mode; // = false;
83 83
  *   Used by 'line_to_current_position' to do a move after changing it.
84 84
  *   Used by 'sync_plan_position' to update 'planner.position'.
85 85
  */
86
-xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS,
87
-  #ifdef Z_IDLE_HEIGHT
88
-    Z_IDLE_HEIGHT
89
-  #else
90
-    Z_HOME_POS
91
-  #endif
92
-};
86
+#ifdef Z_IDLE_HEIGHT
87
+  #define Z_INIT_POS Z_IDLE_HEIGHT
88
+#else
89
+  #define Z_INIT_POS Z_HOME_POS
90
+#endif
91
+
92
+xyze_pos_t current_position = { X_HOME_POS, Y_HOME_POS, Z_INIT_POS };
93 93
 
94 94
 /**
95 95
  * Cartesian Destination
@@ -204,11 +204,7 @@ void report_real_position() {
204 204
   get_cartesian_from_steppers();
205 205
   xyze_pos_t npos = cartes;
206 206
   npos.e = planner.get_axis_position_mm(E_AXIS);
207
-
208
-  #if HAS_POSITION_MODIFIERS
209
-    planner.unapply_modifiers(npos, true);
210
-  #endif
211
-
207
+  TERN_(HAS_POSITION_MODIFIERS, planner.unapply_modifiers(npos, true));
212 208
   report_logical_position(npos);
213 209
   report_more_positions();
214 210
 }

+ 2
- 2
Marlin/src/module/settings.cpp Näytä tiedosto

@@ -2584,8 +2584,8 @@ void MarlinSettings::postprocess() {
2584 2584
 void MarlinSettings::reset() {
2585 2585
   LOOP_XYZE_N(i) {
2586 2586
     planner.settings.max_acceleration_mm_per_s2[i] = pgm_read_dword(&_DMA[ALIM(i, _DMA)]);
2587
-    planner.settings.axis_steps_per_mm[i]          = pgm_read_float(&_DASU[ALIM(i, _DASU)]);
2588
-    planner.settings.max_feedrate_mm_s[i]          = pgm_read_float(&_DMF[ALIM(i, _DMF)]);
2587
+    planner.settings.axis_steps_per_mm[i] = pgm_read_float(&_DASU[ALIM(i, _DASU)]);
2588
+    planner.settings.max_feedrate_mm_s[i] = pgm_read_float(&_DMF[ALIM(i, _DMF)]);
2589 2589
   }
2590 2590
 
2591 2591
   planner.settings.min_segment_time_us = DEFAULT_MINSEGMENTTIME;

+ 1
- 1
Marlin/src/module/stepper/trinamic.cpp Näytä tiedosto

@@ -62,7 +62,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
62 62
 #define _TMC_UART_DEFINE(SWHW, IC, ST, AI) TMC_UART_##SWHW##_DEFINE(IC, ST, TMC_##ST##_LABEL, AI)
63 63
 #define TMC_UART_DEFINE(SWHW, ST, AI) _TMC_UART_DEFINE(SWHW, ST##_DRIVER_TYPE, ST, AI##_AXIS)
64 64
 
65
-#if DISTINCT_E > 1
65
+#if ENABLED(DISTINCT_E_FACTORS)
66 66
   #define TMC_SPI_DEFINE_E(AI) TMC_SPI_DEFINE(E##AI, E##AI)
67 67
   #define TMC_UART_DEFINE_E(SWHW, AI) TMC_UART_DEFINE(SWHW, E##AI, E##AI)
68 68
 #else

Loading…
Peruuta
Tallenna