2017-09-06 06:28:31 -05:00
|
|
|
/**
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-09-07 22:33:16 -05:00
|
|
|
#include "../gcode.h"
|
|
|
|
#include "../../module/temperature.h"
|
2017-09-23 18:09:14 -05:00
|
|
|
#include "../../module/motion.h"
|
2017-09-07 22:33:16 -05:00
|
|
|
#include "../../module/planner.h"
|
|
|
|
#include "../../lcd/ultralcd.h"
|
|
|
|
#include "../../Marlin.h"
|
|
|
|
|
|
|
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
|
|
|
#include "../../module/printcounter.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-05 06:45:36 -05:00
|
|
|
#if ENABLED(PRINTER_EVENT_LEDS)
|
2017-09-08 14:47:47 -05:00
|
|
|
#include "../../feature/leds/leds.h"
|
|
|
|
#endif
|
|
|
|
|
2017-09-23 18:09:14 -05:00
|
|
|
/**
|
|
|
|
* 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)
|
2018-09-17 01:06:22 -05:00
|
|
|
if (dxc_is_duplicating() && e == 0)
|
2017-09-23 18:09:14 -05: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-13 17:18:19 -05:00
|
|
|
if (temp <= (EXTRUDE_MINTEMP) / 2) {
|
2017-09-23 18:09:14 -05:00
|
|
|
print_job_timer.stop();
|
2018-05-13 17:18:19 -05:00
|
|
|
lcd_reset_status();
|
2017-09-23 18:09:14 -05:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(AUTOTEMP)
|
|
|
|
planner.autotemp_M104_M109();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-09-06 06:28:31 -05: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-07 22:33:16 -05:00
|
|
|
void GcodeSuite::M109() {
|
2017-09-06 06:28:31 -05:00
|
|
|
|
2017-09-07 22:33:16 -05:00
|
|
|
if (get_target_extruder_from_command()) return;
|
2017-09-06 06:28:31 -05:00
|
|
|
if (DEBUGGING(DRYRUN)) return;
|
|
|
|
|
|
|
|
#if ENABLED(SINGLENOZZLE)
|
|
|
|
if (target_extruder != active_extruder) return;
|
|
|
|
#endif
|
|
|
|
|
2018-09-29 02:10:51 -05:00
|
|
|
const bool no_wait_for_cooling = parser.seenval('S'),
|
2018-09-29 13:48:23 -05:00
|
|
|
set_temp = no_wait_for_cooling || parser.seenval('R');
|
2018-09-29 02:10:51 -05:00
|
|
|
if (set_temp) {
|
2017-09-06 06:28:31 -05:00
|
|
|
const int16_t temp = parser.value_celsius();
|
|
|
|
thermalManager.setTargetHotend(temp, target_extruder);
|
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
2018-09-17 01:06:22 -05:00
|
|
|
if (dxc_is_duplicating() && target_extruder == 0)
|
2017-09-06 06:28:31 -05: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-05-13 17:18:19 -05:00
|
|
|
lcd_reset_status();
|
2017-09-06 06:28:31 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
print_job_timer.start();
|
|
|
|
#endif
|
|
|
|
|
2018-02-04 00:39:01 -06:00
|
|
|
#if ENABLED(ULTRA_LCD)
|
2018-04-04 18:29:27 -05:00
|
|
|
const bool heating = thermalManager.isHeatingHotend(target_extruder);
|
|
|
|
if (heating || !no_wait_for_cooling)
|
|
|
|
#if HOTENDS > 1
|
|
|
|
lcd_status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), target_extruder + 1);
|
|
|
|
#else
|
|
|
|
lcd_setstatusPGM(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING));
|
|
|
|
#endif
|
2018-02-04 00:39:01 -06:00
|
|
|
#endif
|
2017-09-06 06:28:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(AUTOTEMP)
|
|
|
|
planner.autotemp_M104_M109();
|
|
|
|
#endif
|
|
|
|
|
2018-09-29 02:10:51 -05:00
|
|
|
if (set_temp)
|
|
|
|
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);
|
2017-09-06 06:28:31 -05:00
|
|
|
}
|