51
51
52
52
/* *
53
53
* M104: Set Hotend Temperature target and return immediately
54
- *
55
- * Parameters:
56
- * I<preset> : Material Preset index (if material presets are defined)
57
- * T<index> : Tool index. If omitted, applies to the active tool
58
- * S<target> : The target temperature in current units
59
- */
60
- void GcodeSuite::M104 () {
61
-
62
- if (DEBUGGING (DRYRUN)) return ;
63
-
64
- #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
65
- constexpr int8_t target_extruder = 0 ;
66
- #else
67
- const int8_t target_extruder = get_target_extruder_from_command ();
68
- if (target_extruder < 0 ) return ;
69
- #endif
70
-
71
- bool got_temp = false ;
72
- celsius_t temp = 0 ;
73
-
74
- // Accept 'I' if temperature presets are defined
75
- #if PREHEAT_COUNT
76
- got_temp = parser.seenval (' I' );
77
- if (got_temp) {
78
- const uint8_t index = parser.value_byte ();
79
- temp = ui.material_preset [_MIN (index , PREHEAT_COUNT - 1 )].hotend_temp ;
80
- }
81
- #endif
82
-
83
- // If no 'I' get the temperature from 'S'
84
- if (!got_temp) {
85
- got_temp = parser.seenval (' S' );
86
- if (got_temp) temp = parser.value_celsius ();
87
- }
88
-
89
- if (got_temp) {
90
- #if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
91
- thermalManager.singlenozzle_temp [target_extruder] = temp;
92
- if (target_extruder != active_extruder) return ;
93
- #endif
94
- thermalManager.setTargetHotend (temp, target_extruder);
95
-
96
- #if ENABLED(DUAL_X_CARRIAGE)
97
- if (idex_is_duplicating () && target_extruder == 0 )
98
- thermalManager.setTargetHotend (temp ? temp + duplicate_extruder_temp_offset : 0 , 1 );
99
- #endif
100
-
101
- #if ENABLED(PRINTJOB_TIMER_AUTOSTART)
102
- /* *
103
- * Stop the timer at the end of print. Start is managed by 'heat and wait' M109.
104
- * Hotends use EXTRUDE_MINTEMP / 2 to allow nozzles to be put into hot standby
105
- * mode, for instance in a dual extruder setup, without affecting the running
106
- * print timer.
107
- */
108
- thermalManager.auto_job_check_timer (false , true );
109
- #endif
110
- }
111
-
112
- TERN_ (AUTOTEMP, planner.autotemp_M104_M109 ());
113
- }
114
-
115
- /* *
116
54
* M109: Set Hotend Temperature target and wait
117
55
*
118
56
* Parameters
119
57
* I<preset> : Material Preset index (if material presets are defined)
120
58
* T<index> : Tool index. If omitted, applies to the active tool
121
- * S<target> : The target temperature in current units. Wait for heating only.
122
- * R<target> : The target temperature in current units. Wait for heating and cooling.
59
+ * S<target> : The target temperature in current units. For M109, only wait when heating up.
123
60
*
124
61
* With AUTOTEMP...
125
62
* F<factor> : Autotemp Scaling Factor. Set non-zero to enable Auto-temp.
126
63
* S<min> : Minimum temperature, in current units.
127
64
* B<max> : Maximum temperature, in current units.
128
65
*
66
+ * M109 Parameters
67
+ * R<target> : The target temperature in current units. Wait for heating and cooling.
68
+ *
129
69
* Examples
130
- * M109 S100 : Set target to 100°. Wait until the hotend is at or above 100° .
70
+ * M104 S100 : Set target to 100° and return .
131
71
* M109 R150 : Set target to 150°. Wait until the hotend gets close to 150°.
132
72
*
133
73
* With PRINTJOB_TIMER_AUTOSTART turning on heaters will start the print job timer
134
74
* (used by printingIsActive, etc.) and turning off heaters will stop the timer.
135
75
*/
136
- void GcodeSuite::M109 ( ) {
76
+ void GcodeSuite::M104_M109 ( const bool isM109 ) {
137
77
138
78
if (DEBUGGING (DRYRUN)) return ;
139
79
@@ -160,7 +100,7 @@ void GcodeSuite::M109() {
160
100
bool no_wait_for_cooling = false ;
161
101
if (!got_temp) {
162
102
no_wait_for_cooling = parser.seenval (' S' );
163
- got_temp = no_wait_for_cooling || parser.seenval (' R' );
103
+ got_temp = no_wait_for_cooling || (isM109 && parser.seenval (' R' ) );
164
104
if (got_temp) temp = parser.value_celsius ();
165
105
}
166
106
@@ -182,7 +122,7 @@ void GcodeSuite::M109() {
182
122
* standby mode, (e.g., in a dual extruder setup) without affecting
183
123
* the running print timer.
184
124
*/
185
- thermalManager.auto_job_check_timer (true , true );
125
+ thermalManager.auto_job_check_timer (isM109 , true );
186
126
#endif
187
127
188
128
#if HAS_STATUS_MESSAGE
@@ -193,7 +133,7 @@ void GcodeSuite::M109() {
193
133
194
134
TERN_ (AUTOTEMP, planner.autotemp_M104_M109 ());
195
135
196
- if (got_temp)
136
+ if (isM109 && got_temp)
197
137
(void )thermalManager.wait_for_hotend (target_extruder, no_wait_for_cooling);
198
138
}
199
139
0 commit comments