Skip to content

Commit 4a63b8f

Browse files
committed
Added ability to read TC voltage. Also changed return type from float to double precision
1 parent 4fe00ca commit 4a63b8f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/utility/THERMOCOUPLE/MAX31855.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ double MAX31855Class::mvtoTemp(double voltage) {
134134
return polynomial(voltage, tableEntries, table);
135135
}
136136

137-
float MAX31855Class::readTCTemperature() {
137+
double MAX31855Class::readTCVoltage() {
138138
uint32_t rawword;
139139
int32_t measuredTempInt;
140140
int32_t measuredColdInt;
@@ -189,6 +189,12 @@ float MAX31855Class::readTCTemperature() {
189189

190190
measuredVolt = tempTomv(measuredCold - _coldOffset) + (measuredTemp - measuredCold) * 0.041276f;
191191

192+
return measuredVolt;
193+
}
194+
195+
double MAX31855Class::readTCTemperature() {
196+
measuredVolt = readTCVoltage();
197+
192198
// finally from the cold junction compensated voltage we calculate the temperature
193199
// using NIST polynomial approximation for the thermocouple type we are using
194200
return mvtoTemp(measuredVolt);

src/utility/THERMOCOUPLE/MAX31855.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class MAX31855Class {
2727
bool begin();
2828
void end();
2929

30-
float readTCTemperature();
30+
double readTCVoltage();
31+
double readTCTemperature();
3132
float readReferenceTemperature();
3233
void setColdOffset(float offset);
3334

0 commit comments

Comments
 (0)