bugfixes in max31685, indexing adapted
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
@ -5,10 +5,10 @@
|
||||
#include <bitset>
|
||||
#include <cmath>
|
||||
|
||||
Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId,
|
||||
object_id_t comIF, CookieIF *comCookie, uint8_t switchId):
|
||||
DeviceHandlerBase(objectId, comIF, comCookie), switchId(switchId),
|
||||
sensorDataset(this), sensorDatasetSid(sensorDataset.getSid()) {
|
||||
Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId, object_id_t comIF,
|
||||
CookieIF *comCookie):
|
||||
DeviceHandlerBase(objectId, comIF, comCookie), sensorDataset(this),
|
||||
sensorDatasetSid(sensorDataset.getSid()) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
debugDivider = new PeriodicOperationDivider(0);
|
||||
#endif
|
||||
@ -33,8 +33,8 @@ void Max31865PT1000Handler::doStartUp() {
|
||||
|
||||
if(internalState == InternalState::CONFIGURE) {
|
||||
if(commandExecuted) {
|
||||
internalState = InternalState::REQUEST_CONFIG;
|
||||
commandExecuted = false;
|
||||
internalState = InternalState::REQUEST_CONFIG;
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,26 +323,32 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
break;
|
||||
}
|
||||
case(Max31865Definitions::REQUEST_LOW_THRESHOLD): {
|
||||
uint16_t readLowThreshold = packet[0] << 8 | packet[1];
|
||||
uint16_t readLowThreshold = packet[1] << 8 | packet[2];
|
||||
if(readLowThreshold != LOW_THRESHOLD) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1 && OBSW_DEBUG_RTD == 1
|
||||
sif::error
|
||||
<< "Max31865PT1000Handler::interpretDeviceReply: Missmatch between written "
|
||||
<< "and readback value of low threshold register"
|
||||
<< std::endl;
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " <<
|
||||
"written and readback value of low threshold register" << std::endl;
|
||||
#else
|
||||
sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between "
|
||||
"written and readback value of low threshold register\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
commandExecuted = true;
|
||||
break;
|
||||
}
|
||||
case(Max31865Definitions::REQUEST_HIGH_THRESHOLD): {
|
||||
uint16_t readHighThreshold = packet[0] << 8 | packet[1];
|
||||
uint16_t readHighThreshold = packet[1] << 8 | packet[2];
|
||||
if(readHighThreshold != HIGH_THRESHOLD) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1 && OBSW_DEBUG_RTD == 1
|
||||
sif::error
|
||||
<< "Max31865PT1000Handler::interpretDeviceReply: Missmatch between written "
|
||||
<< "and readback value of high threshold register"
|
||||
<< std::endl;
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Missmatch between " <<
|
||||
"written and readback value of high threshold register" << std::endl;
|
||||
#else
|
||||
sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Missmatch between "
|
||||
"written and readback value of high threshold register\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
commandExecuted = true;
|
||||
@ -365,30 +371,28 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
// calculate approximation
|
||||
float approxTemp = adcCode / 32.0 - 256.0;
|
||||
|
||||
#if OBSW_DEBUG_RTD == 1
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
if(debugDivider->checkAndIncrement()) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Max31865PT1000Handler::interpretDeviceReply: Measured "
|
||||
<< "resistance is " << rtdValue << " Ohms." << std::endl;
|
||||
sif::info << "Approximated temperature is " << approxTemp << " C"
|
||||
<< std::endl;
|
||||
sif::info << "Max31865: Measured resistance is " << rtdValue << " Ohms." << std::endl;
|
||||
sif::info << "Approximated temperature is " << approxTemp << " C" << std::endl;
|
||||
#else
|
||||
sif::printInfo("Max31865PT1000Handler::interpretDeviceReply: Measured resistance is %f"
|
||||
" Ohms.\n", rtdValue);
|
||||
sif::printInfo("Max31685: Measured resistance is %f Ohms\n", rtdValue);
|
||||
sif::printInfo("Approximated temperature is %f C\n", approxTemp);
|
||||
#endif
|
||||
sensorDataset.setChanged(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
PoolReadGuard pg(&sensorDataset);
|
||||
if(pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
// Configuration error
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!"
|
||||
sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!"
|
||||
<< std::endl;
|
||||
#else
|
||||
sif::printDebug("Max31865PT1000Handler::interpretDeviceReply: Error reading dataset!\n");
|
||||
sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: "
|
||||
"Error reading dataset!\n");
|
||||
#endif
|
||||
return pg.getReadResult();
|
||||
}
|
||||
@ -407,10 +411,10 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
faultByte = packet[1];
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "Max31865PT1000Handler::interpretDeviceReply: Fault byte"
|
||||
sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Fault byte"
|
||||
" is: 0b" << std::bitset<8>(faultByte) << std::endl;
|
||||
#else
|
||||
sif::printInfo("Max31865PT1000Handler::interpretDeviceReply: Fault byte"
|
||||
sif::printWarning("Max31865PT1000Handler::interpretDeviceReply: Fault byte"
|
||||
" is: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(faultByte));
|
||||
#endif
|
||||
#endif
|
||||
@ -459,7 +463,7 @@ void Max31865PT1000Handler::debugInterface(uint8_t positionTracker,
|
||||
|
||||
uint32_t Max31865PT1000Handler::getTransitionDelayMs(
|
||||
Mode_t modeFrom, Mode_t modeTo) {
|
||||
return 20000;
|
||||
return 25000;
|
||||
}
|
||||
|
||||
ReturnValue_t Max31865PT1000Handler::getSwitches(
|
||||
|
Reference in New Issue
Block a user