Skip to content

Commit

Permalink
clean up wait_for_heatup use
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 31, 2023
1 parent 2b44679 commit 3c03d6e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ volatile bool Temperature::raw_temps_ready = false;
return false;
}

wait_for_heatup = false;
return true;
};

Expand Down Expand Up @@ -992,6 +993,7 @@ volatile bool Temperature::raw_temps_ready = false;
uint16_t sample_distance = 1;
float t1_time = 0;

wait_for_heatup = true;
for (;;) { // Can be interrupted with M108
if (!housekeeping(ms, current_temp, next_report_ms)) return;

Expand Down Expand Up @@ -1048,6 +1050,7 @@ volatile bool Temperature::raw_temps_ready = false;
#endif
float last_temp = current_temp;

wait_for_heatup = true;
for (;;) { // Can be interrupted with M108
if (!housekeeping(ms, current_temp, next_report_ms)) return;

Expand Down Expand Up @@ -4127,6 +4130,7 @@ void Temperature::isr() {

} while (wait_for_heatup && TEMP_CONDITIONS);

// If wait_for_heatup is set, temperature was reached, no cancel
if (wait_for_heatup) {
wait_for_heatup = false;
#if HAS_DWIN_E3V2_BASIC
Expand Down Expand Up @@ -4265,6 +4269,7 @@ void Temperature::isr() {

} while (wait_for_heatup && TEMP_BED_CONDITIONS);

// If wait_for_heatup is set, temperature was reached, no cancel
if (wait_for_heatup) {
wait_for_heatup = false;
ui.reset_status();
Expand Down Expand Up @@ -4343,6 +4348,7 @@ void Temperature::isr() {
}
}

// If wait_for_heatup is set, temperature was reached, no cancel
if (wait_for_heatup) {
wait_for_heatup = false;
ui.reset_status();
Expand Down Expand Up @@ -4442,6 +4448,7 @@ void Temperature::isr() {
}
} while (wait_for_heatup && TEMP_CHAMBER_CONDITIONS);

// If wait_for_heatup is set, temperature was reached, no cancel
if (wait_for_heatup) {
wait_for_heatup = false;
ui.reset_status();
Expand Down Expand Up @@ -4528,6 +4535,7 @@ void Temperature::isr() {
first_loop = false;
#endif // TEMP_COOLER_RESIDENCY_TIME > 0

// Prevent a wait-forever situation if R is misused i.e. M191 R0
if (wants_to_cool) {
// Break after MIN_COOLING_SLOPE_TIME_CHAMBER seconds
// if the temperature did not drop at least MIN_COOLING_SLOPE_DEG_CHAMBER
Expand All @@ -4540,7 +4548,7 @@ void Temperature::isr() {

} while (wait_for_heatup && TEMP_COOLER_CONDITIONS);

// Prevent a wait-forever situation if R is misused i.e. M191 R0
// If wait_for_heatup is set, temperature was reached, no cancel
if (wait_for_heatup) {
wait_for_heatup = false;
ui.reset_status();
Expand Down

0 comments on commit 3c03d6e

Please sign in to comment.