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.

M104.cpp 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 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 "../gcode.h"
  23. #include "../../module/temperature.h"
  24. #include "../../module/motion.h"
  25. #include "../../module/planner.h"
  26. #include "../../lcd/ultralcd.h"
  27. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  28. #include "../../module/printcounter.h"
  29. #endif
  30. /**
  31. * M104: Set hot end temperature
  32. */
  33. void GcodeSuite::M104() {
  34. if (get_target_extruder_from_command()) return;
  35. if (DEBUGGING(DRYRUN)) return;
  36. const uint8_t e = target_extruder;
  37. #if ENABLED(SINGLENOZZLE)
  38. if (e != active_extruder) return;
  39. #endif
  40. if (parser.seenval('S')) {
  41. const int16_t temp = parser.value_celsius();
  42. thermalManager.setTargetHotend(temp, e);
  43. #if ENABLED(DUAL_X_CARRIAGE)
  44. if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && e == 0)
  45. thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
  46. #endif
  47. #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
  48. /**
  49. * Stop the timer at the end of print. Start is managed by 'heat and wait' M109.
  50. * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
  51. * standby mode, for instance in a dual extruder setup, without affecting
  52. * the running print timer.
  53. */
  54. if (parser.value_celsius() <= (EXTRUDE_MINTEMP) / 2) {
  55. print_job_timer.stop();
  56. LCD_MESSAGEPGM(WELCOME_MSG);
  57. }
  58. #endif
  59. if (parser.value_celsius() > thermalManager.degHotend(e))
  60. lcd_status_printf_P(0, PSTR("E%i %s"), e + 1, MSG_HEATING);
  61. }
  62. #if ENABLED(AUTOTEMP)
  63. planner.autotemp_M104_M109();
  64. #endif
  65. }