2017-09-06 13:28:31 +02:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2017-09-06 13:28:31 +02:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 06:57:50 +02:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2017-09-06 13:28:31 +02:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-08 05:33:16 +02:00
|
|
|
#include "../gcode.h"
|
|
|
|
#include "../../module/temperature.h"
|
2017-09-24 01:09:14 +02:00
|
|
|
#include "../../module/motion.h"
|
2017-09-08 05:33:16 +02:00
|
|
|
#include "../../module/planner.h"
|
|
|
|
#include "../../lcd/ultralcd.h"
|
|
|
|
#include "../../Marlin.h"
|
|
|
|
|
|
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
|
|
|
#include "../../module/printcounter.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-08 00:06:14 +02:00
|
|
|
#if ENABLED(SINGLENOZZLE)
|
|
|
|
#include "../../module/tool_change.h"
|
|
|
|
#endif
|
|
|
|
|
2017-09-24 01:09:14 +02:00
|
|
|
/**
|
|
|
|
* M104: Set hot end temperature
|
|
|
|
*/
|
|
|
|
void GcodeSuite::M104() {
|
2018-11-15 00:33:04 +01:00
|
|
|
|
2017-09-24 01:09:14 +02:00
|
|
|
if (DEBUGGING(DRYRUN)) return;
|
|
|
|
|
2018-11-15 00:33:04 +01:00
|
|
|
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
|
2018-11-17 13:55:25 +01:00
|
|
|
constexpr int8_t target_extruder = 0;
|
2018-11-15 00:33:04 +01:00
|
|
|
#else
|
2018-11-17 13:55:25 +01:00
|
|
|
const int8_t target_extruder = get_target_extruder_from_command();
|
|
|
|
if (target_extruder < 0) return;
|
2018-11-15 00:33:04 +01:00
|
|
|
#endif
|
2017-09-24 01:09:14 +02:00
|
|
|
|
|
|
|
if (parser.seenval('S')) {
|
|
|
|
const int16_t temp = parser.value_celsius();
|
2018-10-08 00:06:14 +02:00
|
|
|
#if ENABLED(SINGLENOZZLE)
|
2018-11-17 13:55:25 +01:00
|
|
|
singlenozzle_temp[target_extruder] = temp;
|
|
|
|
if (target_extruder != active_extruder) return;
|
2018-10-08 00:06:14 +02:00
|
|
|
#endif
|
2018-11-17 13:55:25 +01:00
|
|
|
thermalManager.setTargetHotend(temp, target_extruder);
|
2017-09-24 01:09:14 +02:00
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2018-11-17 13:55:25 +01:00
|
|
|
if (dxc_is_duplicating() && target_extruder == 0)
|
2017-09-24 01:09:14 +02:00
|
|
|
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.
|
|
|
|
*/
|
2018-05-14 00:18:19 +02:00
|
|
|
if (temp <= (EXTRUDE_MINTEMP) / 2) {
|
2017-09-24 01:09:14 +02:00
|
|
|
print_job_timer.stop();
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.reset_status();
|
2017-09-24 01:09:14 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(AUTOTEMP)
|
|
|
|
planner.autotemp_M104_M109();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-09-06 13:28:31 +02:00
|
|
|
/**
|
|
|
|
* M109: Sxxx Wait for extruder(s) to reach temperature. Waits only when heating.
|
|
|
|
* Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
|
|
|
|
*/
|
2017-09-08 05:33:16 +02:00
|
|
|
void GcodeSuite::M109() {
|
2017-09-06 13:28:31 +02:00
|
|
|
|
|
|
|
if (DEBUGGING(DRYRUN)) return;
|
|
|
|
|
2018-11-15 00:33:04 +01:00
|
|
|
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
|
|
|
|
constexpr int8_t target_extruder = 0;
|
|
|
|
#else
|
|
|
|
const int8_t target_extruder = get_target_extruder_from_command();
|
|
|
|
if (target_extruder < 0) return;
|
|
|
|
#endif
|
|
|
|
|
2018-09-29 09:10:51 +02:00
|
|
|
const bool no_wait_for_cooling = parser.seenval('S'),
|
2018-09-29 20:48:23 +02:00
|
|
|
set_temp = no_wait_for_cooling || parser.seenval('R');
|
2018-09-29 09:10:51 +02:00
|
|
|
if (set_temp) {
|
2017-09-06 13:28:31 +02:00
|
|
|
const int16_t temp = parser.value_celsius();
|
2018-10-08 00:06:14 +02:00
|
|
|
#if ENABLED(SINGLENOZZLE)
|
|
|
|
singlenozzle_temp[target_extruder] = temp;
|
|
|
|
if (target_extruder != active_extruder) return;
|
|
|
|
#endif
|
2017-09-06 13:28:31 +02:00
|
|
|
thermalManager.setTargetHotend(temp, target_extruder);
|
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2018-09-17 08:06:22 +02:00
|
|
|
if (dxc_is_duplicating() && target_extruder == 0)
|
2017-09-06 13:28:31 +02:00
|
|
|
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
|
|
|
/**
|
|
|
|
* Use half EXTRUDE_MINTEMP to allow nozzles to be put into hot
|
|
|
|
* standby mode, (e.g., in a dual extruder setup) without affecting
|
|
|
|
* the running print timer.
|
|
|
|
*/
|
|
|
|
if (parser.value_celsius() <= (EXTRUDE_MINTEMP) / 2) {
|
|
|
|
print_job_timer.stop();
|
2018-11-11 19:16:24 +01:00
|
|
|
ui.reset_status();
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
print_job_timer.start();
|
|
|
|
#endif
|
|
|
|
|
2019-07-17 10:12:39 +02:00
|
|
|
#if HAS_DISPLAY
|
2018-10-08 00:06:14 +02:00
|
|
|
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
|
|
|
|
thermalManager.set_heating_message(target_extruder);
|
2018-02-04 07:39:01 +01:00
|
|
|
#endif
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(AUTOTEMP)
|
|
|
|
planner.autotemp_M104_M109();
|
|
|
|
#endif
|
|
|
|
|
2018-09-29 09:10:51 +02:00
|
|
|
if (set_temp)
|
|
|
|
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);
|
2017-09-06 13:28:31 +02:00
|
|
|
}
|