From 971ec3513575d32d56b684a71be5739139d5e743 Mon Sep 17 00:00:00 2001 From: Erik van der Zalm Date: Sun, 2 Jun 2013 17:36:23 +0200 Subject: [PATCH] Expanded M302 to allow setting the temp --- Marlin/Marlin_main.cpp | 11 +++++++---- Marlin/planner.cpp | 12 ++++++------ Marlin/planner.h | 4 +++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 47202aff82..2e301424c6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -128,7 +128,7 @@ // M280 - set servo position absolute. P: servo index, S: angle or microseconds // M300 - Play beepsound S P // M301 - Set PID parameters P I and D -// M302 - Allow cold extrudes +// M302 - Allow cold extrudes, or set the minimum extrude S. // M303 - PID relay autotune S 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; diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp index 64935c88d0..fcebab938a 100644 --- a/Marlin/planner.cpp +++ b/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)