@@ -2876,16 +2876,16 @@ void Temperature::updateTemperaturesFromRawValues() {
28762876 #endif
28772877
28782878 #if HAS_HOTEND
2879- HOTEND_LOOP () temp_hotend[e].celsius = analog_to_celsius_hotend (temp_hotend[e]. getraw ( ), e);
2879+ HOTEND_LOOP () temp_hotend[e].celsius = analog_to_celsius_hotend (rawHotendTemp (e ), e);
28802880 #endif
28812881
2882- TERN_ (HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed (temp_bed. getraw ()));
2883- TERN_ (HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber (temp_chamber. getraw ()));
2884- TERN_ (HAS_TEMP_COOLER, temp_cooler.celsius = analog_to_celsius_cooler (temp_cooler. getraw ()));
2885- TERN_ (HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe (temp_probe. getraw ()));
2886- TERN_ (HAS_TEMP_BOARD, temp_board.celsius = analog_to_celsius_board (temp_board. getraw ()));
2887- TERN_ (HAS_TEMP_SOC, temp_soc.celsius = analog_to_celsius_soc (temp_soc. getraw ()));
2888- TERN_ (HAS_TEMP_REDUNDANT, temp_redundant.celsius = analog_to_celsius_redundant (temp_redundant. getraw ()));
2882+ TERN_ (HAS_HEATED_BED, temp_bed.celsius = analog_to_celsius_bed (rawBedTemp ()));
2883+ TERN_ (HAS_TEMP_CHAMBER, temp_chamber.celsius = analog_to_celsius_chamber (rawChamberTemp ()));
2884+ TERN_ (HAS_TEMP_COOLER, temp_cooler.celsius = analog_to_celsius_cooler (rawCoolerTemp ()));
2885+ TERN_ (HAS_TEMP_PROBE, temp_probe.celsius = analog_to_celsius_probe (rawProbeTemp ()));
2886+ TERN_ (HAS_TEMP_BOARD, temp_board.celsius = analog_to_celsius_board (rawBoardTemp ()));
2887+ TERN_ (HAS_TEMP_SOC, temp_soc.celsius = analog_to_celsius_soc (rawSocTemp ()));
2888+ TERN_ (HAS_TEMP_REDUNDANT, temp_redundant.celsius = analog_to_celsius_redundant (rawRedundantTemp ()));
28892889
28902890 TERN_ (FILAMENT_WIDTH_SENSOR, filwidth.update_measured_mm ());
28912891 TERN_ (HAS_POWER_MONITOR, power_monitor.capture_values ());
@@ -2895,7 +2895,7 @@ void Temperature::updateTemperaturesFromRawValues() {
28952895 static constexpr int8_t temp_dir[HOTENDS] = { REPEAT (HOTENDS, _TEMPDIR) };
28962896
28972897 HOTEND_LOOP () {
2898- const raw_adc_t r = temp_hotend[e]. getraw ( );
2898+ const raw_adc_t r = rawHotendTemp (e );
28992899 const bool neg = temp_dir[e] < 0 , pos = temp_dir[e] > 0 ;
29002900 if ((neg && r < temp_range[e].raw_max ) || (pos && r > temp_range[e].raw_max ))
29012901 MAXTEMP_ERROR (e, temp_hotend[e].celsius );
@@ -2920,35 +2920,35 @@ void Temperature::updateTemperaturesFromRawValues() {
29202920 #endif // HAS_HOTEND
29212921
29222922 #if ENABLED(THERMAL_PROTECTION_BED)
2923- if (TP_CMP (BED, temp_bed. getraw (), temp_sensor_range_bed.raw_max ))
2923+ if (TP_CMP (BED, rawBedTemp (), temp_sensor_range_bed.raw_max ))
29242924 MAXTEMP_ERROR (H_BED, temp_bed.celsius );
2925- if (temp_bed.target > 0 && !is_bed_preheating () && TP_CMP (BED, temp_sensor_range_bed.raw_min , temp_bed. getraw ()))
2925+ if (temp_bed.target > 0 && !is_bed_preheating () && TP_CMP (BED, temp_sensor_range_bed.raw_min , rawBedTemp ()))
29262926 MINTEMP_ERROR (H_BED, temp_bed.celsius );
29272927 #endif
29282928
29292929 #if ALL(HAS_HEATED_CHAMBER, THERMAL_PROTECTION_CHAMBER)
2930- if (TP_CMP (CHAMBER, temp_chamber. getraw (), temp_sensor_range_chamber.raw_max ))
2930+ if (TP_CMP (CHAMBER, rawChamberTemp (), temp_sensor_range_chamber.raw_max ))
29312931 MAXTEMP_ERROR (H_CHAMBER, temp_chamber.celsius );
2932- if (temp_chamber.target > 0 && TP_CMP (CHAMBER, temp_sensor_range_chamber.raw_min , temp_chamber. getraw ()))
2932+ if (temp_chamber.target > 0 && TP_CMP (CHAMBER, temp_sensor_range_chamber.raw_min , rawChamberTemp ()))
29332933 MINTEMP_ERROR (H_CHAMBER, temp_chamber.celsius );
29342934 #endif
29352935
29362936 #if ALL(HAS_COOLER, THERMAL_PROTECTION_COOLER)
2937- if (cutter.unitPower > 0 && TP_CMP (COOLER, temp_cooler. getraw (), temp_sensor_range_cooler.raw_max ))
2937+ if (cutter.unitPower > 0 && TP_CMP (COOLER, rawCoolerTemp (), temp_sensor_range_cooler.raw_max ))
29382938 MAXTEMP_ERROR (H_COOLER, temp_cooler.celsius );
2939- if (TP_CMP (COOLER, temp_sensor_range_cooler.raw_min , temp_cooler. getraw ()))
2939+ if (TP_CMP (COOLER, temp_sensor_range_cooler.raw_min , rawCoolerTemp ()))
29402940 MINTEMP_ERROR (H_COOLER, temp_cooler.celsius );
29412941 #endif
29422942
29432943 #if ALL(HAS_TEMP_BOARD, THERMAL_PROTECTION_BOARD)
2944- if (TP_CMP (BOARD, temp_board. getraw (), temp_sensor_range_board.raw_max ))
2944+ if (TP_CMP (BOARD, rawBoardTemp (), temp_sensor_range_board.raw_max ))
29452945 MAXTEMP_ERROR (H_BOARD, temp_board.celsius );
2946- if (TP_CMP (BOARD, temp_sensor_range_board.raw_min , temp_board. getraw ()))
2946+ if (TP_CMP (BOARD, temp_sensor_range_board.raw_min , rawBoardTemp ()))
29472947 MINTEMP_ERROR (H_BOARD, temp_board.celsius );
29482948 #endif
29492949
29502950 #if ALL(HAS_TEMP_SOC, THERMAL_PROTECTION_SOC)
2951- if (TP_CMP (SOC, temp_soc. getraw (), maxtemp_raw_SOC)) MAXTEMP_ERROR (H_SOC, temp_soc.celsius );
2951+ if (TP_CMP (SOC, rawSocTemp (), maxtemp_raw_SOC)) MAXTEMP_ERROR (H_SOC, temp_soc.celsius );
29522952 #endif
29532953
29542954} // Temperature::updateTemperaturesFromRawValues
@@ -3354,13 +3354,13 @@ void Temperature::init() {
33543354 #define VARIANCE_WINDOW period_seconds
33553355 #endif
33563356
3357- if (state == TRMalfunction) { // temperature invariance may continue, regardless of heater state
3358- variance += ABS (current - last_temp); // no need for detection window now, a single change in variance is enough
3357+ if (state == TRMalfunction) { // Temperature invariance may continue, regardless of heater state
3358+ variance += ABS (current - last_temp); // No need for detection window now, a single change in variance is enough
33593359 last_temp = current;
3360- if (! NEAR_ZERO ( variance)) {
3360+ if (variance > 0 . 25f ) { // Require meaningful temperature change, not just ADC noise
33613361 variance_timer = millis () + SEC_TO_MS (VARIANCE_WINDOW);
33623362 variance = 0.0 ;
3363- state = TRStable; // resume from where we detected the problem
3363+ state = TRStable; // Resume from where we detected the problem
33643364 }
33653365 }
33663366 #endif
0 commit comments