diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 2edd448dc1..d51fc6d2bd 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -2354,7 +2354,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T void Temperature::task() { if (marlin_state == MarlinState::MF_INITIALIZING) return hal.watchdog_refresh(); // If Marlin isn't started, at least reset the watchdog! - static bool no_reentry = false; // Prevent recursion + static bool no_reentry = false; // Prevent recursion if (no_reentry) return; REMEMBER(mh, no_reentry, true); @@ -3640,7 +3640,7 @@ void Temperature::disable_all_heaters() { setTargetHotend(singlenozzle_temp[new_tool], 0); TERN_(AUTOTEMP, planner.autotemp_update()); set_heating_message(0); - (void)wait_for_hotend(0, false); // Wait for heating or cooling + (void)wait_for_hotend(0, false); // Wait for heating or cooling } #endif } @@ -3736,8 +3736,8 @@ void Temperature::disable_all_heaters() { spiInit(MAX_TC_SPEED_BITS); #endif - MAXTC_CS_WRITE(LOW); // Enable MAXTC - DELAY_NS(100); // Ensure 100ns delay + MAXTC_CS_WRITE(LOW); // Enable MAXTC + DELAY_NS(100); // Ensure 100ns delay // Read a big-endian temperature value without using a library for (uint8_t i = sizeof(max_tc_temp); i--;) { @@ -3745,7 +3745,7 @@ void Temperature::disable_all_heaters() { if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte } - MAXTC_CS_WRITE(HIGH); // Disable MAXTC + MAXTC_CS_WRITE(HIGH); // Disable MAXTC #else #if HAS_MAX6675_LIBRARY MAX6675 &max6675ref = THERMO_SEL(max6675_0, max6675_1, max6675_2); @@ -3859,8 +3859,8 @@ void Temperature::disable_all_heaters() { spiInit(BED_MAX_TC_SPEED_BITS); #endif - WRITE(TEMP_BED_CS_PIN, LOW); // Enable MAXTC - DELAY_NS(100); // Ensure 100ns delay + WRITE(TEMP_BED_CS_PIN, LOW); // Enable MAXTC + DELAY_NS(100); // Ensure 100ns delay // Read a big-endian temperature value without using a library for (uint8_t i = sizeof(max_tc_temp); i--;) { @@ -3868,7 +3868,7 @@ void Temperature::disable_all_heaters() { if (i > 0) max_tc_temp <<= 8; // shift left if not the last byte } - WRITE(TEMP_BED_CS_PIN, HIGH); // Disable MAXTC + WRITE(TEMP_BED_CS_PIN, HIGH); // Disable MAXTC #elif ALL(TEMP_SENSOR_BED_IS_MAX6675, HAS_MAX6675_LIBRARY) MAX6675 &max6675ref = max6675_BED; @@ -4423,21 +4423,21 @@ void Temperature::isr() { constexpr int8_t extra_loops = MIN_ADC_ISR_LOOPS - (int8_t)SensorsReady; static uint8_t delay_count = 0; if (extra_loops > 0) { - if (delay_count == 0) delay_count = extra_loops; // Init this delay - if (--delay_count) // While delaying, - next_sensor_state = SensorsReady; // retain this state (else, next state will be 0) + if (delay_count == 0) delay_count = extra_loops; // Init this delay + if (--delay_count) // While delaying... + next_sensor_state = SensorsReady; // retain this state (else, next state will be 0) break; } else { - adc_sensor_state = StartSampling; // Fall-through to start sampling + adc_sensor_state = StartSampling; // Fall-through to start sampling next_sensor_state = (ADCSensorState)(int(StartSampling) + 1); } } #pragma GCC diagnostic pop - case StartSampling: // Start of sampling loops. Do updates/checks. - if (++temp_count >= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256) = 164ms. + case StartSampling: // Start of sampling loops. Do updates/checks. + if (++temp_count >= OVERSAMPLENR) { // 10 * 16 * 1/(16000000/64/256) = 164ms. temp_count = 0; readings_ready(); } @@ -4883,7 +4883,7 @@ void Temperature::isr() { wait_for_heatup = false; #if ENABLED(DWIN_CREALITY_LCD) hmiFlag.heat_flag = 0; - duration_t elapsed = print_job_timer.duration(); // Print timer + duration_t elapsed = print_job_timer.duration(); // Print timer dwin_heat_time = elapsed.value; #elif ENABLED(SOVOL_SV06_RTS) update_time_value = RTS_UPDATE_VALUE; @@ -5222,6 +5222,7 @@ void Temperature::isr() { #endif bool Temperature::wait_for_cooler(const bool no_wait_for_cooling/*=true*/) { + #if TEMP_COOLER_RESIDENCY_TIME > 0 millis_t residency_start_ms = 0; bool first_loop = true; diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index f3279fb7db..60d8e0d89f 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -1055,13 +1055,13 @@ class Temperature { #if HAS_HEATED_BED #if ENABLED(SHOW_TEMP_ADC_VALUES) - static raw_adc_t rawBedTemp() { return temp_bed.getraw(); } + static raw_adc_t rawBedTemp() { return temp_bed.getraw(); } #endif - static celsius_float_t degBed() { return temp_bed.celsius; } - static celsius_t wholeDegBed() { return static_cast(degBed() + 0.5f); } - static celsius_t degTargetBed() { return temp_bed.target; } - static bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; } - static bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; } + static celsius_float_t degBed() { return temp_bed.celsius; } + static celsius_t wholeDegBed() { return static_cast(degBed() + 0.5f); } + static celsius_t degTargetBed() { return temp_bed.target; } + static bool isHeatingBed() { return temp_bed.target > temp_bed.celsius; } + static bool isCoolingBed() { return temp_bed.target < temp_bed.celsius; } static bool degBedNear(const celsius_t temp) { return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS); } @@ -1093,10 +1093,10 @@ class Temperature { #if HAS_TEMP_PROBE #if ENABLED(SHOW_TEMP_ADC_VALUES) - static raw_adc_t rawProbeTemp() { return temp_probe.getraw(); } + static raw_adc_t rawProbeTemp() { return temp_probe.getraw(); } #endif - static celsius_float_t degProbe() { return temp_probe.celsius; } - static celsius_t wholeDegProbe() { return static_cast(degProbe() + 0.5f); } + static celsius_float_t degProbe() { return temp_probe.celsius; } + static celsius_t wholeDegProbe() { return static_cast(degProbe() + 0.5f); } static bool isProbeBelowTemp(const celsius_t target_temp) { return wholeDegProbe() < target_temp; } static bool isProbeAboveTemp(const celsius_t target_temp) { return wholeDegProbe() > target_temp; } static bool wait_for_probe(const celsius_t target_temp, bool no_wait_for_cooling=true); @@ -1104,14 +1104,14 @@ class Temperature { #if HAS_TEMP_CHAMBER #if ENABLED(SHOW_TEMP_ADC_VALUES) - static raw_adc_t rawChamberTemp() { return temp_chamber.getraw(); } + static raw_adc_t rawChamberTemp() { return temp_chamber.getraw(); } #endif - static celsius_float_t degChamber() { return temp_chamber.celsius; } - static celsius_t wholeDegChamber() { return static_cast(degChamber() + 0.5f); } + static celsius_float_t degChamber() { return temp_chamber.celsius; } + static celsius_t wholeDegChamber() { return static_cast(degChamber() + 0.5f); } #if HAS_HEATED_CHAMBER - static celsius_t degTargetChamber() { return temp_chamber.target; } - static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; } - static bool isCoolingChamber() { return temp_chamber.target < temp_chamber.celsius; } + static celsius_t degTargetChamber() { return temp_chamber.target; } + static bool isHeatingChamber() { return temp_chamber.target > temp_chamber.celsius; } + static bool isCoolingChamber() { return temp_chamber.target < temp_chamber.celsius; } static bool wait_for_chamber(const bool no_wait_for_cooling=true); static void manage_heated_chamber(const millis_t &ms); #endif @@ -1143,18 +1143,18 @@ class Temperature { #if HAS_TEMP_BOARD #if ENABLED(SHOW_TEMP_ADC_VALUES) - static raw_adc_t rawBoardTemp() { return temp_board.getraw(); } + static raw_adc_t rawBoardTemp() { return temp_board.getraw(); } #endif - static celsius_float_t degBoard() { return temp_board.celsius; } - static celsius_t wholeDegBoard() { return static_cast(temp_board.celsius + 0.5f); } + static celsius_float_t degBoard() { return temp_board.celsius; } + static celsius_t wholeDegBoard() { return static_cast(temp_board.celsius + 0.5f); } #endif #if HAS_TEMP_SOC #if ENABLED(SHOW_TEMP_ADC_VALUES) - static raw_adc_t rawSocTemp() { return temp_soc.getraw(); } + static raw_adc_t rawSocTemp() { return temp_soc.getraw(); } #endif - static celsius_float_t degSoc() { return temp_soc.celsius; } - static celsius_t wholeDegSoc() { return static_cast(temp_soc.celsius + 0.5f); } + static celsius_float_t degSoc() { return temp_soc.celsius; } + static celsius_t wholeDegSoc() { return static_cast(temp_soc.celsius + 0.5f); } #endif #if HAS_TEMP_REDUNDANT @@ -1251,14 +1251,14 @@ class Temperature { MeasurementState measure_heatup(); MeasurementState measure_transfer(); - celsius_float_t get_ambient_temp() { return ambient_temp; } + celsius_float_t get_ambient_temp() { return ambient_temp; } celsius_float_t get_last_measured_temp() { return current_temp; } - float get_elapsed_heating_time() { return elapsed_heating_time; } - float get_sample_1_time() { return t1_time; } - static float get_sample_1_temp() { return temp_samples[0]; } - static float get_sample_2_temp() { return temp_samples[(sample_count - 1) >> 1]; } - static float get_sample_3_temp() { return temp_samples[sample_count - 1]; } + float get_elapsed_heating_time() { return elapsed_heating_time; } + float get_sample_1_time() { return t1_time; } + static float get_sample_1_temp() { return temp_samples[0]; } + static float get_sample_2_temp() { return temp_samples[(sample_count - 1) >> 1]; } + static float get_sample_3_temp() { return temp_samples[sample_count - 1]; } static float get_sample_interval() { return sample_distance * (sample_count >> 1); } static celsius_float_t get_temp_fastest() { return temp_fastest; }