From 86b4b805d25c004e71733dea7d40099f218ef6b4 Mon Sep 17 00:00:00 2001 From: Pablo Clemente Date: Thu, 12 Jun 2014 18:43:16 +0200 Subject: [PATCH 1/3] Fixed stop print LCD function on M104 --- Marlin/Marlin_main.cpp | 6 ++++-- Marlin/ultralcd.cpp | 3 +++ Marlin/ultralcd.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c4afca7f6..a9a29dde6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1945,14 +1945,16 @@ void process_commands() /* See if we are heating up or cooling down */ target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling + + forced_heating_stop = true; #ifdef TEMP_RESIDENCY_TIME long residencyStart; residencyStart = -1; /* continue to loop until we have reached the target temp _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */ - while((residencyStart == -1) || - (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL))) ) { + while((forced_heating_stop == true)&&((residencyStart == -1) || + (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) { #else while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) { #endif //TEMP_RESIDENCY_TIME diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index f09dd410d..4f5aaac99 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -19,6 +19,7 @@ int absPreheatHotendTemp; int absPreheatHPBTemp; int absPreheatFanSpeed; +boolean forced_heating_stop = true ; #ifdef ULTIPANEL static float manual_feedrate[] = MANUAL_FEEDRATE; @@ -256,6 +257,8 @@ static void lcd_sdcard_stop() enquecommand_P(PSTR(SD_FINISHED_RELEASECOMMAND)); } autotempShutdown(); + + forced_heating_stop = false; } /* Menu implementation */ diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index f4570f6a5..b4195f397 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -42,6 +42,8 @@ extern int absPreheatHotendTemp; extern int absPreheatHPBTemp; extern int absPreheatFanSpeed; + + extern boolean forced_heating_stop; void lcd_buzz(long duration,uint16_t freq); bool lcd_clicked(); From cd3220d055cee14f9feb6f483d992cce80d03a87 Mon Sep 17 00:00:00 2001 From: Pablo Clemente Date: Fri, 13 Jun 2014 08:39:58 +0200 Subject: [PATCH 2/3] Inverted state logic for forced_heating_stop variable --- Marlin/Marlin_main.cpp | 4 ++-- Marlin/ultralcd.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index a9a29dde6..315a9bb48 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1946,14 +1946,14 @@ void process_commands() /* See if we are heating up or cooling down */ target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling - forced_heating_stop = true; + forced_heating_stop = false; #ifdef TEMP_RESIDENCY_TIME long residencyStart; residencyStart = -1; /* continue to loop until we have reached the target temp _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */ - while((forced_heating_stop == true)&&((residencyStart == -1) || + while((forced_heating_stop == false)&&((residencyStart == -1) || (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) { #else while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) { diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 4f5aaac99..289b84e96 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -19,7 +19,7 @@ int absPreheatHotendTemp; int absPreheatHPBTemp; int absPreheatFanSpeed; -boolean forced_heating_stop = true ; +boolean forced_heating_stop = false ; #ifdef ULTIPANEL static float manual_feedrate[] = MANUAL_FEEDRATE; @@ -258,7 +258,7 @@ static void lcd_sdcard_stop() } autotempShutdown(); - forced_heating_stop = false; + forced_heating_stop = true; } /* Menu implementation */ From d86c3cf43c6ee542d2f47db091b04f633c1fcf46 Mon Sep 17 00:00:00 2001 From: Pablo Clemente Date: Mon, 30 Jun 2014 15:12:13 +0200 Subject: [PATCH 3/3] Changed the type of variable to bool, the name to "cancel_heatup", flags implementation and added this fix to M190 gcode too. --- Marlin/Marlin_main.cpp | 9 +++++---- Marlin/ultralcd.cpp | 6 +++--- Marlin/ultralcd.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 315a9bb48..3e4416820 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1946,14 +1946,14 @@ void process_commands() /* See if we are heating up or cooling down */ target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling - forced_heating_stop = false; + cancel_heatup = false; #ifdef TEMP_RESIDENCY_TIME long residencyStart; residencyStart = -1; /* continue to loop until we have reached the target temp _and_ until TEMP_RESIDENCY_TIME hasn't passed since we reached it */ - while((forced_heating_stop == false)&&((residencyStart == -1) || + while((!cancel_heatup)&&((residencyStart == -1) || (residencyStart >= 0 && (((unsigned int) (millis() - residencyStart)) < (TEMP_RESIDENCY_TIME * 1000UL)))) ) { #else while ( target_direction ? (isHeatingHotend(tmp_extruder)) : (isCoolingHotend(tmp_extruder)&&(CooldownNoWait==false)) ) { @@ -2010,10 +2010,11 @@ void process_commands() CooldownNoWait = false; } codenum = millis(); - + + cancel_heatup = false; target_direction = isHeatingBed(); // true if heating, false if cooling - while ( target_direction ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) ) + while ( (target_direction)&&(!cancel_heatup) ? (isHeatingBed()) : (isCoolingBed()&&(CooldownNoWait==false)) ) { if(( millis() - codenum) > 1000 ) //Print Temp Reading every 1 second while heating up. { diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 289b84e96..bb7dd0faa 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -19,7 +19,7 @@ int absPreheatHotendTemp; int absPreheatHPBTemp; int absPreheatFanSpeed; -boolean forced_heating_stop = false ; +bool cancel_heatup = false ; #ifdef ULTIPANEL static float manual_feedrate[] = MANUAL_FEEDRATE; @@ -195,7 +195,7 @@ static void lcd_status_screen() currentMenu = lcd_main_menu; encoderPosition = 0; lcd_quick_feedback(); - lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it. + lcd_implementation_init(); // to maybe revive the LCD if static electricity killed it. } #ifdef ULTIPANEL_FEEDMULTIPLY @@ -258,7 +258,7 @@ static void lcd_sdcard_stop() } autotempShutdown(); - forced_heating_stop = true; + cancel_heatup = true; } /* Menu implementation */ diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index b4195f397..9bf685805 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -43,7 +43,7 @@ extern int absPreheatHPBTemp; extern int absPreheatFanSpeed; - extern boolean forced_heating_stop; + extern bool cancel_heatup; void lcd_buzz(long duration,uint16_t freq); bool lcd_clicked();