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:
parent
5ae6a61ec0
commit
9e6ad8807a
@ -199,7 +199,7 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
/* Polling Sequence Table Default */
|
/* Polling Sequence Table Default */
|
||||||
#if OBSW_ADD_SPI_TEST_CODE == 0
|
#if OBSW_ADD_SPI_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
|
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);
|
missedDeadlineFunc);
|
||||||
result = pst::pstSpi(spiPst);
|
result = pst::pstSpi(spiPst);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit e428568a00494c3e3ceb6d0b314baae97d4d8731
|
Subproject commit 54e56ec522f485525de7b17458b22132003c5047
|
@ -91,6 +91,10 @@ ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand(
|
|||||||
*id = Max31865Definitions::REQUEST_FAULT_BYTE;
|
*id = Max31865Definitions::REQUEST_FAULT_BYTE;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
else if(internalState == InternalState::CLEAR_FAULT_BYTE) {
|
||||||
|
*id = Max31865Definitions::CLEAR_FAULT_BYTE;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return DeviceHandlerBase::NOTHING_TO_SEND;
|
return DeviceHandlerBase::NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
@ -155,6 +159,13 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(
|
|||||||
return DeviceHandlerIF::NO_COMMAND_DATA;
|
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): {
|
case(Max31865Definitions::REQUEST_CONFIG): {
|
||||||
commandBuffer[0] = static_cast<uint8_t>(
|
commandBuffer[0] = static_cast<uint8_t>(
|
||||||
Max31865Definitions::REQUEST_CONFIG);
|
Max31865Definitions::REQUEST_CONFIG);
|
||||||
@ -233,6 +244,7 @@ void Max31865PT1000Handler::fillCommandAndReplyMap() {
|
|||||||
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3,
|
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3,
|
||||||
&sensorDataset);
|
&sensorDataset);
|
||||||
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3);
|
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3);
|
||||||
|
insertInCommandAndReplyMap(Max31865Definitions::CLEAR_FAULT_BYTE, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
|
ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
|
||||||
@ -290,6 +302,11 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
|
|||||||
*foundLen = 2;
|
*foundLen = 2;
|
||||||
internalState = InternalState::RUNNING;
|
internalState = InternalState::RUNNING;
|
||||||
}
|
}
|
||||||
|
else if(internalState == InternalState::CLEAR_FAULT_BYTE) {
|
||||||
|
*foundId = Max31865Definitions::CLEAR_FAULT_BYTE;
|
||||||
|
*foundLen = 2;
|
||||||
|
internalState = InternalState::RUNNING;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
*foundId = Max31865Definitions::REQUEST_CONFIG;
|
*foundId = Max31865Definitions::REQUEST_CONFIG;
|
||||||
*foundLen = configReplySize;
|
*foundLen = configReplySize;
|
||||||
@ -360,9 +377,14 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
|
|||||||
case(Max31865Definitions::REQUEST_RTD): {
|
case(Max31865Definitions::REQUEST_RTD): {
|
||||||
// first bit of LSB reply byte is the fault bit
|
// first bit of LSB reply byte is the fault bit
|
||||||
uint8_t faultBit = packet[2] & 0b0000'0001;
|
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?
|
// Maybe we should attempt to restart it?
|
||||||
internalState = InternalState::REQUEST_FAULT_BYTE;
|
internalState = InternalState::REQUEST_FAULT_BYTE;
|
||||||
|
resetFaultBit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RTD value consists of last seven bits of the LSB reply byte and
|
// RTD value consists of last seven bits of the LSB reply byte and
|
||||||
|
@ -96,12 +96,14 @@ private:
|
|||||||
REQUEST_LOW_THRESHOLD,
|
REQUEST_LOW_THRESHOLD,
|
||||||
REQUEST_CONFIG,
|
REQUEST_CONFIG,
|
||||||
RUNNING,
|
RUNNING,
|
||||||
REQUEST_FAULT_BYTE
|
REQUEST_FAULT_BYTE,
|
||||||
|
CLEAR_FAULT_BYTE
|
||||||
};
|
};
|
||||||
|
|
||||||
InternalState internalState = InternalState::NONE;
|
InternalState internalState = InternalState::NONE;
|
||||||
bool commandExecuted = false;
|
bool commandExecuted = false;
|
||||||
|
|
||||||
|
bool resetFaultBit = false;
|
||||||
dur_millis_t startTime = 0;
|
dur_millis_t startTime = 0;
|
||||||
uint8_t faultByte = 0;
|
uint8_t faultByte = 0;
|
||||||
std::array<uint8_t, 3> commandBuffer { 0 };
|
std::array<uint8_t, 3> commandBuffer { 0 };
|
||||||
|
@ -17,13 +17,17 @@ enum PoolIds: lp_id_t {
|
|||||||
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
|
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
|
||||||
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
|
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
|
||||||
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
|
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
|
||||||
|
|
||||||
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
|
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
|
||||||
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
|
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
|
||||||
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
|
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
|
||||||
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
|
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
|
||||||
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
|
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 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;
|
static constexpr size_t MAX_REPLY_SIZE = 5;
|
||||||
|
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit f6a3f792203bc1f00b10c9760b99a8e83ae2535c
|
Subproject commit eca5bba1d8df6576a19547d356e676b0fb164d87
|
Loading…
Reference in New Issue
Block a user