rtd testing
EIVE/eive-obsw/pipeline/pr-develop This commit looks good Details

This commit is contained in:
Robin Müller 2022-05-13 01:17:23 +02:00
parent 5fe814e972
commit be1c26ddf7
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 38 additions and 20 deletions

View File

@ -297,6 +297,12 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
new Max31865PT1000Handler(rtdInfos[idx].first, objects::SPI_MAIN_COM_IF, rtdCookies[idx]);
rtds[idx] = typedHandler;
typedHandler->setDeviceInfo(idx + 3, rtdInfos[idx].second);
#if OBSW_DEBUG_RTD == 1
typedHandler->setDebugMode(true);
#endif
#if OBSW_TEST_RTD == 1
typedHandler->setInstantNormal(true);
#endif
};
auto lowLevelRtdsCreator = [&](uint8_t idx) {
Max31865ReaderCookie* rtdLowLevelCookie =
@ -305,6 +311,12 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
rtds[idx] = typedHandler;
typedHandler->setDeviceInfo(idx, rtdInfos[idx].second);
#if OBSW_DEBUG_RTD == 1
// typedHandler->setDebugMode(true);
#endif
#if OBSW_TEST_RTD == 1
typedHandler->setInstantNormal(true);
#endif
};
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
rtdCookies[idx] = new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second,
@ -317,12 +329,8 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
rtds[idx]->setParent(objects::TCS_BOARD_ASS);
rtdFdir = new RtdFdir(rtdInfos[idx].first);
rtds[idx]->setCustomFdir(rtdFdir);
#if OBSW_DEBUG_RTD == 1
rtds[idx]->setDebugMode(true);
#endif
#if OBSW_TEST_RTD == 1
rtds[idx]->setStartUpImmediately();
rtds[idx]->setInstantNormal(true);
#endif // OBSW_TEST_RTD == 1
}

View File

@ -54,7 +54,8 @@ bool Max31865RtdReader::periodicInitHandling() {
if (rtd == nullptr) {
continue;
}
if (rtd->on and not rtd->configured) {
if ((rtd->on or rtd->active) and not rtd->configured) {
sif::debug << "crap1" << std::endl;
if (rtd->cd.hasTimedOut()) {
uint8_t cfg =
(Bias::OFF << CfgBitPos::BIAS_SEL) | (Wires::FOUR_WIRE << CfgBitPos::WIRE_SEL) |
@ -117,7 +118,9 @@ void Max31865RtdReader::periodicReadReqHandling() {
if (rtd == nullptr) {
continue;
}
sif::debug << "crap2" << std::endl;
if (rtdIsActive(rtd->idx)) {
sif::debug << "crap3" << std::endl;
uint8_t currentCfg = 0;
auto result = readCfgReg(rtd->spiCookie, currentCfg);
if (result != RETURN_OK) {
@ -151,6 +154,9 @@ void Max31865RtdReader::periodicReadHandling() {
handleSpiError(rtd, result, "readRtdVal");
continue;
}
if(rtd->idx == 0) {
sif::debug << "Read RAW rtd val 0: " << rtdVal << std::endl;
}
if (faultBitSet) {
rtd->db.faultBitSet = faultBitSet;
}

View File

@ -103,7 +103,10 @@ void Max31865EiveHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
}
void Max31865EiveHandler::fillCommandAndReplyMap() {
insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 2, &sensorDataset);
insertInCommandMap(EiveMax31855::RtdCommands::ON);
insertInCommandMap(EiveMax31855::RtdCommands::ACTIVE);
insertInCommandMap(EiveMax31855::RtdCommands::OFF);
insertInReplyMap(EiveMax31855::RtdCommands::EXCHANGE_SET_ID, 2, &sensorDataset, 0, true);
}
ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t remainingSize,
@ -116,6 +119,7 @@ ReturnValue_t Max31865EiveHandler::scanForReply(const uint8_t* start, size_t rem
}
*foundId = EiveMax31855::RtdCommands::EXCHANGE_SET_ID;
*foundLen = remainingSize;
sif::info << "Max31865EiveHandler::scanForReply: Reply size " << remainingSize << std::endl;
return RETURN_OK;
}

View File

@ -441,20 +441,20 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id,
}
case (MAX31865::REQUEST_FAULT_BYTE): {
faultByte = packet[1];
#if OBSW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex
<< this->getObjectId()
<< ": Fault byte"
" is: 0b"
<< std::bitset<8>(faultByte) << std::endl;
#else
sif::printWarning(
"Max31865PT1000Handler::interpretDeviceReply: Fault byte"
" is: 0b" BYTE_TO_BINARY_PATTERN "\n",
BYTE_TO_BINARY(faultByte));
#endif
#endif
//#if OBSW_VERBOSE_LEVEL >= 1
//#if FSFW_CPP_OSTREAM_ENABLED == 1
// sif::warning << "Max31865PT1000Handler::interpretDeviceReply: Object ID: " << std::hex
// << this->getObjectId()
// << ": Fault byte"
// " is: 0b"
// << std::bitset<8>(faultByte) << std::endl;
//#else
// sif::printWarning(
// "Max31865PT1000Handler::interpretDeviceReply: Fault byte"
// " is: 0b" BYTE_TO_BINARY_PATTERN "\n",
// BYTE_TO_BINARY(faultByte));
//#endif
//#endif
ReturnValue_t result = sensorDataset.read();
if (result != HasReturnvaluesIF::RETURN_OK) {
// Configuration error