new RTD handler working
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -313,7 +313,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
|
||||
rtds[idx] = typedHandler;
|
||||
typedHandler->setDeviceInfo(idx, rtdInfos[idx].second);
|
||||
#if OBSW_DEBUG_RTD == 1
|
||||
// typedHandler->setDebugMode(true);
|
||||
typedHandler->setDebugMode(true, 5);
|
||||
#endif
|
||||
#if OBSW_TEST_RTD == 1
|
||||
typedHandler->setInstantNormal(true);
|
||||
|
@ -49,16 +49,15 @@ bool Max31865RtdReader::periodicInitHandling() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool someRtdOn = false;
|
||||
for (auto& rtd : rtds) {
|
||||
if (rtd == nullptr) {
|
||||
continue;
|
||||
}
|
||||
if ((rtd->on or rtd->active) and not rtd->configured) {
|
||||
if (rtd->cd.hasTimedOut()) {
|
||||
uint8_t cfg =
|
||||
(Bias::OFF << CfgBitPos::BIAS_SEL) | (Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) |
|
||||
(ConvMode::NORM_OFF << CfgBitPos::CONV_MODE) | (1 << CfgBitPos::FAULTY_STATUS_CLEAR);
|
||||
uint8_t cfg = (Bias::OFF << CfgBitPos::BIAS_SEL) |
|
||||
(Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) |
|
||||
(ConvMode::NORM_OFF << CfgBitPos::CONV_MODE);
|
||||
result = writeCfgReg(rtd->spiCookie, cfg);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
handleSpiError(rtd, result, "writeCfgReg");
|
||||
@ -84,14 +83,14 @@ bool Max31865RtdReader::periodicInitHandling() {
|
||||
handleSpiError(rtd, result, "clearFaultStatus");
|
||||
}
|
||||
}
|
||||
someRtdOn = true;
|
||||
rtd->configured = true;
|
||||
rtd->db.configured = true;
|
||||
if (rtd->active) {
|
||||
rtd->db.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (not someRtdOn) {
|
||||
return false;
|
||||
}
|
||||
bool someRtdUsable = false;
|
||||
for (auto& rtd : rtds) {
|
||||
if (rtd == nullptr) {
|
||||
@ -126,6 +125,10 @@ void Max31865RtdReader::periodicReadReqHandling() {
|
||||
}
|
||||
currentCfg |= (1 << CfgBitPos::ONE_SHOT);
|
||||
result = writeCfgReg(rtd->spiCookie, currentCfg);
|
||||
if (result != RETURN_OK) {
|
||||
handleSpiError(rtd, result, "writeCfgReg");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,7 +157,7 @@ void Max31865RtdReader::periodicReadHandling() {
|
||||
if (faultBitSet) {
|
||||
rtd->db.faultBitSet = faultBitSet;
|
||||
}
|
||||
rtd->db.rtdVal = rtdVal;
|
||||
rtd->db.adcCode = rtdVal;
|
||||
}
|
||||
}
|
||||
for (auto& rtd : rtds) {
|
||||
@ -182,6 +185,10 @@ ReturnValue_t Max31865RtdReader::initializeInterface(CookieIF* cookie) {
|
||||
throw std::invalid_argument("Invalid RTD index");
|
||||
}
|
||||
rtds[rtdCookie->idx] = rtdCookie;
|
||||
MutexGuard mg(readerMutex);
|
||||
if (dbLen == 0) {
|
||||
dbLen = rtdCookie->db.getSerializedSize();
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
@ -299,14 +306,13 @@ ReturnValue_t Max31865RtdReader::readReceivedMessage(CookieIF* cookie, uint8_t**
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
*buffer = reinterpret_cast<uint8_t*>(rtdCookie->exchangeBuf.data());
|
||||
*size = rtdCookie->db.getSerializedSize();
|
||||
*size = serLen;
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t Max31865RtdReader::writeCfgReg(SpiCookie* cookie, uint8_t cfg) {
|
||||
using namespace MAX31865;
|
||||
uint8_t cmd = cfg;
|
||||
return writeNToReg(cookie, CONFIG, 1, &cmd, nullptr);
|
||||
return writeNToReg(cookie, CONFIG, 1, &cfg, nullptr);
|
||||
}
|
||||
|
||||
ReturnValue_t Max31865RtdReader::writeBiasSel(MAX31865::Bias bias, SpiCookie* cookie) {
|
||||
@ -388,7 +394,7 @@ ReturnValue_t Max31865RtdReader::writeNToReg(SpiCookie* cookie, uint8_t reg, siz
|
||||
for (size_t idx = 0; idx < n; idx++) {
|
||||
cmdBuf[idx + 1] = cmd[idx];
|
||||
}
|
||||
return comIF->sendMessage(cookie, cmd, 2);
|
||||
return comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
|
||||
}
|
||||
|
||||
ReturnValue_t Max31865RtdReader::readRtdVal(SpiCookie* cookie, uint16_t& val, bool& faultBitSet) {
|
||||
@ -416,18 +422,19 @@ ReturnValue_t Max31865RtdReader::readNFromReg(SpiCookie* cookie, uint8_t reg, si
|
||||
reg &= ~WRITE_BIT;
|
||||
cmdBuf[0] = reg;
|
||||
std::memset(cmdBuf.data() + 1, 0, n);
|
||||
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n);
|
||||
ReturnValue_t result = comIF->sendMessage(cookie, cmdBuf.data(), n + 1);
|
||||
if (result != RETURN_OK) {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
uint8_t* replyPtr = replyBuf.data();
|
||||
|
||||
size_t dummyLen = 0;
|
||||
uint8_t* replyPtr = nullptr;
|
||||
result = comIF->readReceivedMessage(cookie, &replyPtr, &dummyLen);
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
if (reply != nullptr) {
|
||||
*reply = replyBuf.data() + 1;
|
||||
*reply = replyPtr + 1;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class Max31865RtdReader : public SystemObject,
|
||||
private:
|
||||
std::vector<Max31865ReaderCookie*> rtds;
|
||||
std::array<uint8_t, 4> cmdBuf = {};
|
||||
std::array<uint8_t, 4> replyBuf = {};
|
||||
size_t dbLen = 0;
|
||||
MutexIF* readerMutex;
|
||||
|
||||
void rtdMainLoop();
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
|
||||
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||
|
||||
#ifndef RPI_TEST_ADIS16507
|
||||
#define RPI_TEST_ADIS16507 0
|
||||
#endif
|
||||
@ -62,6 +64,7 @@ ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
|
||||
ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
static_cast<void>(length);
|
||||
thisSequence->addSlot(objects::SPI_RTD_COM_IF, length * 0.0, 0);
|
||||
#if OBSW_ADD_PL_PCDU == 1
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
@ -73,140 +76,26 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
#endif
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0,
|
||||
DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
#endif
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.2,
|
||||
DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.2, DeviceHandlerIF::SEND_WRITE);
|
||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
#endif
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.4,
|
||||
DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.4, DeviceHandlerIF::GET_WRITE);
|
||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
#endif
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.6,
|
||||
DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||
|
||||
#if OBSW_ADD_TMP_DEVICES == 1
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
#if OBSW_ADD_RTD_DEVICES == 1
|
||||
thisSequence->addSlot(objects::RTD_0_IC3_PLOC_HEATSPREADER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_1_IC4_PLOC_MISSIONBOARD, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_2_IC5_4K_CAMERA, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_3_IC6_DAC_HEATSPREADER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_4_IC7_STARTRACKER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_5_IC8_RW1_MX_MY, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_6_IC9_DRO, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_7_IC10_SCEX, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_8_IC11_X8, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_9_IC12_HPA, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_10_IC13_PL_TX, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_11_IC14_MPA, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_12_IC15_ACU, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, length * 0.8,
|
||||
DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_14_IC17_TCS_BOARD, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
thisSequence->addSlot(objects::RTD_15_IC18_IMTQ, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||
|
||||
#if OBSW_ADD_RAD_SENSORS == 1
|
||||
/* Radiation sensor */
|
||||
|
Reference in New Issue
Block a user