Skip to content

Commit db2af66

Browse files
committed
Clarify the mV/°C scale
1 parent 55627a3 commit db2af66

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Marlin/src/module/temperature.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2142,8 +2142,10 @@ void Temperature::task() {
21422142
UNUSED(ms);
21432143
}
21442144

2145-
#define TEMP_AD595(RAW) ((RAW) * (HAL_ADC_VREF) * 100.0 / float(HAL_ADC_RANGE) / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET)
2146-
#define TEMP_AD8495(RAW) ((RAW) * (HAL_ADC_VREF) * 2 * 100.0 / float(HAL_ADC_RANGE) / (OVERSAMPLENR) * (TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET)
2145+
// For a 5V input the AD595 returns a value scaled with 10mV per °C.
2146+
#define TEMP_AD595(RAW) ((RAW) * (HAL_ADC_VREF) * (1000.0f / 10.0f) / float(HAL_ADC_RANGE) / (OVERSAMPLENR) * (TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET)
2147+
// For a 5V input the AD8495 returns a value scaled with 5mV per °C.
2148+
#define TEMP_AD8495(RAW) ((RAW) * (HAL_ADC_VREF) * (1000.0f / 5.0f) / float(HAL_ADC_RANGE) / (OVERSAMPLENR) * (TEMP_SENSOR_AD8495_GAIN) + TEMP_SENSOR_AD8495_OFFSET)
21472149

21482150
/**
21492151
* Bisect search for the range of the 'raw' value, then interpolate

0 commit comments

Comments
 (0)