Browse Source

imported last Marlin changes

cocktailyogi 10 years ago
parent
commit
2f4a20257c
9 changed files with 1862 additions and 1647 deletions
  1. 38
    0
      Marlin/Configuration.h
  2. 2
    0
      Marlin/Configuration_adv.h
  3. 3
    3
      Marlin/Marlin.h
  4. 74
    14
      Marlin/Marlin_main.cpp
  5. 26
    0
      Marlin/language.h
  6. 68
    0
      Marlin/temperature.cpp
  7. 11
    0
      Marlin/temperature.h
  8. 1638
    1630
      Marlin/ultralcd.cpp
  9. 2
    0
      Marlin/ultralcd.h

+ 38
- 0
Marlin/Configuration.h View File

257
 #define EXTRUDE_MINTEMP 170
257
 #define EXTRUDE_MINTEMP 170
258
 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
258
 #define EXTRUDE_MAXLENGTH (X_MAX_LENGTH+Y_MAX_LENGTH) //prevent extrusion of very large distances.
259
 
259
 
260
+/*================== Thermal Runaway Protection ==============================
261
+This is a feature to protect your printer from burn up in flames if it has
262
+a thermistor coming off place (this happened to a friend of mine recently and
263
+motivated me writing this feature).
264
+
265
+The issue: If a thermistor come off, it will read a lower temperature than actual.
266
+The system will turn the heater on forever, burning up the filament and anything
267
+else around.
268
+
269
+After the temperature reaches the target for the first time, this feature will 
270
+start measuring for how long the current temperature stays below the target 
271
+minus _HYSTERESIS (set_temperature - THERMAL_RUNAWAY_PROTECTION_HYSTERESIS).
272
+
273
+If it stays longer than _PERIOD, it means the thermistor temperature
274
+cannot catch up with the target, so something *may be* wrong. Then, to be on the
275
+safe side, the system will he halt.
276
+
277
+Bear in mind the count down will just start AFTER the first time the 
278
+thermistor temperature is over the target, so you will have no problem if
279
+your extruder heater takes 2 minutes to hit the target on heating.
280
+
281
+*/
282
+// If you want to enable this feature for all your extruder heaters,
283
+// uncomment the 2 defines below:
284
+
285
+// Parameters for all extruder heaters
286
+//#define THERMAL_RUNAWAY_PROTECTION_PERIOD 40 //in seconds
287
+//#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS 4 // in degree Celsius
288
+
289
+// If you want to enable this feature for your bed heater,
290
+// uncomment the 2 defines below:
291
+
292
+// Parameters for the bed heater
293
+//#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD 20 //in seconds
294
+//#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS 2 // in degree Celsius
295
+//===========================================================================
296
+
297
+
260
 //===========================================================================
298
 //===========================================================================
261
 //=============================Mechanical Settings===========================
299
 //=============================Mechanical Settings===========================
262
 //===========================================================================
300
 //===========================================================================

+ 2
- 0
Marlin/Configuration_adv.h View File

410
 #ifdef FWRETRACT
410
 #ifdef FWRETRACT
411
   #define MIN_RETRACT 0.1                //minimum extruded mm to accept a automatic gcode retraction attempt
411
   #define MIN_RETRACT 0.1                //minimum extruded mm to accept a automatic gcode retraction attempt
412
   #define RETRACT_LENGTH 3               //default retract length (positive mm)
412
   #define RETRACT_LENGTH 3               //default retract length (positive mm)
413
+  #define RETRACT_LENGTH_SWAP 13         //default swap retract length (positive mm), for extruder change
413
   #define RETRACT_FEEDRATE 45            //default feedrate for retracting (mm/s)
414
   #define RETRACT_FEEDRATE 45            //default feedrate for retracting (mm/s)
414
   #define RETRACT_ZLIFT 0                //default retract Z-lift
415
   #define RETRACT_ZLIFT 0                //default retract Z-lift
415
   #define RETRACT_RECOVER_LENGTH 0       //default additional recover length (mm, added to retract length when recovering)
416
   #define RETRACT_RECOVER_LENGTH 0       //default additional recover length (mm, added to retract length when recovering)
417
+  #define RETRACT_RECOVER_LENGTH_SWAP 0  //default additional swap recover length (mm, added to retract length when recovering from extruder change)
416
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
418
   #define RETRACT_RECOVER_FEEDRATE 8     //default feedrate for recovering from retraction (mm/s)
417
 #endif
419
 #endif
418
 
420
 

+ 3
- 3
Marlin/Marlin.h View File

238
 
238
 
239
 #ifdef FWRETRACT
239
 #ifdef FWRETRACT
240
 extern bool autoretract_enabled;
240
 extern bool autoretract_enabled;
241
-extern bool retracted;
242
-extern float retract_length, retract_feedrate, retract_zlift;
243
-extern float retract_recover_length, retract_recover_feedrate;
241
+extern bool retracted[EXTRUDERS];
242
+extern float retract_length, retract_length_swap, retract_feedrate, retract_zlift;
243
+extern float retract_recover_length, retract_recover_length_swap, retract_recover_feedrate;
244
 #endif
244
 #endif
245
 
245
 
246
 extern unsigned long starttime;
246
 extern unsigned long starttime;

+ 74
- 14
Marlin/Marlin_main.cpp View File

254
 
254
 
255
 #ifdef FWRETRACT
255
 #ifdef FWRETRACT
256
   bool autoretract_enabled=false;
256
   bool autoretract_enabled=false;
257
-  bool retracted=false;
257
+  bool retracted[EXTRUDERS]={false
258
+    #if EXTRUDERS > 1
259
+    , false
260
+     #if EXTRUDERS > 2
261
+      , false
262
+     #endif
263
+  #endif
264
+  };
265
+  bool retracted_swap[EXTRUDERS]={false
266
+    #if EXTRUDERS > 1
267
+    , false
268
+     #if EXTRUDERS > 2
269
+      , false
270
+     #endif
271
+  #endif
272
+  };
273
+
258
   float retract_length = RETRACT_LENGTH;
274
   float retract_length = RETRACT_LENGTH;
275
+  float retract_length_swap = RETRACT_LENGTH_SWAP;
259
   float retract_feedrate = RETRACT_FEEDRATE;
276
   float retract_feedrate = RETRACT_FEEDRATE;
260
   float retract_zlift = RETRACT_ZLIFT;
277
   float retract_zlift = RETRACT_ZLIFT;
261
   float retract_recover_length = RETRACT_RECOVER_LENGTH;
278
   float retract_recover_length = RETRACT_RECOVER_LENGTH;
279
+  float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
262
   float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
280
   float retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
263
 #endif
281
 #endif
264
 
282
 
291
 float axis_scaling[3]={1,1,1};  // Build size scaling, default to 1
309
 float axis_scaling[3]={1,1,1};  // Build size scaling, default to 1
292
 #endif				
310
 #endif				
293
 
311
 
312
+bool cancel_heatup = false ;
313
+
294
 //===========================================================================
314
 //===========================================================================
295
 //=============================Private Variables=============================
315
 //=============================Private Variables=============================
296
 //===========================================================================
316
 //===========================================================================
1184
 }
1204
 }
1185
 
1205
 
1186
 #ifdef FWRETRACT
1206
 #ifdef FWRETRACT
1187
-  void retract(bool retracting) {
1188
-    if(retracting && !retracted) {
1207
+  void retract(bool retracting, bool swapretract = false) {
1208
+    if(retracting && !retracted[active_extruder]) {
1189
       destination[X_AXIS]=current_position[X_AXIS];
1209
       destination[X_AXIS]=current_position[X_AXIS];
1190
       destination[Y_AXIS]=current_position[Y_AXIS];
1210
       destination[Y_AXIS]=current_position[Y_AXIS];
1191
       destination[Z_AXIS]=current_position[Z_AXIS];
1211
       destination[Z_AXIS]=current_position[Z_AXIS];
1192
       destination[E_AXIS]=current_position[E_AXIS];
1212
       destination[E_AXIS]=current_position[E_AXIS];
1193
-      current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1213
+      if (swapretract) {
1214
+        current_position[E_AXIS]+=retract_length_swap/volumetric_multiplier[active_extruder];
1215
+      } else {
1216
+        current_position[E_AXIS]+=retract_length/volumetric_multiplier[active_extruder];
1217
+      }
1194
       plan_set_e_position(current_position[E_AXIS]);
1218
       plan_set_e_position(current_position[E_AXIS]);
1195
       float oldFeedrate = feedrate;
1219
       float oldFeedrate = feedrate;
1196
       feedrate=retract_feedrate*60;
1220
       feedrate=retract_feedrate*60;
1197
-      retracted=true;
1221
+      retracted[active_extruder]=true;
1198
       prepare_move();
1222
       prepare_move();
1199
       current_position[Z_AXIS]-=retract_zlift;
1223
       current_position[Z_AXIS]-=retract_zlift;
1200
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1224
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1201
       prepare_move();
1225
       prepare_move();
1202
       feedrate = oldFeedrate;
1226
       feedrate = oldFeedrate;
1203
-    } else if(!retracting && retracted) {
1227
+    } else if(!retracting && retracted[active_extruder]) {
1204
       destination[X_AXIS]=current_position[X_AXIS];
1228
       destination[X_AXIS]=current_position[X_AXIS];
1205
       destination[Y_AXIS]=current_position[Y_AXIS];
1229
       destination[Y_AXIS]=current_position[Y_AXIS];
1206
       destination[Z_AXIS]=current_position[Z_AXIS];
1230
       destination[Z_AXIS]=current_position[Z_AXIS];
1208
       current_position[Z_AXIS]+=retract_zlift;
1232
       current_position[Z_AXIS]+=retract_zlift;
1209
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1233
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1210
       //prepare_move();
1234
       //prepare_move();
1211
-      current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1235
+      if (swapretract) {
1236
+        current_position[E_AXIS]-=(retract_length_swap+retract_recover_length_swap)/volumetric_multiplier[active_extruder]; 
1237
+      } else {
1238
+        current_position[E_AXIS]-=(retract_length+retract_recover_length)/volumetric_multiplier[active_extruder]; 
1239
+      }
1212
       plan_set_e_position(current_position[E_AXIS]);
1240
       plan_set_e_position(current_position[E_AXIS]);
1213
       float oldFeedrate = feedrate;
1241
       float oldFeedrate = feedrate;
1214
       feedrate=retract_recover_feedrate*60;
1242
       feedrate=retract_recover_feedrate*60;
1215
-      retracted=false;
1243
+      retracted[active_extruder]=false;
1216
       prepare_move();
1244
       prepare_move();
1217
       feedrate = oldFeedrate;
1245
       feedrate = oldFeedrate;
1218
     }
1246
     }
1284
       break;
1312
       break;
1285
       #ifdef FWRETRACT
1313
       #ifdef FWRETRACT
1286
       case 10: // G10 retract
1314
       case 10: // G10 retract
1315
+       #if EXTRUDERS > 1
1316
+        retracted_swap[active_extruder]=(code_seen('S') && code_value_long() == 1); // checks for swap retract argument
1317
+        retract(true,retracted_swap[active_extruder]);
1318
+       #else
1287
         retract(true);
1319
         retract(true);
1320
+       #endif
1288
       break;
1321
       break;
1289
       case 11: // G11 retract_recover
1322
       case 11: // G11 retract_recover
1323
+       #if EXTRUDERS > 1
1324
+        retract(false,retracted_swap[active_extruder]);
1325
+       #else
1290
         retract(false);
1326
         retract(false);
1327
+       #endif 
1291
       break;
1328
       break;
1292
       #endif //FWRETRACT
1329
       #endif //FWRETRACT
1293
     case 28: //G28 Home all Axis one at a time
1330
     case 28: //G28 Home all Axis one at a time
2038
 
2075
 
2039
       /* See if we are heating up or cooling down */
2076
       /* See if we are heating up or cooling down */
2040
       target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
2077
       target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
2078
+      
2079
+      cancel_heatup = false;
2041
 
2080
 
2042
       #ifdef TEMP_RESIDENCY_TIME
2081
       #ifdef TEMP_RESIDENCY_TIME
2043
         long residencyStart;
2082
         long residencyStart;
2044
         residencyStart = -1;
2083
         residencyStart = -1;
2045
         /* continue to loop until we have reached the target temp
2084
         /* continue to loop until we have reached the target temp
2046
           _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
2085
           _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */
2047
-        while((residencyStart == -1) ||
2048
-              (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))) ) {
2086
+        while((!cancel_heatup)&&((residencyStart == -1) ||
2087
+              (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) {
2049
       #else
2088
       #else
2050
         while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
2089
         while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) {
2051
       #endif //TEMP_RESIDENCY_TIME
2090
       #endif //TEMP_RESIDENCY_TIME
2101
           CooldownNoWait = false;
2140
           CooldownNoWait = false;
2102
         }
2141
         }
2103
         codenum = millis();
2142
         codenum = millis();
2104
-
2143
+        
2144
+        cancel_heatup = false;
2105
         target_direction = isHeatingBed(); // true if heating, false if cooling
2145
         target_direction = isHeatingBed(); // true if heating, false if cooling
2106
 
2146
 
2107
-        while ( target_direction ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
2147
+        while ( (target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) )
2108
         {
2148
         {
2109
           if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
2149
           if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up.
2110
           {
2150
           {
2514
         int t= code_value() ;
2554
         int t= code_value() ;
2515
         switch(t)
2555
         switch(t)
2516
         {
2556
         {
2517
-          case 0: autoretract_enabled=false;retracted=false;break;
2518
-          case 1: autoretract_enabled=true;retracted=false;break;
2557
+          case 0: 
2558
+          {
2559
+            autoretract_enabled=false;
2560
+            retracted[0]=false;
2561
+            #if EXTRUDERS > 1
2562
+              retracted[1]=false;
2563
+            #endif
2564
+            #if EXTRUDERS > 2
2565
+              retracted[2]=false;
2566
+            #endif
2567
+          }break;
2568
+          case 1: 
2569
+          {
2570
+            autoretract_enabled=true;
2571
+            retracted[0]=false;
2572
+            #if EXTRUDERS > 1
2573
+              retracted[1]=false;
2574
+            #endif
2575
+            #if EXTRUDERS > 2
2576
+              retracted[2]=false;
2577
+            #endif
2578
+          }break;
2519
           default:
2579
           default:
2520
             SERIAL_ECHO_START;
2580
             SERIAL_ECHO_START;
2521
             SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);
2581
             SERIAL_ECHOPGM(MSG_UNKNOWN_COMMAND);

+ 26
- 0
Marlin/language.h View File

171
 	#define MSG_KILLED "KILLED. "
171
 	#define MSG_KILLED "KILLED. "
172
 	#define MSG_STOPPED "STOPPED. "
172
 	#define MSG_STOPPED "STOPPED. "
173
 	#define MSG_CONTROL_RETRACT  "Retract mm"
173
 	#define MSG_CONTROL_RETRACT  "Retract mm"
174
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Re.mm"
174
 	#define MSG_CONTROL_RETRACTF "Retract  V"
175
 	#define MSG_CONTROL_RETRACTF "Retract  V"
175
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
176
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
176
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
177
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
178
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "S UnRet+mm"
177
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
179
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
178
 	#define MSG_AUTORETRACT "AutoRetr."
180
 	#define MSG_AUTORETRACT "AutoRetr."
179
 	#define MSG_FILAMENTCHANGE "Change filament"
181
 	#define MSG_FILAMENTCHANGE "Change filament"
371
 	#define MSG_STOPPED "Zatrzymany. "
373
 	#define MSG_STOPPED "Zatrzymany. "
372
 	#define MSG_STEPPER_RELEASED "Zwolniony."
374
 	#define MSG_STEPPER_RELEASED "Zwolniony."
373
 	#define MSG_CONTROL_RETRACT  "Wycofaj mm"
375
 	#define MSG_CONTROL_RETRACT  "Wycofaj mm"
376
+	#define MSG_CONTROL_RETRACT_SWAP  "Z Wycof. mm"
374
 	#define MSG_CONTROL_RETRACTF "Wycofaj  V"
377
 	#define MSG_CONTROL_RETRACTF "Wycofaj  V"
375
 	#define MSG_CONTROL_RETRACT_ZLIFT "Skok Z mm:"
378
 	#define MSG_CONTROL_RETRACT_ZLIFT "Skok Z mm:"
376
 	#define MSG_CONTROL_RETRACT_RECOVER "Cof. wycof. +mm"
379
 	#define MSG_CONTROL_RETRACT_RECOVER "Cof. wycof. +mm"
380
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Z Cof. wyc. +mm"
377
 	#define MSG_CONTROL_RETRACT_RECOVERF "Cof. wycof.  V"
381
 	#define MSG_CONTROL_RETRACT_RECOVERF "Cof. wycof.  V"
378
 	#define MSG_AUTORETRACT "Auto. wycofanie"
382
 	#define MSG_AUTORETRACT "Auto. wycofanie"
379
 	#define MSG_FILAMENTCHANGE "Zmien filament"
383
 	#define MSG_FILAMENTCHANGE "Zmien filament"
572
 	#define MSG_STOPPED "STOPPE."
576
 	#define MSG_STOPPED "STOPPE."
573
 	#define MSG_STEPPER_RELEASED "RELACHE."
577
 	#define MSG_STEPPER_RELEASED "RELACHE."
574
 	#define MSG_CONTROL_RETRACT "Retraction mm"
578
 	#define MSG_CONTROL_RETRACT "Retraction mm"
579
+	#define MSG_CONTROL_RETRACT_SWAP "Ech. Retr. mm"
575
 	#define MSG_CONTROL_RETRACTF "Retraction V"
580
 	#define MSG_CONTROL_RETRACTF "Retraction V"
576
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
581
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
577
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
582
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
583
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Ech. UnRet +mm"
578
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet V"
584
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet V"
579
 	#define MSG_AUTORETRACT "Retract. Auto."
585
 	#define MSG_AUTORETRACT "Retract. Auto."
580
 	#define MSG_FILAMENTCHANGE "Changer filament"
586
 	#define MSG_FILAMENTCHANGE "Changer filament"
774
 	#define MSG_STOPPED          "GESTOPPT"
780
 	#define MSG_STOPPED          "GESTOPPT"
775
 	#define MSG_STEPPER_RELEASED "Stepper frei"
781
 	#define MSG_STEPPER_RELEASED "Stepper frei"
776
 	#define MSG_CONTROL_RETRACT  "Retract mm"
782
 	#define MSG_CONTROL_RETRACT  "Retract mm"
783
+	#define MSG_CONTROL_RETRACT_SWAP  "Wechs. Retract mm"
777
 	#define MSG_CONTROL_RETRACTF "Retract  V"
784
 	#define MSG_CONTROL_RETRACTF "Retract  V"
778
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
785
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
779
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
786
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
787
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Wechs. UnRet +mm"
780
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
788
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
781
 	#define MSG_AUTORETRACT      "AutoRetr."
789
 	#define MSG_AUTORETRACT      "AutoRetr."
782
 	#define MSG_FILAMENTCHANGE "Filament wechseln"
790
 	#define MSG_FILAMENTCHANGE "Filament wechseln"
972
 	#define MSG_KILLED "PARADA DE EMERG."
980
 	#define MSG_KILLED "PARADA DE EMERG."
973
 	#define MSG_STOPPED "PARADA"
981
 	#define MSG_STOPPED "PARADA"
974
 	#define MSG_CONTROL_RETRACT  "Retraer mm"
982
 	#define MSG_CONTROL_RETRACT  "Retraer mm"
983
+	#define MSG_CONTROL_RETRACT_SWAP  "Interc. Retraer mm"
975
 	#define MSG_CONTROL_RETRACTF "Retraer  V"
984
 	#define MSG_CONTROL_RETRACTF "Retraer  V"
976
 	#define MSG_CONTROL_RETRACT_ZLIFT "Levantar mm"
985
 	#define MSG_CONTROL_RETRACT_ZLIFT "Levantar mm"
977
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
986
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
987
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Interc. DesRet +mm"
978
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet V"
988
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet V"
979
 	#define MSG_AUTORETRACT "AutoRetr."
989
 	#define MSG_AUTORETRACT "AutoRetr."
980
 	#define MSG_FILAMENTCHANGE "Cambiar filamento"
990
 	#define MSG_FILAMENTCHANGE "Cambiar filamento"
1179
 	#define MSG_KILLED							"УБИТО."
1189
 	#define MSG_KILLED							"УБИТО."
1180
 	#define MSG_STOPPED							"ОСТАНОВЛЕНО."
1190
 	#define MSG_STOPPED							"ОСТАНОВЛЕНО."
1181
 	#define MSG_CONTROL_RETRACT					"Откат mm:"
1191
 	#define MSG_CONTROL_RETRACT					"Откат mm:"
1192
+	#define MSG_CONTROL_RETRACT_SWAP				"своп Откат mm:"
1182
 	#define MSG_CONTROL_RETRACTF				"Откат  V:"
1193
 	#define MSG_CONTROL_RETRACTF				"Откат  V:"
1183
 	#define MSG_CONTROL_RETRACT_ZLIFT			"Прыжок mm:"
1194
 	#define MSG_CONTROL_RETRACT_ZLIFT			"Прыжок mm:"
1184
 	#define MSG_CONTROL_RETRACT_RECOVER			"Возврат +mm:"
1195
 	#define MSG_CONTROL_RETRACT_RECOVER			"Возврат +mm:"
1196
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP		"своп Возврат +mm:"
1185
 	#define MSG_CONTROL_RETRACT_RECOVERF		"Возврат  V:"
1197
 	#define MSG_CONTROL_RETRACT_RECOVERF		"Возврат  V:"
1186
 	#define MSG_AUTORETRACT						"АвтоОткат:"
1198
 	#define MSG_AUTORETRACT						"АвтоОткат:"
1187
 	#define MSG_FILAMENTCHANGE 					"Change filament"
1199
 	#define MSG_FILAMENTCHANGE 					"Change filament"
1376
 	#define MSG_KILLED               "UCCISO. "
1388
 	#define MSG_KILLED               "UCCISO. "
1377
 	#define MSG_STOPPED              "ARRESTATO. "
1389
 	#define MSG_STOPPED              "ARRESTATO. "
1378
 	#define MSG_CONTROL_RETRACT      "Ritrai mm"
1390
 	#define MSG_CONTROL_RETRACT      "Ritrai mm"
1391
+	#define MSG_CONTROL_RETRACT_SWAP "Scamb. Ritrai mm"
1379
 	#define MSG_CONTROL_RETRACTF     "Ritrai  V"
1392
 	#define MSG_CONTROL_RETRACTF     "Ritrai  V"
1380
 	#define MSG_CONTROL_RETRACT_ZLIFT "Salta mm"
1393
 	#define MSG_CONTROL_RETRACT_ZLIFT "Salta mm"
1381
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1394
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1395
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Scamb. UnRet +mm"
1382
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
1396
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
1383
 	#define MSG_AUTORETRACT          "AutoArretramento"
1397
 	#define MSG_AUTORETRACT          "AutoArretramento"
1384
 	#define MSG_FILAMENTCHANGE       "Cambia filamento"
1398
 	#define MSG_FILAMENTCHANGE       "Cambia filamento"
1581
 	#define MSG_STOPPED "PARADA. "
1595
 	#define MSG_STOPPED "PARADA. "
1582
 	#define MSG_STEPPER_RELEASED "Lancado."
1596
 	#define MSG_STEPPER_RELEASED "Lancado."
1583
 	#define MSG_CONTROL_RETRACT  " Retrair mm:"
1597
 	#define MSG_CONTROL_RETRACT  " Retrair mm:"
1598
+	#define MSG_CONTROL_RETRACT_SWAP  "Troca Retrair mm:"
1584
 	#define MSG_CONTROL_RETRACTF " Retrair  V:"
1599
 	#define MSG_CONTROL_RETRACTF " Retrair  V:"
1585
 	#define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm:"
1600
 	#define MSG_CONTROL_RETRACT_ZLIFT " Levantar mm:"
1586
 	#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
1601
 	#define MSG_CONTROL_RETRACT_RECOVER " DesRet +mm:"
1602
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Troca DesRet +mm:"
1587
 	#define MSG_CONTROL_RETRACT_RECOVERF " DesRet  V:"
1603
 	#define MSG_CONTROL_RETRACT_RECOVERF " DesRet  V:"
1588
 	#define MSG_AUTORETRACT " AutoRetr.:"
1604
 	#define MSG_AUTORETRACT " AutoRetr.:"
1589
 	#define MSG_FILAMENTCHANGE "Change filament"
1605
 	#define MSG_FILAMENTCHANGE "Change filament"
1781
 	#define MSG_KILLED "KILLED. "
1797
 	#define MSG_KILLED "KILLED. "
1782
 	#define MSG_STOPPED "STOPPED. "
1798
 	#define MSG_STOPPED "STOPPED. "
1783
 	#define MSG_CONTROL_RETRACT  "Veda mm"
1799
 	#define MSG_CONTROL_RETRACT  "Veda mm"
1800
+	#define MSG_CONTROL_RETRACT_SWAP  "Va. Veda mm"
1784
 	#define MSG_CONTROL_RETRACTF "Veda V"
1801
 	#define MSG_CONTROL_RETRACTF "Veda V"
1785
 	#define MSG_CONTROL_RETRACT_ZLIFT "Z mm"
1802
 	#define MSG_CONTROL_RETRACT_ZLIFT "Z mm"
1786
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1803
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
1804
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Va. UnRet +mm"
1787
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
1805
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  V"
1788
 	#define MSG_AUTORETRACT "AutoVeto."
1806
 	#define MSG_AUTORETRACT "AutoVeto."
1789
 	#define MSG_FILAMENTCHANGE "Change filament"
1807
 	#define MSG_FILAMENTCHANGE "Change filament"
1979
 	#define MSG_KILLED "ATURADA D'EMERCH."
1997
 	#define MSG_KILLED "ATURADA D'EMERCH."
1980
 	#define MSG_STOPPED "ATURADA."
1998
 	#define MSG_STOPPED "ATURADA."
1981
 	#define MSG_CONTROL_RETRACT  "Retraer mm"
1999
 	#define MSG_CONTROL_RETRACT  "Retraer mm"
2000
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Retraer mm"
1982
 	#define MSG_CONTROL_RETRACTF "Retraer  F"
2001
 	#define MSG_CONTROL_RETRACTF "Retraer  F"
1983
 	#define MSG_CONTROL_RETRACT_ZLIFT "Devantar mm"
2002
 	#define MSG_CONTROL_RETRACT_ZLIFT "Devantar mm"
1984
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
2003
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
2004
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Swap DesRet +mm"
1985
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet F"
2005
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet F"
1986
 	#define MSG_AUTORETRACT "AutoRetr."
2006
 	#define MSG_AUTORETRACT "AutoRetr."
1987
 	#define MSG_FILAMENTCHANGE "Cambear"
2007
 	#define MSG_FILAMENTCHANGE "Cambear"
2185
 	#define MSG_KILLED "AFGEBROKEN. "
2205
 	#define MSG_KILLED "AFGEBROKEN. "
2186
 	#define MSG_STOPPED "GESTOPT. "
2206
 	#define MSG_STOPPED "GESTOPT. "
2187
 	#define MSG_CONTROL_RETRACT  "Retract mm"
2207
 	#define MSG_CONTROL_RETRACT  "Retract mm"
2208
+	#define MSG_CONTROL_RETRACT_SWAP "Ruil Retract mm"
2188
 	#define MSG_CONTROL_RETRACTF "Retract  F"
2209
 	#define MSG_CONTROL_RETRACTF "Retract  F"
2189
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
2210
 	#define MSG_CONTROL_RETRACT_ZLIFT "Hop mm"
2190
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
2211
 	#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
2212
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Ruil UnRet +mm"
2191
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  F"
2213
 	#define MSG_CONTROL_RETRACT_RECOVERF "UnRet  F"
2192
 	#define MSG_AUTORETRACT "AutoRetr."
2214
 	#define MSG_AUTORETRACT "AutoRetr."
2193
 	#define MSG_FILAMENTCHANGE "Verv. Filament"
2215
 	#define MSG_FILAMENTCHANGE "Verv. Filament"
2384
 	#define MSG_KILLED "PARADA DE EMERG. "
2406
 	#define MSG_KILLED "PARADA DE EMERG. "
2385
 	#define MSG_STOPPED "ATURAT. "
2407
 	#define MSG_STOPPED "ATURAT. "
2386
 	#define MSG_CONTROL_RETRACT  "Retreure mm"
2408
 	#define MSG_CONTROL_RETRACT  "Retreure mm"
2409
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Retreure mm"
2387
 	#define MSG_CONTROL_RETRACTF "Retreure  F"
2410
 	#define MSG_CONTROL_RETRACTF "Retreure  F"
2388
 	#define MSG_CONTROL_RETRACT_ZLIFT "Aixecar mm"
2411
 	#define MSG_CONTROL_RETRACT_ZLIFT "Aixecar mm"
2389
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
2412
 	#define MSG_CONTROL_RETRACT_RECOVER "DesRet +mm"
2413
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Swap DesRet +mm"
2390
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet  F"
2414
 	#define MSG_CONTROL_RETRACT_RECOVERF "DesRet  F"
2391
 	#define MSG_AUTORETRACT "AutoRetr."
2415
 	#define MSG_AUTORETRACT "AutoRetr."
2392
 	#define MSG_FILAMENTCHANGE "Canviar filament"
2416
 	#define MSG_FILAMENTCHANGE "Canviar filament"
2582
 	#define MSG_KILLED "LARRIALDI GELDIA"
2606
 	#define MSG_KILLED "LARRIALDI GELDIA"
2583
 	#define MSG_STOPPED "GELDITUTA. "
2607
 	#define MSG_STOPPED "GELDITUTA. "
2584
 	#define MSG_CONTROL_RETRACT  "Atzera egin mm"
2608
 	#define MSG_CONTROL_RETRACT  "Atzera egin mm"
2609
+	#define MSG_CONTROL_RETRACT_SWAP  "Swap Atzera egin mm"
2585
 	#define MSG_CONTROL_RETRACTF "Atzera egin V"
2610
 	#define MSG_CONTROL_RETRACTF "Atzera egin V"
2586
 	#define MSG_CONTROL_RETRACT_ZLIFT "Igo mm"
2611
 	#define MSG_CONTROL_RETRACT_ZLIFT "Igo mm"
2587
 	#define MSG_CONTROL_RETRACT_RECOVER "Atzera egin +mm"
2612
 	#define MSG_CONTROL_RETRACT_RECOVER "Atzera egin +mm"
2613
+	#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Swap Atzera egin +mm"
2588
 	#define MSG_CONTROL_RETRACT_RECOVERF "Atzera egin V"
2614
 	#define MSG_CONTROL_RETRACT_RECOVERF "Atzera egin V"
2589
 	#define MSG_AUTORETRACT "Atzera egin"
2615
 	#define MSG_AUTORETRACT "Atzera egin"
2590
 	#define MSG_FILAMENTCHANGE "Aldatu filament."
2616
 	#define MSG_FILAMENTCHANGE "Aldatu filament."

+ 68
- 0
Marlin/temperature.cpp View File

416
   for(int e = 0; e < EXTRUDERS; e++) 
416
   for(int e = 0; e < EXTRUDERS; e++) 
417
   {
417
   {
418
 
418
 
419
+  #ifdef THERMAL_RUNAWAY_PROTECTION_PERIOD && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
420
+    thermal_runaway_protection(&thermal_runaway_state_machine[e], &thermal_runaway_timer[e], current_temperature[e], target_temperature[e], e, THERMAL_RUNAWAY_PROTECTION_PERIOD, THERMAL_RUNAWAY_PROTECTION_HYSTERESIS);
421
+  #endif
422
+
419
   #ifdef PIDTEMP
423
   #ifdef PIDTEMP
420
     pid_input = current_temperature[e];
424
     pid_input = current_temperature[e];
421
 
425
 
526
 
530
 
527
   #if TEMP_SENSOR_BED != 0
531
   #if TEMP_SENSOR_BED != 0
528
   
532
   
533
+    #ifdef THERMAL_RUNAWAY_PROTECTION_PERIOD && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
534
+      thermal_runaway_protection(&thermal_runaway_bed_state_machine, &thermal_runaway_bed_timer, current_temperature_bed, target_temperature_bed, 9, THERMAL_RUNAWAY_PROTECTION_BED_PERIOD, THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS);
535
+    #endif
536
+
529
   #ifdef PIDTEMPBED
537
   #ifdef PIDTEMPBED
530
     pid_input = current_temperature_bed;
538
     pid_input = current_temperature_bed;
531
 
539
 
896
 #endif 
904
 #endif 
897
 }
905
 }
898
 
906
 
907
+#ifdef THERMAL_RUNAWAY_PROTECTION_PERIOD && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
908
+void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc)
909
+{
910
+/*
911
+      SERIAL_ECHO_START;
912
+      SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:");
913
+      SERIAL_ECHO(heater_id);
914
+      SERIAL_ECHO(" ;  State:");
915
+      SERIAL_ECHO(*state);
916
+      SERIAL_ECHO(" ;  Timer:");
917
+      SERIAL_ECHO(*timer);
918
+      SERIAL_ECHO(" ;  Temperature:");
919
+      SERIAL_ECHO(temperature);
920
+      SERIAL_ECHO(" ;  Target Temp:");
921
+      SERIAL_ECHO(target_temperature);
922
+      SERIAL_ECHOLN("");    
923
+*/
924
+  if ((target_temperature == 0) || thermal_runaway)
925
+  {
926
+    *state = 0;
927
+    *timer = 0;
928
+    return;
929
+  }
930
+  switch (*state)
931
+  {
932
+    case 0: // "Heater Inactive" state
933
+      if (target_temperature > 0) *state = 1;
934
+      break;
935
+    case 1: // "First Heating" state
936
+      if (temperature >= target_temperature) *state = 2;
937
+      break;
938
+    case 2: // "Temperature Stable" state
939
+      if (temperature >= (target_temperature - hysteresis_degc))
940
+      {
941
+        *timer = millis();
942
+      } 
943
+      else if ( (millis() - *timer) > period_seconds*1000)
944
+      {
945
+        SERIAL_ERROR_START;
946
+        SERIAL_ERRORLNPGM("Thermal Runaway, system stopped! Heater_ID: ");
947
+        SERIAL_ERRORLN((int)heater_id);
948
+        LCD_ALERTMESSAGEPGM("THERMAL RUNAWAY");
949
+        thermal_runaway = true;
950
+        while(1)
951
+        {
952
+          disable_heater();
953
+          disable_x();
954
+          disable_y();
955
+          disable_z();
956
+          disable_e0();
957
+          disable_e1();
958
+          disable_e2();
959
+          manage_heater();
960
+          lcd_update();
961
+        }
962
+      }
963
+      break;
964
+  }
965
+}
966
+#endif
899
 
967
 
900
 void disable_heater()
968
 void disable_heater()
901
 {
969
 {

+ 11
- 0
Marlin/temperature.h View File

154
 void setWatch();
154
 void setWatch();
155
 void updatePID();
155
 void updatePID();
156
 
156
 
157
+#ifdef THERMAL_RUNAWAY_PROTECTION_PERIOD && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
158
+void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
159
+static int thermal_runaway_state_machine[3]; // = {0,0,0};
160
+static unsigned long thermal_runaway_timer[3]; // = {0,0,0};
161
+static bool thermal_runaway = false;
162
+  #if TEMP_SENSOR_BED != 0
163
+    static int thermal_runaway_bed_state_machine;
164
+    static unsigned long thermal_runaway_bed_timer;
165
+  #endif
166
+#endif
167
+
157
 FORCE_INLINE void autotempShutdown(){
168
 FORCE_INLINE void autotempShutdown(){
158
  #ifdef AUTOTEMP
169
  #ifdef AUTOTEMP
159
  if(autotemp_enabled)
170
  if(autotemp_enabled)

+ 1638
- 1630
Marlin/ultralcd.cpp
File diff suppressed because it is too large
View File


+ 2
- 0
Marlin/ultralcd.h View File

42
   extern int absPreheatHotendTemp;
42
   extern int absPreheatHotendTemp;
43
   extern int absPreheatHPBTemp;
43
   extern int absPreheatHPBTemp;
44
   extern int absPreheatFanSpeed;
44
   extern int absPreheatFanSpeed;
45
+  
46
+  extern bool cancel_heatup;
45
     
47
     
46
   void lcd_buzz(long duration,uint16_t freq);
48
   void lcd_buzz(long duration,uint16_t freq);
47
   bool lcd_clicked();
49
   bool lcd_clicked();

Loading…
Cancel
Save