Skip to content

Commit cb2ec62

Browse files
authored
Use RTD for MAX31865 reading (#20188)
1 parent acdfbbe commit cb2ec62

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Marlin/src/module/temperature.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,10 +2248,7 @@ void Temperature::disable_all_heaters() {
22482248

22492249
#if HAS_MAX31865
22502250
Adafruit_MAX31865 &maxref = MAX6675_SEL(max31865_0, max31865_1);
2251-
max6675_temp = int(maxref.temperature(
2252-
MAX6675_SEL(MAX31865_SENSOR_OHMS_0, MAX31865_SENSOR_OHMS_1),
2253-
MAX6675_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)
2254-
));
2251+
const uint16_t max31865_ohms = (uint32_t(maxref.readRTD()) * MAX6675_SEL(MAX31865_CALIBRATION_OHMS_0, MAX31865_CALIBRATION_OHMS_1)) >> 16;
22552252
#endif
22562253

22572254
//
@@ -2325,6 +2322,9 @@ void Temperature::disable_all_heaters() {
23252322
if (max6675_temp & 0x00002000) max6675_temp |= 0xFFFFC000; // Support negative temperature
23262323
#endif
23272324

2325+
// Return the RTD resistance for MAX31865 for display in SHOW_TEMP_ADC_VALUES
2326+
TERN_(HAS_MAX31865, max6675_temp = max31865_ohms);
2327+
23282328
MAX6675_TEMP(hindex) = max6675_temp;
23292329

23302330
return int(max6675_temp);

0 commit comments

Comments
 (0)