clear fault bit for max31865 devies
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:
@ -91,6 +91,10 @@ ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand(
|
||||
*id = Max31865Definitions::REQUEST_FAULT_BYTE;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
else if(internalState == InternalState::CLEAR_FAULT_BYTE) {
|
||||
*id = Max31865Definitions::CLEAR_FAULT_BYTE;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
else {
|
||||
return DeviceHandlerBase::NOTHING_TO_SEND;
|
||||
}
|
||||
@ -155,6 +159,13 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(
|
||||
return DeviceHandlerIF::NO_COMMAND_DATA;
|
||||
}
|
||||
}
|
||||
case(Max31865Definitions::CLEAR_FAULT_BYTE): {
|
||||
commandBuffer[0] = static_cast<uint8_t>(Max31865Definitions::CONFIG_CMD);
|
||||
commandBuffer[1] = Max31865Definitions::CLEAR_FAULT_BIT_VAL;
|
||||
DeviceHandlerBase::rawPacketLen = 2;
|
||||
DeviceHandlerBase::rawPacket = commandBuffer.data();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
case(Max31865Definitions::REQUEST_CONFIG): {
|
||||
commandBuffer[0] = static_cast<uint8_t>(
|
||||
Max31865Definitions::REQUEST_CONFIG);
|
||||
@ -233,6 +244,7 @@ void Max31865PT1000Handler::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3,
|
||||
&sensorDataset);
|
||||
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3);
|
||||
insertInCommandAndReplyMap(Max31865Definitions::CLEAR_FAULT_BYTE, 3);
|
||||
}
|
||||
|
||||
ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
|
||||
@ -290,6 +302,11 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
|
||||
*foundLen = 2;
|
||||
internalState = InternalState::RUNNING;
|
||||
}
|
||||
else if(internalState == InternalState::CLEAR_FAULT_BYTE) {
|
||||
*foundId = Max31865Definitions::CLEAR_FAULT_BYTE;
|
||||
*foundLen = 2;
|
||||
internalState = InternalState::RUNNING;
|
||||
}
|
||||
else {
|
||||
*foundId = Max31865Definitions::REQUEST_CONFIG;
|
||||
*foundLen = configReplySize;
|
||||
@ -360,9 +377,14 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
||||
case(Max31865Definitions::REQUEST_RTD): {
|
||||
// first bit of LSB reply byte is the fault bit
|
||||
uint8_t faultBit = packet[2] & 0b0000'0001;
|
||||
if(faultBit == 1) {
|
||||
if(resetFaultBit) {
|
||||
internalState = InternalState::CLEAR_FAULT_BYTE;
|
||||
resetFaultBit = false;
|
||||
}
|
||||
else if(faultBit == 1) {
|
||||
// Maybe we should attempt to restart it?
|
||||
internalState = InternalState::REQUEST_FAULT_BYTE;
|
||||
resetFaultBit = true;
|
||||
}
|
||||
|
||||
// RTD value consists of last seven bits of the LSB reply byte and
|
||||
|
Reference in New Issue
Block a user