My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

M302.cpp 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if ENABLED(PREVENT_COLD_EXTRUSION)
  24. #include "../gcode.h"
  25. #include "../../module/temperature.h"
  26. /**
  27. * M302: Allow cold extrudes, or set the minimum extrude temperature
  28. *
  29. * S<temperature> sets the minimum extrude temperature
  30. * P<bool> enables (1) or disables (0) cold extrusion
  31. *
  32. * Examples:
  33. *
  34. * M302 ; report current cold extrusion state
  35. * M302 P0 ; enable cold extrusion checking
  36. * M302 P1 ; disable cold extrusion checking
  37. * M302 S0 ; always allow extrusion (disables checking)
  38. * M302 S170 ; only allow extrusion above 170
  39. * M302 S170 P1 ; set min extrude temp to 170 but leave disabled
  40. */
  41. void GcodeSuite::M302() {
  42. const bool seen_S = parser.seen('S');
  43. if (seen_S) {
  44. thermalManager.extrude_min_temp = parser.value_celsius();
  45. thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
  46. }
  47. if (parser.seen('P'))
  48. thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0) || parser.value_bool();
  49. else if (!seen_S) {
  50. // Report current state
  51. SERIAL_ECHO_START();
  52. SERIAL_ECHOPGM("Cold extrudes are ");
  53. SERIAL_ECHOF(thermalManager.allow_cold_extrude ? F("en") : F("dis"));
  54. SERIAL_ECHOLNPGM("abled (min temp ", thermalManager.extrude_min_temp, "C)");
  55. }
  56. }
  57. #endif // PREVENT_COLD_EXTRUSION