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.

M140_M190.cpp 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. /**
  23. * gcode/temp/M140_M190.cpp
  24. *
  25. * Bed target temperature control
  26. */
  27. #include "../../inc/MarlinConfig.h"
  28. #if HAS_HEATED_BED
  29. #include "../gcode.h"
  30. #include "../../module/temperature.h"
  31. #include "../../module/motion.h"
  32. #include "../../lcd/ultralcd.h"
  33. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  34. #include "../../module/printcounter.h"
  35. #endif
  36. #if ENABLED(PRINTER_EVENT_LEDS)
  37. #include "../../feature/leds/leds.h"
  38. #endif
  39. #include "../../MarlinCore.h" // for wait_for_heatup, idle, startOrResumeJob
  40. /**
  41. * M140: Set bed temperature
  42. */
  43. void GcodeSuite::M140() {
  44. if (DEBUGGING(DRYRUN)) return;
  45. if (parser.seenval('S')) thermalManager.setTargetBed(parser.value_celsius());
  46. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  47. /**
  48. * Stop the timer at the end of print. Both hotend and bed target
  49. * temperatures need to be set below mintemp. Order of M140 and M104
  50. * at the end of the print does not matter.
  51. */
  52. thermalManager.check_timer_autostart(false, true);
  53. #endif
  54. }
  55. /**
  56. * M190: Sxxx Wait for bed current temp to reach target temp. Waits only when heating
  57. * Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
  58. *
  59. * With PRINTJOB_TIMER_AUTOSTART also start the job timer on heating.
  60. */
  61. void GcodeSuite::M190() {
  62. if (DEBUGGING(DRYRUN)) return;
  63. const bool no_wait_for_cooling = parser.seenval('S');
  64. if (no_wait_for_cooling || parser.seenval('R')) {
  65. thermalManager.setTargetBed(parser.value_celsius());
  66. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  67. thermalManager.check_timer_autostart(true, false);
  68. #endif
  69. }
  70. else return;
  71. ui.set_status_P(thermalManager.isHeatingBed() ? GET_TEXT(MSG_BED_HEATING) : GET_TEXT(MSG_BED_COOLING));
  72. thermalManager.wait_for_bed(no_wait_for_cooling);
  73. }
  74. #endif // HAS_HEATED_BED