Przeglądaj źródła

Add M207/8/9 reporting (#21335)

Scott Lahteine 3 lat temu
rodzic
commit
7f1fa0d1ff
No account linked to committer's email address

+ 76
- 0
Marlin/src/feature/fwretract.cpp Wyświetl plik

@@ -36,6 +36,8 @@ FWRetract fwretract; // Single instance - this calls the constructor
36 36
 #include "../module/planner.h"
37 37
 #include "../module/stepper.h"
38 38
 
39
+#include "../gcode/parser.h"
40
+
39 41
 #if ENABLED(RETRACT_SYNC_MIXING)
40 42
   #include "mixing.h"
41 43
 #endif
@@ -198,4 +200,78 @@ void FWRetract::retract(const bool retracting
198 200
   //*/
199 201
 }
200 202
 
203
+//extern const char SP_Z_STR[];
204
+
205
+/**
206
+ * M207: Set firmware retraction values
207
+ *
208
+ *   S[+units]    retract_length
209
+ *   W[+units]    swap_retract_length (multi-extruder)
210
+ *   F[units/min] retract_feedrate_mm_s
211
+ *   Z[units]     retract_zraise
212
+ */
213
+void FWRetract::M207() {
214
+  if (!parser.seen("FSWZ")) return M207_report();
215
+  if (parser.seen('S')) settings.retract_length = parser.value_axis_units(E_AXIS);
216
+  if (parser.seen('F')) settings.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
217
+  if (parser.seen('Z')) settings.retract_zraise = parser.value_linear_units();
218
+  if (parser.seen('W')) settings.swap_retract_length = parser.value_axis_units(E_AXIS);
219
+}
220
+
221
+void FWRetract::M207_report(const bool forReplay/*=false*/) {
222
+  if (!forReplay) { SERIAL_ECHO_MSG("; Retract: S<length> F<units/m> Z<lift>"); SERIAL_ECHO_START(); }
223
+  SERIAL_ECHOLNPAIR_P(
224
+      PSTR("  M207 S"), LINEAR_UNIT(settings.retract_length)
225
+    , PSTR(" W"), LINEAR_UNIT(settings.swap_retract_length)
226
+    , PSTR(" F"), LINEAR_UNIT(MMS_TO_MMM(settings.retract_feedrate_mm_s))
227
+    , SP_Z_STR, LINEAR_UNIT(settings.retract_zraise)
228
+  );
229
+}
230
+
231
+/**
232
+ * M208: Set firmware un-retraction values
233
+ *
234
+ *   S[+units]    retract_recover_extra (in addition to M207 S*)
235
+ *   W[+units]    swap_retract_recover_extra (multi-extruder)
236
+ *   F[units/min] retract_recover_feedrate_mm_s
237
+ *   R[units/min] swap_retract_recover_feedrate_mm_s
238
+ */
239
+void FWRetract::M208() {
240
+  if (!parser.seen("FSRW")) return M208_report();
241
+  if (parser.seen('S')) settings.retract_recover_extra = parser.value_axis_units(E_AXIS);
242
+  if (parser.seen('F')) settings.retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
243
+  if (parser.seen('R')) settings.swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
244
+  if (parser.seen('W')) settings.swap_retract_recover_extra = parser.value_axis_units(E_AXIS);
245
+}
246
+
247
+void FWRetract::M208_report(const bool forReplay/*=false*/) {
248
+  if (!forReplay) { SERIAL_ECHO_MSG("; Recover: S<length> F<units/m>"); SERIAL_ECHO_START(); }
249
+  SERIAL_ECHOLNPAIR(
250
+      "  M208 S", LINEAR_UNIT(settings.retract_recover_extra)
251
+    , " W", LINEAR_UNIT(settings.swap_retract_recover_extra)
252
+    , " F", LINEAR_UNIT(MMS_TO_MMM(settings.retract_recover_feedrate_mm_s))
253
+  );
254
+}
255
+
256
+#if ENABLED(FWRETRACT_AUTORETRACT)
257
+
258
+  /**
259
+   * M209: Enable automatic retract (M209 S1)
260
+   *   For slicers that don't support G10/11, reversed extrude-only
261
+   *   moves will be classified as retraction.
262
+   */
263
+  void FWRetract::M209() {
264
+    if (!parser.seen('S')) return M209_report();
265
+    if (MIN_AUTORETRACT <= MAX_AUTORETRACT)
266
+      enable_autoretract(parser.value_bool());
267
+  }
268
+
269
+  void FWRetract::M209_report(const bool forReplay/*=false*/) {
270
+    if (!forReplay) { SERIAL_ECHO_MSG("; Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); SERIAL_ECHO_START(); }
271
+    SERIAL_ECHOLNPAIR("  M209 S", autoretract_enabled);
272
+  }
273
+
274
+#endif // FWRETRACT_AUTORETRACT
275
+
276
+
201 277
 #endif // FWRETRACT

+ 9
- 0
Marlin/src/feature/fwretract.h Wyświetl plik

@@ -79,6 +79,15 @@ public:
79 79
       , bool swapping = false
80 80
     #endif
81 81
   );
82
+
83
+  static void M207();
84
+  static void M207_report(const bool forReplay=false);
85
+  static void M208();
86
+  static void M208_report(const bool forReplay=false);
87
+  #if ENABLED(FWRETRACT_AUTORETRACT)
88
+    static void M209();
89
+    static void M209_report(const bool forReplay=false);
90
+  #endif
82 91
 };
83 92
 
84 93
 extern FWRetract fwretract;

+ 7
- 29
Marlin/src/gcode/feature/fwretract/M207-M209.cpp Wyświetl plik

@@ -29,46 +29,24 @@
29 29
 
30 30
 /**
31 31
  * M207: Set firmware retraction values
32
- *
33
- *   S[+units]    retract_length
34
- *   W[+units]    swap_retract_length (multi-extruder)
35
- *   F[units/min] retract_feedrate_mm_s
36
- *   Z[units]     retract_zraise
37 32
  */
38
-void GcodeSuite::M207() {
39
-  if (parser.seen('S')) fwretract.settings.retract_length = parser.value_axis_units(E_AXIS);
40
-  if (parser.seen('F')) fwretract.settings.retract_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
41
-  if (parser.seen('Z')) fwretract.settings.retract_zraise = parser.value_linear_units();
42
-  if (parser.seen('W')) fwretract.settings.swap_retract_length = parser.value_axis_units(E_AXIS);
43
-}
33
+void GcodeSuite::M207() { fwretract.M207(); }
44 34
 
45 35
 /**
46 36
  * M208: Set firmware un-retraction values
47
- *
48
- *   S[+units]    retract_recover_extra (in addition to M207 S*)
49
- *   W[+units]    swap_retract_recover_extra (multi-extruder)
50
- *   F[units/min] retract_recover_feedrate_mm_s
51
- *   R[units/min] swap_retract_recover_feedrate_mm_s
52 37
  */
53
-void GcodeSuite::M208() {
54
-  if (parser.seen('S')) fwretract.settings.retract_recover_extra = parser.value_axis_units(E_AXIS);
55
-  if (parser.seen('F')) fwretract.settings.retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
56
-  if (parser.seen('R')) fwretract.settings.swap_retract_recover_feedrate_mm_s = MMM_TO_MMS(parser.value_axis_units(E_AXIS));
57
-  if (parser.seen('W')) fwretract.settings.swap_retract_recover_extra = parser.value_axis_units(E_AXIS);
58
-}
38
+void GcodeSuite::M208() { fwretract.M208(); }
59 39
 
60 40
 #if ENABLED(FWRETRACT_AUTORETRACT)
61 41
 
62 42
   /**
63 43
    * M209: Enable automatic retract (M209 S1)
64
-   *   For slicers that don't support G10/11, reversed extrude-only
65
-   *   moves will be classified as retraction.
44
+   *
45
+   *   For slicers that don't support G10/11, reversed
46
+   *   extruder-only moves can be classified as retraction.
66 47
    */
67
-  void GcodeSuite::M209() {
68
-    if (MIN_AUTORETRACT <= MAX_AUTORETRACT && parser.seen('S'))
69
-      fwretract.enable_autoretract(parser.value_bool());
70
-  }
48
+  void GcodeSuite::M209() { fwretract.M209(); }
71 49
 
72
-#endif // FWRETRACT_AUTORETRACT
50
+#endif
73 51
 
74 52
 #endif // FWRETRACT

+ 2
- 2
Marlin/src/gcode/geometry/M206_M428.cpp Wyświetl plik

@@ -30,7 +30,7 @@
30 30
 #include "../../libs/buzzer.h"
31 31
 #include "../../MarlinCore.h"
32 32
 
33
-void m206_report() {
33
+void M206_report() {
34 34
   SERIAL_ECHOLNPAIR_P(PSTR("M206 X"), home_offset.x, SP_Y_STR, home_offset.y, SP_Z_STR, home_offset.z);
35 35
 }
36 36
 
@@ -52,7 +52,7 @@ void GcodeSuite::M206() {
52 52
   #endif
53 53
 
54 54
   if (!parser.seen("XYZ"))
55
-    m206_report();
55
+    M206_report();
56 56
   else
57 57
     report_current_position();
58 58
 }

+ 4
- 23
Marlin/src/module/settings.cpp Wyświetl plik

@@ -3466,29 +3466,10 @@ void MarlinSettings::reset() {
3466 3466
     #endif
3467 3467
 
3468 3468
     #if ENABLED(FWRETRACT)
3469
-
3470
-      CONFIG_ECHO_HEADING("Retract: S<length> F<units/m> Z<lift>");
3471
-      CONFIG_ECHO_START();
3472
-      SERIAL_ECHOLNPAIR_P(
3473
-          PSTR("  M207 S"), LINEAR_UNIT(fwretract.settings.retract_length)
3474
-        , PSTR(" W"), LINEAR_UNIT(fwretract.settings.swap_retract_length)
3475
-        , PSTR(" F"), LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_feedrate_mm_s))
3476
-        , SP_Z_STR, LINEAR_UNIT(fwretract.settings.retract_zraise)
3477
-      );
3478
-
3479
-      CONFIG_ECHO_HEADING("Recover: S<length> F<units/m>");
3480
-      CONFIG_ECHO_MSG(
3481
-          "  M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_extra)
3482
-        , " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_extra)
3483
-        , " F", LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_recover_feedrate_mm_s))
3484
-      );
3485
-
3486
-      #if ENABLED(FWRETRACT_AUTORETRACT)
3487
-        CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover");
3488
-        CONFIG_ECHO_MSG("  M209 S", fwretract.autoretract_enabled);
3489
-      #endif
3490
-
3491
-    #endif // FWRETRACT
3469
+      fwretract.M207_report(forReplay);
3470
+      fwretract.M208_report(forReplay);
3471
+      TERN_(FWRETRACT_AUTORETRACT, fwretract.M209_report(forReplay));
3472
+    #endif
3492 3473
 
3493 3474
     /**
3494 3475
      * Probe Offset

Ładowanie…
Anuluj
Zapisz