temperaturesensor-bugfix #47

Open
msenger wants to merge 2 commits from temperaturesensor-bugfix into main

View File

@ -142,7 +142,7 @@ class TemperatureSensor : public AbstractTemperatureSensor {
deltaTime = (uptime.tv_sec + uptime.tv_usec / 1000000.) - deltaTime = (uptime.tv_sec + uptime.tv_usec / 1000000.) -
(uptimeOfOldTemperature.tv_sec + uptimeOfOldTemperature.tv_usec / 1000000.); (uptimeOfOldTemperature.tv_sec + uptimeOfOldTemperature.tv_usec / 1000000.);
deltaTemp = oldTemperature - outputTemperature; deltaTemp = oldTemperature - outputTemperature.value;
if (deltaTemp < 0) { if (deltaTemp < 0) {
deltaTemp = -deltaTemp; deltaTemp = -deltaTemp;
} }
@ -160,13 +160,13 @@ class TemperatureSensor : public AbstractTemperatureSensor {
outputTemperature.setValid(PoolVariableIF::INVALID); outputTemperature.setValid(PoolVariableIF::INVALID);
outputTemperature = thermal::INVALID_TEMPERATURE; outputTemperature = thermal::INVALID_TEMPERATURE;
} else { } else {
oldTemperature = outputTemperature; oldTemperature = outputTemperature.value;
uptimeOfOldTemperature = uptime; uptimeOfOldTemperature = uptime;
} }
} }
public: public:
float getTemperature() { return outputTemperature; } float getTemperature() { return outputTemperature.value; }
bool isValid() { return outputTemperature.isValid(); } bool isValid() { return outputTemperature.isValid(); }