switch to new dev handlers completely
EIVE/eive-obsw/pipeline/pr-develop This commit looks good Details

This commit is contained in:
Robin Müller 2022-05-14 15:26:08 +02:00
parent 478975db26
commit 2cfd2cc1fc
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
1 changed files with 13 additions and 38 deletions

View File

@ -286,54 +286,29 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
{objects::RTD_15_IC18_IMTQ, "RTD_15_IMTQ"},
}};
std::array<SpiCookie*, NUM_RTDS> rtdCookies = {};
std::array<DeviceHandlerBase*, NUM_RTDS> rtds = {};
std::array<Max31865EiveHandler*, NUM_RTDS> rtds = {};
RtdFdir* rtdFdir = nullptr;
bool useDirectHandler = false;
if (not useDirectHandler) {
// Create special low level reader communication interface
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
}
auto directRtdsCreator = [&](uint8_t idx) {
auto typedHandler =
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 =
new Max31865ReaderCookie(rtdInfos[idx].first, idx, rtdInfos[idx].second, rtdCookies[idx]);
auto typedHandler =
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, 5);
#endif
#if OBSW_TEST_RTD == 1
typedHandler->setInstantNormal(true);
#endif
};
// Create special low level reader communication interface
new Max31865RtdReader(objects::SPI_RTD_COM_IF, comIF, gpioComIF);
for (uint8_t idx = 0; idx < NUM_RTDS; idx++) {
rtdCookies[idx] = new SpiCookie(cookieArgs[idx].first, cookieArgs[idx].second,
MAX31865::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
rtdCookies[idx]->setMutexParams(MutexIF::TimeoutType::WAITING, spi::RTD_CS_TIMEOUT);
if (useDirectHandler) {
directRtdsCreator(idx);
} else {
lowLevelRtdsCreator(idx);
}
Max31865ReaderCookie* rtdLowLevelCookie =
new Max31865ReaderCookie(rtdInfos[idx].first, idx, rtdInfos[idx].second, rtdCookies[idx]);
rtds[idx] =
new Max31865EiveHandler(rtdInfos[idx].first, objects::SPI_RTD_COM_IF, rtdLowLevelCookie);
rtds[idx]->setDeviceInfo(idx, rtdInfos[idx].second);
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, 5);
#endif
#if OBSW_TEST_RTD == 1
rtds[idx]->setInstantNormal(true);
rtds[idx]->setStartUpImmediately();
#endif // OBSW_TEST_RTD == 1
#endif
}
TcsBoardHelper helper(rtdInfos);