My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

M302.cpp 2.4KB

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