update code base to Marlin 2.0.9.2
This commit is contained in:
136
Marlin/src/gcode/temp/M104_M109.cpp
Executable file → Normal file
136
Marlin/src/gcode/temp/M104_M109.cpp
Executable file → Normal file
@@ -16,7 +16,7 @@
|
||||
* 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/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -28,20 +28,16 @@
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if EXTRUDERS
|
||||
#if HAS_EXTRUDERS
|
||||
|
||||
#include "../gcode.h"
|
||||
#include "../../module/temperature.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../lcd/ultralcd.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
|
||||
#include "../../MarlinCore.h" // for startOrResumeJob, etc.
|
||||
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
#include "../../lcd/anycubic_touchscreen.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
#include "../../module/printcounter.h"
|
||||
#if ENABLED(CANCEL_OBJECTS)
|
||||
@@ -49,14 +45,35 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
||||
#include "../../module/tool_change.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* M104: Set hot end temperature
|
||||
* M104: Set Hotend Temperature target and return immediately
|
||||
* M109: Set Hotend Temperature target and wait
|
||||
*
|
||||
* Parameters
|
||||
* I<preset> : Material Preset index (if material presets are defined)
|
||||
* T<index> : Tool index. If omitted, applies to the active tool
|
||||
* S<target> : The target temperature in current units. For M109, only wait when heating up.
|
||||
*
|
||||
* With AUTOTEMP...
|
||||
* F<factor> : Autotemp Scaling Factor. Set non-zero to enable Auto-temp.
|
||||
* S<min> : Minimum temperature, in current units.
|
||||
* B<max> : Maximum temperature, in current units.
|
||||
*
|
||||
* M109 Parameters
|
||||
* R<target> : The target temperature in current units. Wait for heating and cooling.
|
||||
*
|
||||
* Examples
|
||||
* M104 S100 : Set target to 100° and return.
|
||||
* M109 R150 : Set target to 150°. Wait until the hotend gets close to 150°.
|
||||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
|
||||
* (used by printingIsActive, etc.) and turning off heaters will stop the timer.
|
||||
*/
|
||||
void GcodeSuite::M104() {
|
||||
void GcodeSuite::M104_M109(const bool isM109) {
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
@@ -67,67 +84,35 @@ void GcodeSuite::M104() {
|
||||
if (target_extruder < 0) return;
|
||||
#endif
|
||||
|
||||
if (parser.seenval('S')) {
|
||||
const int16_t temp = parser.value_celsius();
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
singlenozzle_temp[target_extruder] = temp;
|
||||
if (target_extruder != active_extruder) return;
|
||||
#endif
|
||||
thermalManager.setTargetHotend(temp, target_extruder);
|
||||
bool got_temp = false;
|
||||
celsius_t temp = 0;
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (dxc_is_duplicating() && target_extruder == 0)
|
||||
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
|
||||
#endif
|
||||
// Accept 'I' if temperature presets are defined
|
||||
#if PREHEAT_COUNT
|
||||
got_temp = parser.seenval('I');
|
||||
if (got_temp) {
|
||||
const uint8_t index = parser.value_byte();
|
||||
temp = ui.material_preset[_MIN(index, PREHEAT_COUNT - 1)].hotend_temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
||||
/**
|
||||
* Stop the timer at the end of print. Start is managed by 'heat and wait' M109.
|
||||
* Hotends use EXTRUDE_MINTEMP / 2 to allow nozzles to be put into hot standby
|
||||
* mode, for instance in a dual extruder setup, without affecting the running
|
||||
* print timer.
|
||||
*/
|
||||
thermalManager.check_timer_autostart(false, true);
|
||||
#endif
|
||||
// Get the temperature from 'S' or 'R'
|
||||
bool no_wait_for_cooling = false;
|
||||
if (!got_temp) {
|
||||
no_wait_for_cooling = parser.seenval('S');
|
||||
got_temp = no_wait_for_cooling || (isM109 && parser.seenval('R'));
|
||||
if (got_temp) temp = parser.value_celsius();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
planner.autotemp_M104_M109();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* M109: Sxxx Wait for hotend(s) to reach temperature. Waits only when heating.
|
||||
* Rxxx Wait for hotend(s) to reach temperature. Waits when heating and cooling.
|
||||
*
|
||||
* With PRINTJOB_TIMER_AUTOSTART also start the job timer on heating and stop it if turned off.
|
||||
*/
|
||||
void GcodeSuite::M109() {
|
||||
|
||||
if (DEBUGGING(DRYRUN)) return;
|
||||
|
||||
#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
|
||||
|
||||
const bool no_wait_for_cooling = parser.seenval('S'),
|
||||
set_temp = no_wait_for_cooling || parser.seenval('R');
|
||||
if (set_temp) {
|
||||
const int16_t temp = parser.value_celsius();
|
||||
#if ENABLED(SINGLENOZZLE)
|
||||
singlenozzle_temp[target_extruder] = temp;
|
||||
if (got_temp) {
|
||||
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
||||
thermalManager.singlenozzle_temp[target_extruder] = temp;
|
||||
if (target_extruder != active_extruder) return;
|
||||
#endif
|
||||
thermalManager.setTargetHotend(temp, target_extruder);
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
if (dxc_is_duplicating() && target_extruder == 0)
|
||||
if (idex_is_duplicating() && target_extruder == 0)
|
||||
thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
|
||||
#endif
|
||||
|
||||
@@ -137,34 +122,17 @@ void GcodeSuite::M109() {
|
||||
* standby mode, (e.g., in a dual extruder setup) without affecting
|
||||
* the running print timer.
|
||||
*/
|
||||
thermalManager.check_timer_autostart(true, true);
|
||||
thermalManager.auto_job_check_timer(isM109, true);
|
||||
#endif
|
||||
|
||||
#if HAS_DISPLAY
|
||||
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
|
||||
thermalManager.set_heating_message(target_extruder);
|
||||
#endif
|
||||
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
|
||||
thermalManager.set_heating_message(target_extruder);
|
||||
}
|
||||
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
AnycubicTouchscreen.HeatingStart();
|
||||
#endif
|
||||
TERN_(AUTOTEMP, planner.autotemp_M104_M109());
|
||||
|
||||
#if ENABLED(AUTOTEMP)
|
||||
planner.autotemp_M104_M109();
|
||||
#endif
|
||||
|
||||
if (set_temp)
|
||||
if (isM109 && got_temp)
|
||||
(void)thermalManager.wait_for_hotend(target_extruder, no_wait_for_cooling);
|
||||
|
||||
// flush the serial buffer after heating to prevent lockup by m105
|
||||
//SERIAL_FLUSH();
|
||||
|
||||
#ifdef ANYCUBIC_TOUCHSCREEN
|
||||
AnycubicTouchscreen.CommandScan();
|
||||
AnycubicTouchscreen.BedHeatingDone();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // EXTRUDERS
|
||||
|
Reference in New Issue
Block a user