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.

M141_M191.cpp 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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 HAS_HEATED_CHAMBER
  24. #include "../gcode.h"
  25. #include "../../module/temperature.h"
  26. #include "../../module/motion.h"
  27. #include "../../lcd/ultralcd.h"
  28. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  29. #include "../../module/printcounter.h"
  30. #endif
  31. #if ENABLED(PRINTER_EVENT_LEDS)
  32. #include "../../feature/leds/leds.h"
  33. #endif
  34. #include "../../MarlinCore.h" // for wait_for_heatup, idle, startOrResumeJob
  35. /**
  36. * M141: Set chamber temperature
  37. */
  38. void GcodeSuite::M141() {
  39. if (DEBUGGING(DRYRUN)) return;
  40. if (parser.seenval('S')) thermalManager.setTargetChamber(parser.value_celsius());
  41. }
  42. /**
  43. * M191: Sxxx Wait for chamber current temp to reach target temp. Waits only when heating
  44. * Rxxx Wait for chamber current temp to reach target temp. Waits when heating and cooling
  45. */
  46. void GcodeSuite::M191() {
  47. if (DEBUGGING(DRYRUN)) return;
  48. const bool no_wait_for_cooling = parser.seenval('S');
  49. if (no_wait_for_cooling || parser.seenval('R')) {
  50. thermalManager.setTargetChamber(parser.value_celsius());
  51. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  52. if (parser.value_celsius() > CHAMBER_MINTEMP)
  53. startOrResumeJob();
  54. #endif
  55. }
  56. else return;
  57. const bool is_heating = thermalManager.isHeatingChamber();
  58. if (is_heating || !no_wait_for_cooling) {
  59. ui.set_status_P(is_heating ? GET_TEXT(MSG_CHAMBER_HEATING) : GET_TEXT(MSG_CHAMBER_COOLING));
  60. thermalManager.wait_for_chamber(false);
  61. }
  62. }
  63. #endif // HAS_HEATED_CHAMBER