RTD update and TCP server in hosted build #65
@ -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 << " °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): {
|
||||
|
@ -9,6 +9,7 @@
|
||||
namespace Max31865Definitions {
|
||||
|
||||
enum PoolIds: lp_id_t {
|
||||
RTD_VALUE,
|
||||
TEMPERATURE_C,
|
||||
FAULT_BYTE
|
||||
};
|
||||
@ -46,6 +47,8 @@ public:
|
||||
StaticLocalDataSet(sid_t(objectId, MAX31865_SET_ID)) {
|
||||
}
|
||||
|
||||
lp_var_t<float> rtdValue = lp_var_t<float>(sid.objectId,
|
||||
PoolIds::RTD_VALUE, this);
|
||||
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId,
|
||||
PoolIds::TEMPERATURE_C, this);
|
||||
lp_var_t<uint8_t> errorByte = lp_var_t<uint8_t>(sid.objectId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user