Browse Source

M109 and M190 now wait when cooling down if R is used instead of S.

M109 S180 waits only when heating.
M109 R180 also waits when cooling.
Erik van der Zalm 11 years ago
parent
commit
c4a2077951
4 changed files with 46 additions and 36 deletions
  1. 6
    6
      Marlin/Configuration.h
  2. 0
    6
      Marlin/Configuration_adv.h
  3. 31
    14
      Marlin/Marlin_main.cpp
  4. 9
    10
      README.md

+ 6
- 6
Marlin/Configuration.h View File

@@ -259,12 +259,12 @@
259 259
 
260 260
 #ifndef ENDSTOPPULLUPS
261 261
   // fine Enstop settings: Individual Pullups. will be ignored if ENDSTOPPULLUPS is defined
262
-  #define ENDSTOPPULLUP_XMAX
263
-  #define ENDSTOPPULLUP_YMAX
264
-  #define ENDSTOPPULLUP_ZMAX
265
-  #define ENDSTOPPULLUP_XMIN
266
-  #define ENDSTOPPULLUP_YMIN
267
-  //#define ENDSTOPPULLUP_ZMIN
262
+  // #define ENDSTOPPULLUP_XMAX
263
+  // #define ENDSTOPPULLUP_YMAX
264
+  // #define ENDSTOPPULLUP_ZMAX
265
+  // #define ENDSTOPPULLUP_XMIN
266
+  // #define ENDSTOPPULLUP_YMIN
267
+  // #define ENDSTOPPULLUP_ZMIN
268 268
 #endif
269 269
 
270 270
 #ifdef ENDSTOPPULLUPS

+ 0
- 6
Marlin/Configuration_adv.h View File

@@ -18,12 +18,6 @@
18 18
 //#define WATCH_TEMP_PERIOD 40000 //40 seconds
19 19
 //#define WATCH_TEMP_INCREASE 10  //Heat up at least 10 degree in 20 seconds
20 20
 
21
-// Wait for Cooldown
22
-// This defines if the M109 call should not block if it is cooling down.
23
-// example: From a current temp of 220, you set M109 S200. 
24
-// if CooldownNoWait is defined M109 will not wait for the cooldown to finish
25
-#define CooldownNoWait true
26
-
27 21
 #ifdef PIDTEMP
28 22
   // this adds an experimental additional term to the heatingpower, proportional to the extrusion speed.
29 23
   // if Kc is choosen well, the additional required power due to increased melting should be compensated.

+ 31
- 14
Marlin/Marlin_main.cpp View File

@@ -67,17 +67,9 @@
67 67
 // G91 - Use Relative Coordinates
68 68
 // G92 - Set current position to cordinates given
69 69
 
70
-//RepRap M Codes
70
+// M Codes
71 71
 // M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
72 72
 // M1   - Same as M0
73
-// M104 - Set extruder target temp
74
-// M105 - Read current temp
75
-// M106 - Fan on
76
-// M107 - Fan off
77
-// M109 - Wait for extruder current temp to reach target temp.
78
-// M114 - Display current position
79
-
80
-//Custom M Codes
81 73
 // M17  - Enable/Power all stepper motors
82 74
 // M18  - Disable all stepper motors; same as M84
83 75
 // M20  - List SD card
@@ -101,6 +93,12 @@
101 93
 //        or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled.  S0 to disable the timeout.
102 94
 // M85  - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
103 95
 // M92  - Set axis_steps_per_unit - same syntax as G92
96
+// M104 - Set extruder target temp
97
+// M105 - Read current temp
98
+// M106 - Fan on
99
+// M107 - Fan off
100
+// M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
101
+//        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
104 102
 // M114 - Output current position to serial port
105 103
 // M115 - Capabilities string
106 104
 // M117 - display message
@@ -110,7 +108,8 @@
110 108
 // M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
111 109
 // M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
112 110
 // M140 - Set bed target temp
113
-// M190 - Wait for bed current temp to reach target temp.
111
+// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
112
+//        Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
114 113
 // M200 - Set filament diameter
115 114
 // M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
116 115
 // M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
@@ -242,6 +241,9 @@ bool Stopped=false;
242 241
   Servo servos[NUM_SERVOS];
243 242
 #endif
244 243
 
244
+bool CooldownNoWait = true;
245
+bool target_direction;
246
+
245 247
 //===========================================================================
246 248
 //=============================ROUTINES=============================
247 249
 //===========================================================================
@@ -1161,7 +1163,13 @@ void process_commands()
1161 1163
       #ifdef AUTOTEMP
1162 1164
         autotemp_enabled=false;
1163 1165
       #endif
1164
-      if (code_seen('S')) setTargetHotend(code_value(), tmp_extruder);
1166
+      if (code_seen('S')) { 
1167
+        setTargetHotend(code_value(), tmp_extruder);
1168
+        CooldownNoWait = true;
1169
+      } else if (code_seen('R')) {
1170
+        setTargetHotend(code_value(), tmp_extruder);
1171
+        CooldownNoWait = false;
1172
+      }
1165 1173
       #ifdef AUTOTEMP
1166 1174
         if (code_seen('S')) autotemp_min=code_value();
1167 1175
         if (code_seen('B')) autotemp_max=code_value();
@@ -1176,7 +1184,7 @@ void process_commands()
1176 1184
       codenum = millis();
1177 1185
 
1178 1186
       /* See if we are heating up or cooling down */
1179
-      bool target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
1187
+      target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
1180 1188
 
1181 1189
       #ifdef TEMP_RESIDENCY_TIME
1182 1190
         long residencyStart;
@@ -1232,9 +1240,18 @@ void process_commands()
1232 1240
     case 190: // M190 - Wait for bed heater to reach target.
1233 1241
     #if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
1234 1242
         LCD_MESSAGEPGM(MSG_BED_HEATING);
1235
-        if (code_seen('S')) setTargetBed(code_value());
1243
+        if (code_seen('S')) { 
1244
+          setTargetBed(code_value());
1245
+          CooldownNoWait = true;
1246
+        } else if (code_seen('R')) {
1247
+          setTargetBed(code_value());
1248
+          CooldownNoWait = false;
1249
+        }
1236 1250
         codenum = millis();
1237
-        while(isHeatingBed())
1251
+        
1252
+        target_direction = isHeatingBed(); // true if heating, false if cooling
1253
+        
1254
+        while ( target_direction ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
1238 1255
         {
1239 1256
           if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
1240 1257
           {

+ 9
- 10
README.md View File

@@ -142,17 +142,9 @@ Implemented G Codes:
142 142
 *  G91 - Use Relative Coordinates
143 143
 *  G92 - Set current position to cordinates given
144 144
 
145
-RepRap M Codes
145
+M Codes
146 146
 *  M0   - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
147 147
 *  M1   - Same as M0
148
-*  M104 - Set extruder target temp
149
-*  M105 - Read current temp
150
-*  M106 - Fan on
151
-*  M107 - Fan off
152
-*  M109 - Wait for extruder current temp to reach target temp.
153
-*  M114 - Display current position
154
-
155
-Custom M Codes
156 148
 *  M17  - Enable/Power all stepper motors
157 149
 *  M18  - Disable all stepper motors; same as M84
158 150
 *  M20  - List SD card
@@ -175,6 +167,12 @@ Custom M Codes
175 167
 *  M84  - Disable steppers until next move, or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled.  S0 to disable the timeout.
176 168
 *  M85  - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
177 169
 *  M92  - Set axis_steps_per_unit - same syntax as G92
170
+*  M104 - Set extruder target temp
171
+*  M105 - Read current temp
172
+*  M106 - Fan on
173
+*  M107 - Fan off
174
+*  M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
175
+*         Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
178 176
 *  M114 - Output current position to serial port
179 177
 *  M115 - Capabilities string
180 178
 *  M117 - display message
@@ -184,7 +182,8 @@ Custom M Codes
184 182
 *  M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
185 183
 *  M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
186 184
 *  M140 - Set bed target temp
187
-*  M190 - Wait for bed current temp to reach target temp.
185
+*  M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
186
+*         Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
188 187
 *  M200 - Set filament diameter
189 188
 *  M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
190 189
 *  M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!

Loading…
Cancel
Save