From 2cfd2cc1fc380bec7857d32dc915598d6b00f7e0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 14 May 2022 15:26:08 +0200 Subject: [PATCH] switch to new dev handlers completely --- linux/ObjectFactory.cpp | 51 +++++++++++------------------------------ 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index c9d446e2..f84cf52f 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -286,54 +286,29 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, {objects::RTD_15_IC18_IMTQ, "RTD_15_IMTQ"}, }}; std::array rtdCookies = {}; - std::array rtds = {}; + std::array 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);