Browse Source

Expanded M302 to allow setting the temp

pull/1/head
Erik van der Zalm 11 years ago
parent
commit
971ec35135
  1. 11
      Marlin/Marlin_main.cpp
  2. 12
      Marlin/planner.cpp
  3. 4
      Marlin/planner.h

11
Marlin/Marlin_main.cpp

@ -128,7 +128,7 @@
// M280 - set servo position absolute. P: servo index, S: angle or microseconds
// M300 - Play beepsound S<frequency Hz> P<duration ms>
// 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)
// M304 - Set bed PID parameters P I and D
// M400 - Finish all moves
@ -1625,12 +1625,15 @@ void process_commands()
#endif
}
break;
case 302: // allow cold extrudes
#ifdef PREVENT_DANGEROUS_EXTRUDE
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;
#endif
case 303: // M303 PID autotune
{
float temp = 150.0;

12
Marlin/planner.cpp

@ -98,7 +98,7 @@ volatile unsigned char block_buffer_tail; // Index of the block to pro
//=============================private variables ============================
//===========================================================================
#ifdef PREVENT_DANGEROUS_EXTRUDE
bool allow_cold_extrude=false;
float extrude_min_temp=EXTRUDE_MINTEMP;
#endif
#ifdef 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
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
SERIAL_ECHO_START;
@ -918,12 +918,12 @@ uint8_t movesplanned()
return (block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1);
}
void allow_cold_extrudes(bool allow)
{
#ifdef PREVENT_DANGEROUS_EXTRUDE
allow_cold_extrude=allow;
#endif
void set_extrude_min_temp(float temp)
{
extrude_min_temp=temp;
}
#endif
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates()

4
Marlin/planner.h

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

Loading…
Cancel
Save