Skip to content

Commit

Permalink
Reduce 'first loop' temperature residency time (#18421)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
espr14 and thinkyhead authored Jul 6, 2020
1 parent 378b568 commit ea8c3a9
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3100,9 +3100,7 @@ void Temperature::tick() {
if (!residency_start_ms) {
// Start the TEMP_RESIDENCY_TIME timer when we reach target temp for the first time.
if (temp_diff < TEMP_WINDOW) {
residency_start_ms = now;
if (first_loop) residency_start_ms += SEC_TO_MS(TEMP_RESIDENCY_TIME);
}
residency_start_ms = now + (first_loop ? SEC_TO_MS(TEMP_RESIDENCY_TIME) / 3 : 0);
}
else if (temp_diff > TEMP_HYSTERESIS) {
// Restart the timer whenever the temperature falls outside the hysteresis.
Expand Down Expand Up @@ -3227,10 +3225,8 @@ void Temperature::tick() {

if (!residency_start_ms) {
// Start the TEMP_BED_RESIDENCY_TIME timer when we reach target temp for the first time.
if (temp_diff < TEMP_BED_WINDOW) {
residency_start_ms = now;
if (first_loop) residency_start_ms += SEC_TO_MS(TEMP_BED_RESIDENCY_TIME);
}
if (temp_diff < TEMP_BED_WINDOW)
residency_start_ms = now + (first_loop ? SEC_TO_MS(TEMP_BED_RESIDENCY_TIME) / 3 : 0);
}
else if (temp_diff > TEMP_BED_HYSTERESIS) {
// Restart the timer whenever the temperature falls outside the hysteresis.
Expand Down Expand Up @@ -3319,7 +3315,7 @@ void Temperature::tick() {
}

now = millis();
if (ELAPSED(now, next_temp_ms)) { //Print Temp Reading every 1 second while heating up.
if (ELAPSED(now, next_temp_ms)) { // Print Temp Reading every 1 second while heating up.
next_temp_ms = now + 1000UL;
print_heater_states(active_extruder);
#if TEMP_CHAMBER_RESIDENCY_TIME > 0
Expand All @@ -3343,10 +3339,8 @@ void Temperature::tick() {

if (!residency_start_ms) {
// Start the TEMP_CHAMBER_RESIDENCY_TIME timer when we reach target temp for the first time.
if (temp_diff < TEMP_CHAMBER_WINDOW) {
residency_start_ms = now;
if (first_loop) residency_start_ms += SEC_TO_MS(TEMP_CHAMBER_RESIDENCY_TIME);
}
if (temp_diff < TEMP_CHAMBER_WINDOW)
residency_start_ms = now + (first_loop ? SEC_TO_MS(TEMP_CHAMBER_RESIDENCY_TIME) / 3 : 0);
}
else if (temp_diff > TEMP_CHAMBER_HYSTERESIS) {
// Restart the timer whenever the temperature falls outside the hysteresis.
Expand Down

1 comment on commit ea8c3a9

@CRCinAU
Copy link
Contributor

@CRCinAU CRCinAU commented on ea8c3a9 Jul 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has a syntax error:

Marlin/src/module/temperature.cpp: In static member function 'static bool Temperature::wait_for_hotend(uint8_t, bool)':
Marlin/src/module/temperature.cpp:3159:10: error: expected 'while' before 'Temperature'
     bool Temperature::wait_for_bed(const bool no_wait_for_cooling/*=true*/
          ^~~~~~~~~~~
Marlin/src/module/temperature.cpp:3159:10: error: expected '(' before 'Temperature'
Marlin/src/module/temperature.cpp:3159:36: error: expected primary-expression before 'const'
     bool Temperature::wait_for_bed(const bool no_wait_for_cooling/*=true*/
                                    ^~~~~
Marlin/src/module/temperature.cpp:3163:7: error: expected ')' before '{' token
     ) {
       ^
Marlin/src/module/temperature.cpp:3163:7: error: expected ';' before '{' token

Right this second though, I can't spot it....

Please sign in to comment.