From 74d0032e258dd66009a81f4d0e70eaee987be192 Mon Sep 17 00:00:00 2001 From: Bernhard Date: Sat, 26 Nov 2011 09:03:12 +0100 Subject: [PATCH] cooldown blocking selectable by #define. --- Marlin/Configuration.h | 5 +++++ Marlin/Marlin.pde | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index f8bb40e12e..4dea777cf9 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -84,6 +84,11 @@ //#define BED_MAXTEMP 150 +// Wait for Cooldown +// This defines if the M109 call should not block if it is cooling down. +// example: From a current temp of 220, you set M109 S200. +// if CooldownNoWait is defined M109 will not wait for the cooldown to finish +#define CooldownNoWait true // PID settings: // Uncomment the following line to enable PID support. diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde index 381d6aa9b4..60ec2b22e5 100644 --- a/Marlin/Marlin.pde +++ b/Marlin/Marlin.pde @@ -517,7 +517,10 @@ inline void process_commands() codenum = 0; if(code_seen('P')) codenum = code_value(); // milliseconds to wait if(code_seen('S')) codenum = code_value() * 1000; // seconds to wait + + st_synchronize(); codenum += millis(); // keep track of when we started waiting + while(millis() < codenum ){ manage_heater(); } @@ -579,7 +582,7 @@ inline void process_commands() switch( (int)code_value() ) { - case 17: + case 17: LCD_MESSAGEPGM("No move."); enable_x(); enable_y(); @@ -740,7 +743,7 @@ inline void process_commands() while((target_direction ? (isHeatingHotend0()) : (isCoolingHotend0())) || (residencyStart > -1 && (millis() - residencyStart) < TEMP_RESIDENCY_TIME*1000) ) { #else - while ( target_direction ? (isHeatingHotend0()) : (isCoolingHotend0()) ) { + while ( target_direction ? (isHeatingHotend0()) : (isCoolingHotend0()&&(CooldownNoWait==false)) ) { #endif //TEMP_RESIDENCY_TIME if( (millis() - codenum) > 1000 ) { //Print Temp Reading every 1 second while heating up/cooling down