storing RTD value now as well
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include "Max31865PT1000Handler.h"
|
||||
|
||||
#include "fsfw/datapool/PoolReadGuard.h"
|
||||
|
||||
#include <bitset>
|
||||
#include <cmath>
|
||||
|
||||
@ -360,7 +362,6 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
// do something with rtd value, will propably be stored in
|
||||
// dataset.
|
||||
float rtdValue = adcCode * RTD_RREF_PT1000 / INT16_MAX;
|
||||
|
||||
// calculate approximation
|
||||
float approxTemp = adcCode / 32.0 - 256.0;
|
||||
|
||||
@ -369,7 +370,7 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Max31865PT1000Handler::interpretDeviceReply: Measured "
|
||||
<< "resistance is " << rtdValue << " Ohms." << std::endl;
|
||||
sif::info << "Approximated temperature is " << approxTemp << " <EFBFBD>C"
|
||||
sif::info << "Approximated temperature is " << approxTemp << " C"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printInfo("Max31865PT1000Handler::interpretDeviceReply: Measured resistance is %f"
|
||||
@ -380,8 +381,8 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
}
|
||||
#endif
|
||||
|
||||
ReturnValue_t result = sensorDataset.read();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
PoolReadGuard pg(&sensorDataset);
|
||||
if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
// Configuration error
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!"
|
||||
@ -389,29 +390,17 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
#else
|
||||
sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!\n");
|
||||
#endif
|
||||
return result;
|
||||
return pg.getReadResult();
|
||||
}
|
||||
|
||||
if(not sensorDataset.isValid()) {
|
||||
sensorDataset.setValidity(true, false);
|
||||
sensorDataset.rtdValue.setValid(true);
|
||||
sensorDataset.temperatureCelcius.setValid(true);
|
||||
}
|
||||
|
||||
sensorDataset.rtdValue = rtdValue;
|
||||
sensorDataset.temperatureCelcius = approxTemp;
|
||||
|
||||
result = sensorDataset.commit();
|
||||
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
// Configuration error
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Max31865PT1000Handler::interpretDeviceReply: "
|
||||
"Error commiting dataset!" << std::endl;
|
||||
#else
|
||||
sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: "
|
||||
"Error commiting dataset!\n");
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case(Max31865Definitions::REQUEST_FAULT_BYTE): {
|
||||
|
Reference in New Issue
Block a user