/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #include "../gcode.h" #include "../../module/temperature.h" #include "../../module/motion.h" #include "../../module/planner.h" #include "../../lcd/ultralcd.h" #if ENABLED(PRINTJOB_TIMER_AUTOSTART) #include "../../module/printcounter.h" #endif /** * M104: Set hot end temperature */ void GcodeSuite::M104() { if (get_target_extruder_from_command()) return; if (DEBUGGING(DRYRUN)) return; const uint8_t e = target_extruder; #if ENABLED(SINGLENOZZLE) if (e != active_extruder) return; #endif if (parser.seenval('S')) { const int16_t temp = parser.value_celsius(); thermalManager.setTargetHotend(temp, e); #if ENABLED(DUAL_X_CARRIAGE) if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && e == 0) thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1); #endif #if ENABLED(PRINTJOB_TIMER_AUTOSTART) /** * Stop the timer at the end of print. Start is managed by 'heat and wait' M109. * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot * standby mode, for instance in a dual extruder setup, without affecting * the running print timer. */ if (parser.value_celsius() <= (EXTRUDE_MINTEMP) / 2) { print_job_timer.stop(); LCD_MESSAGEPGM(WELCOME_MSG); } #endif if (parser.value_celsius() > thermalManager.degHotend(e)) lcd_status_printf_P(0, PSTR("E%i %s"), e + 1, MSG_HEATING); } #if ENABLED(AUTOTEMP) planner.autotemp_M104_M109(); #endif }