Expanded M302 to allow setting the temp

This commit is contained in:
Erik van der Zalm 2013-06-02 17:36:23 +02:00
parent 4de419e26e
commit 971ec35135
3 changed files with 16 additions and 11 deletions

View file

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

View file

@ -98,7 +98,7 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
//=============================private variables ============================ //=============================private variables ============================
//=========================================================================== //===========================================================================
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
bool allow_cold_extrude=false; float extrude_min_temp=EXTRUDE_MINTEMP;
#endif #endif
#ifdef XY_FREQUENCY_LIMIT #ifdef XY_FREQUENCY_LIMIT
#define MAX_FREQ_TIME (1000000.0/XY_FREQUENCY_LIMIT) #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
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
if(target[E_AXIS]!=position[E_AXIS]) if(target[E_AXIS]!=position[E_AXIS])
{ {
if(degHotend(active_extruder)<EXTRUDE_MINTEMP && !allow_cold_extrude) if(degHotend(active_extruder)<extrude_min_temp)
{ {
position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part position[E_AXIS]=target[E_AXIS]; //behave as if the move really took place, but ignore E part
SERIAL_ECHO_START; SERIAL_ECHO_START;
@ -918,12 +918,12 @@ uint8_t movesplanned()
return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1); return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
} }
void allow_cold_extrudes(bool allow)
{
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
allow_cold_extrude=allow; void set_extrude_min_temp(float temp)
#endif {
extrude_min_temp=temp;
} }
#endif
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates() void reset_acceleration_rates()

View file

@ -139,7 +139,9 @@ FORCE_INLINE bool blocks_queued()
return true; return true;
} }
void allow_cold_extrudes(bool allow); #ifdef PREVENT_DANGEROUS_EXTRUDE
void set_extrude_min_temp(float temp);
#endif
void reset_acceleration_rates(); void reset_acceleration_rates();
#endif #endif