clear fault bit for max31865 devies
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2021-12-15 11:20:28 +01:00
parent 5ae6a61ec0
commit 9e6ad8807a
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
6 changed files with 33 additions and 5 deletions

View File

@ -199,7 +199,7 @@ void initmission::createPstTasks(TaskFactory& factory,
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
"PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 2.0,
missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {

2
fsfw

@ -1 +1 @@
Subproject commit e428568a00494c3e3ceb6d0b314baae97d4d8731
Subproject commit 54e56ec522f485525de7b17458b22132003c5047

View File

@ -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

View File

@ -96,12 +96,14 @@ private:
REQUEST_LOW_THRESHOLD,
REQUEST_CONFIG,
RUNNING,
REQUEST_FAULT_BYTE
REQUEST_FAULT_BYTE,
CLEAR_FAULT_BYTE
};
InternalState internalState = InternalState::NONE;
bool commandExecuted = false;
bool resetFaultBit = false;
dur_millis_t startTime = 0;
uint8_t faultByte = 0;
std::array<uint8_t, 3> commandBuffer { 0 };

View File

@ -17,13 +17,17 @@ enum PoolIds: lp_id_t {
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
static constexpr DeviceCommandId_t CLEAR_FAULT_BYTE = 0x08;
static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD;
static constexpr uint8_t CLEAR_FAULT_BIT_VAL = 0b0000'0010;
static constexpr size_t MAX_REPLY_SIZE = 5;

2
tmtc

@ -1 +1 @@
Subproject commit f6a3f792203bc1f00b10c9760b99a8e83ae2535c
Subproject commit eca5bba1d8df6576a19547d356e676b0fb164d87