Browse Source

Expanded M302 to allow setting the temp

Erik van der Zalm 12 years ago
parent
commit
971ec35135
3 changed files with 16 additions and 11 deletions
  1. 7
    4
      Marlin/Marlin_main.cpp
  2. 6
    6
      Marlin/planner.cpp
  3. 3
    1
      Marlin/planner.h

+ 7
- 4
Marlin/Marlin_main.cpp View File

@@ -128,7 +128,7 @@
128 128
 // M280 - set servo position absolute. P: servo index, S: angle or microseconds
129 129
 // M300 - Play beepsound S<frequency Hz> P<duration ms>
130 130
 // M301 - Set PID parameters P I and D
131
-// M302 - Allow cold extrudes
131
+// M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
132 132
 // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
133 133
 // M304 - Set bed PID parameters P I and D
134 134
 // M400 - Finish all moves
@@ -1625,12 +1625,15 @@ void process_commands()
1625 1625
       #endif
1626 1626
      }
1627 1627
     break;
1628
-
1629
-    case 302: // allow cold extrudes
1628
+    #ifdef PREVENT_DANGEROUS_EXTRUDE
1629
+    case 302: // allow cold extrudes, or set the minimum extrude temperature
1630 1630
     {
1631
-      allow_cold_extrudes(true);
1631
+	  float temp = .0;
1632
+	  if (code_seen('S')) temp=code_value();
1633
+      set_extrude_min_temp(temp);
1632 1634
     }
1633 1635
     break;
1636
+	#endif
1634 1637
     case 303: // M303 PID autotune
1635 1638
     {
1636 1639
       float temp = 150.0;

+ 6
- 6
Marlin/planner.cpp View File

@@ -98,7 +98,7 @@ volatile unsigned char block_buffer_tail;           // Index of the block to pro
98 98
 //=============================private variables ============================
99 99
 //===========================================================================
100 100
 #ifdef PREVENT_DANGEROUS_EXTRUDE
101
-bool allow_cold_extrude=false;
101
+float extrude_min_temp=EXTRUDE_MINTEMP;
102 102
 #endif
103 103
 #ifdef XY_FREQUENCY_LIMIT
104 104
 #define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT)
@@ -537,7 +537,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
537 537
   #ifdef PREVENT_DANGEROUS_EXTRUDE
538 538
   if(target[E_AXIS]!=position[E_AXIS])
539 539
   {
540
-    if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude)
540
+    if(degHotend(active_extruder)<extrude_min_temp)
541 541
     {
542 542
       position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
543 543
       SERIAL_ECHO_START;
@@ -918,12 +918,12 @@ uint8_t movesplanned()
918 918
   return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
919 919
 }
920 920
 
921
-void allow_cold_extrudes(bool allow)
922
-{
923 921
 #ifdef PREVENT_DANGEROUS_EXTRUDE
924
-  allow_cold_extrude=allow;
925
-#endif
922
+void set_extrude_min_temp(float temp)
923
+{
924
+  extrude_min_temp=temp;
926 925
 }
926
+#endif
927 927
 
928 928
 // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
929 929
 void reset_acceleration_rates()

+ 3
- 1
Marlin/planner.h View File

@@ -139,7 +139,9 @@ FORCE_INLINE bool blocks_queued()
139 139
     return true;
140 140
 }
141 141
 
142
-void allow_cold_extrudes(bool allow);
142
+#ifdef PREVENT_DANGEROUS_EXTRUDE
143
+void set_extrude_min_temp(float temp);
144
+#endif
143 145
 
144 146
 void reset_acceleration_rates();
145 147
 #endif

Loading…
Cancel
Save