v1.12.0 #269
@ -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
|
||||
};
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user