My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

M425.cpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if ENABLED(BACKLASH_GCODE)
  24. #include "../../feature/backlash.h"
  25. #include "../../module/planner.h"
  26. #include "../gcode.h"
  27. /**
  28. * M425: Enable and tune backlash correction.
  29. *
  30. * F<fraction> Enable/disable/fade-out backlash correction (0.0 to 1.0)
  31. * S<smoothing_mm> Distance over which backlash correction is spread
  32. * X<distance_mm> Set the backlash distance on X (0 to disable)
  33. * Y<distance_mm> ... on Y
  34. * Z<distance_mm> ... on Z
  35. * X If a backlash measurement was done on X, copy that value
  36. * Y ... on Y
  37. * Z ... on Z
  38. *
  39. * Type M425 without any arguments to show active values.
  40. */
  41. void GcodeSuite::M425() {
  42. bool noArgs = true;
  43. LOOP_XYZ(a) {
  44. if (parser.seen(XYZ_CHAR(a))) {
  45. planner.synchronize();
  46. backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
  47. noArgs = false;
  48. }
  49. }
  50. if (parser.seen('F')) {
  51. planner.synchronize();
  52. backlash.set_correction(parser.value_float());
  53. noArgs = false;
  54. }
  55. #ifdef BACKLASH_SMOOTHING_MM
  56. if (parser.seen('S')) {
  57. planner.synchronize();
  58. backlash.smoothing_mm = parser.value_linear_units();
  59. noArgs = false;
  60. }
  61. #endif
  62. if (noArgs) {
  63. SERIAL_ECHOPGM("Backlash Correction ");
  64. if (!backlash.correction) SERIAL_ECHOPGM("in");
  65. SERIAL_ECHOLNPGM("active:");
  66. SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
  67. SERIAL_ECHOPGM(" Backlash Distance (mm): ");
  68. LOOP_XYZ(a) {
  69. SERIAL_CHAR(' ', XYZ_CHAR(a));
  70. SERIAL_ECHO(backlash.distance_mm[a]);
  71. SERIAL_EOL();
  72. }
  73. #ifdef BACKLASH_SMOOTHING_MM
  74. SERIAL_ECHOLNPAIR(" Smoothing (mm): S", backlash.smoothing_mm);
  75. #endif
  76. #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
  77. SERIAL_ECHOPGM(" Average measured backlash (mm):");
  78. if (backlash.has_any_measurement()) {
  79. LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) {
  80. SERIAL_CHAR(' ', XYZ_CHAR(a));
  81. SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
  82. }
  83. }
  84. else
  85. SERIAL_ECHOPGM(" (Not yet measured)");
  86. SERIAL_EOL();
  87. #endif
  88. }
  89. }
  90. #endif // BACKLASH_GCODE