From 7ce24ef392eb550248f7b5af08987eeb79425b0d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 11:12:43 +0100 Subject: [PATCH 01/22] update TMP1075 dev handlers --- bsp_q7s/core/ObjectFactory.cpp | 8 ++++---- mission/devices/Tmp1075Handler.cpp | 4 ++++ mission/devices/Tmp1075Handler.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index f5397e04..326b4edc 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -129,12 +129,12 @@ void ObjectFactory::createTmpComponents() { new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV); /* Temperature sensors */ - Tmp1075Handler* tmp1075Handler_1 = + Tmp1075Handler* tmp1075Handler1 = new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1); - (void)tmp1075Handler_1; - Tmp1075Handler* tmp1075Handler_2 = + tmp1075Handler1->setModeNormal(); + Tmp1075Handler* tmp1075Handler2 = new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2); - (void)tmp1075Handler_2; + tmp1075Handler2->setModeNormal(); } void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index 22d72999..4b7cff57 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -127,3 +127,7 @@ ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &local subdp::RegularHkPeriodicParams(dataset.getSid(), false, 30.0)); return returnvalue::OK; } + +void Tmp1075Handler::setModeNormal() { + setMode(_MODE_TO_NORMAL); +} diff --git a/mission/devices/Tmp1075Handler.h b/mission/devices/Tmp1075Handler.h index 3077cf1a..7d0c0fbf 100644 --- a/mission/devices/Tmp1075Handler.h +++ b/mission/devices/Tmp1075Handler.h @@ -20,6 +20,7 @@ class Tmp1075Handler : public DeviceHandlerBase { Tmp1075Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie); virtual ~Tmp1075Handler(); + void setModeNormal(); protected: void doStartUp() override; void doShutDown() override; From a21e938f36529a5e1b158283dced4476d4111029 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 11:41:40 +0100 Subject: [PATCH 02/22] renamed cookie as well --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++------ fsfw | 2 +- linux/ObjectFactory.cpp | 2 +- linux/boardtest/UartTestClass.cpp | 2 +- linux/boardtest/UartTestClass.h | 2 +- linux/devices/ScexUartReader.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index f5397e04..6dc08ca1 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -572,8 +572,8 @@ void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitc } void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { - UartCookie* syrlinksUartCookie = - new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, + auto* syrlinksUartCookie = + new SerialCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinksUartCookie->setParityEven(); @@ -602,7 +602,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC); gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC"); auto mpsocCookie = - new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD, + new SerialCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); mpsocCookie->setNoFixedSizeReply(); auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); @@ -619,7 +619,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv); gpioComIF->addGpios(supvGpioCookie); auto supervisorCookie = - new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, + new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supervisorCookie->setNoFixedSizeReply(); auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER); @@ -905,8 +905,8 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { } void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) { - UartCookie* starTrackerCookie = - new UartCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD, + auto* starTrackerCookie = + new SerialCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD, startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL); starTrackerCookie->setNoFixedSizeReply(); StrHelper* strHelper = new StrHelper(objects::STR_HELPER); diff --git a/fsfw b/fsfw index 39946bff..e03e7f52 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 39946bff58db7c5ac9016ca3156abb059560d9cb +Subproject commit e03e7f5260eb92d1903188c5ea14ea01616600ae diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 21f884f9..e35d7e96 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -326,7 +326,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher, SdCardMountedIF& mountedIF, bool onImmediately, std::optional switchId) { - auto* cookie = new UartCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096); + auto* cookie = new SerialCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096); cookie->setTwoStopBits(); // cookie->setParityEven(); auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER); diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 2c914d74..51ea237f 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -164,7 +164,7 @@ void UartTestClass::scexInit() { #else std::string devname = "/dev/ul-scex"; #endif - uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); + uartCookie = new SerialCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); reader->setDebugMode(false); ReturnValue_t result = reader->initializeInterface(uartCookie); if (result != OK) { diff --git a/linux/boardtest/UartTestClass.h b/linux/boardtest/UartTestClass.h index 6304724b..05776bc0 100644 --- a/linux/boardtest/UartTestClass.h +++ b/linux/boardtest/UartTestClass.h @@ -57,7 +57,7 @@ class UartTestClass : public TestTask { scex::Cmds currCmd = scex::Cmds::PING; TestModes mode = TestModes::GPS; DleEncoder dleEncoder = DleEncoder(); - UartCookie* uartCookie = nullptr; + SerialCookie* uartCookie = nullptr; size_t encodedLen = 0; lwgps_t gpsData = {}; struct termios tty = {}; diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index ce59472d..6f615014 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -84,7 +84,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { - UartCookie *uartCookie = dynamic_cast(cookie); + SerialCookie *uartCookie = dynamic_cast(cookie); if (uartCookie == nullptr) { return FAILED; } From 081538004426d5e5f5aed88f5dcfecf18397eb81 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 16:24:44 +0100 Subject: [PATCH 03/22] create all available TMP devices --- bsp_q7s/core/ObjectFactory.cpp | 38 +++--- common/config/eive/objects.h | 8 +- dummies/TemperatureSensorsDummy.cpp | 4 +- linux/fsfwconfig/devices/addresses.h | 8 +- .../pollingSequenceFactory.cpp | 114 +++++++++++------- mission/controller/ThermalController.cpp | 4 +- mission/devices/Tmp1075Handler.cpp | 4 +- mission/devices/Tmp1075Handler.h | 1 + 8 files changed, 112 insertions(+), 69 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 5245caa7..f05dfc46 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -123,18 +123,26 @@ void Factory::setStaticFrameworkObjectIds() { void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::createTmpComponents() { - I2cCookie* i2cCookieTmp1075tcs1 = - new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV); - I2cCookie* i2cCookieTmp1075tcs2 = - new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV); + std::array, 6> tmpDevIds = {{ + {objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0}, + {objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1}, + {objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0}, + {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, + {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, + {objects::TMP1075_HANDLER_OBC_IF_BOARD, addresses::TMP1075_OBC_IF_BOARD}, + }}; + std::vector tmpDevCookies; - /* Temperature sensors */ - Tmp1075Handler* tmp1075Handler1 = - new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1); - tmp1075Handler1->setModeNormal(); - Tmp1075Handler* tmp1075Handler2 = - new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2); - tmp1075Handler2->setModeNormal(); + for (size_t idx = 0; idx < tmpDevIds.size(); idx++) { + tmpDevCookies.push_back( + new I2cCookie(tmpDevIds[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV)); + auto* tmpDevHandler = + new Tmp1075Handler(tmpDevIds[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]); + // TODO: Remove this after TCS subsystem was added + // These devices are connected to the 3V3 stack and should be powered permanently. Therefore, + // we set them to normal mode immediately here. + tmpDevHandler->setModeNormal(); + } } void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, @@ -574,7 +582,7 @@ void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitc void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { auto* syrlinksUartCookie = new SerialCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD, - syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); + syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); syrlinksUartCookie->setParityEven(); auto syrlinksFdir = new SyrlinksFdir(objects::SYRLINKS_HK_HANDLER); @@ -603,7 +611,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC"); auto mpsocCookie = new SerialCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD, - mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); + mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); mpsocCookie->setNoFixedSizeReply(); auto plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); auto* mpsocHandler = new PlocMPSoCHandler( @@ -620,7 +628,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit gpioComIF->addGpios(supvGpioCookie); auto supervisorCookie = new SerialCookie(objects::PLOC_SUPERVISOR_HANDLER, q7s::UART_PLOC_SUPERVSIOR_DEV, - uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); + uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supervisorCookie->setNoFixedSizeReply(); auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER); auto* supvHandler = new PlocSupervisorHandler( @@ -907,7 +915,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) { auto* starTrackerCookie = new SerialCookie(objects::STAR_TRACKER, q7s::UART_STAR_TRACKER_DEV, uart::STAR_TRACKER_BAUD, - startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL); + startracker::MAX_FRAME_SIZE * 2 + 2, UartModes::NON_CANONICAL); starTrackerCookie->setNoFixedSizeReply(); StrHelper* strHelper = new StrHelper(objects::STR_HELPER); auto starTracker = diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index 5b9ec8a0..f44c6354 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -39,8 +39,12 @@ enum commonObjects : uint32_t { GPS_CONTROLLER = 0x44130045, IMTQ_HANDLER = 0x44140014, - TMP1075_HANDLER_1 = 0x44420004, - TMP1075_HANDLER_2 = 0x44420005, + TMP1075_HANDLER_TCS_0 = 0x44420004, + TMP1075_HANDLER_TCS_1 = 0x44420005, + TMP1075_HANDLER_PLPCDU_0 = 0x44420006, + TMP1075_HANDLER_PLPCDU_1 = 0x44420007, + TMP1075_HANDLER_IF_BOARD = 0x44420008, + TMP1075_HANDLER_OBC_IF_BOARD = 0x44420009, PCDU_HANDLER = 0x442000A1, P60DOCK_HANDLER = 0x44250000, PDU1_HANDLER = 0x44250001, diff --git a/dummies/TemperatureSensorsDummy.cpp b/dummies/TemperatureSensorsDummy.cpp index c580473a..52190ee8 100644 --- a/dummies/TemperatureSensorsDummy.cpp +++ b/dummies/TemperatureSensorsDummy.cpp @@ -23,8 +23,8 @@ TemperatureSensorsDummy::TemperatureSensorsDummy() ObjectManager::instance()->insert(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, this); ObjectManager::instance()->insert(objects::RTD_14_IC17_TCS_BOARD, this); ObjectManager::instance()->insert(objects::RTD_15_IC18_IMTQ, this); - ObjectManager::instance()->insert(objects::TMP1075_HANDLER_1, this); - ObjectManager::instance()->insert(objects::TMP1075_HANDLER_2, this); + ObjectManager::instance()->insert(objects::TMP1075_HANDLER_TCS_0, this); + ObjectManager::instance()->insert(objects::TMP1075_HANDLER_TCS_1, this); } ReturnValue_t TemperatureSensorsDummy::initialize() { diff --git a/linux/fsfwconfig/devices/addresses.h b/linux/fsfwconfig/devices/addresses.h index ec794490..1395569b 100644 --- a/linux/fsfwconfig/devices/addresses.h +++ b/linux/fsfwconfig/devices/addresses.h @@ -46,8 +46,12 @@ enum logicalAddresses : address_t { enum i2cAddresses : address_t { BPX_BATTERY = 0x07, IMTQ = 0x10, - TMP1075_TCS_1 = 0x48, - TMP1075_TCS_2 = 0x49, + TMP1075_TCS_0 = 0x48, + TMP1075_TCS_1 = 0x49, + TMP1075_PLPCDU_0 = 0x4A, + TMP1075_PLPCDU_1 = 0x4B, + TMP1075_IF_BOARD = 0x4C, + TMP1075_OBC_IF_BOARD = 0x4D }; enum spiAddresses : address_t { diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index e7f753bd..7b577b26 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -55,30 +55,6 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::PLPCDU_HANDLER, length * 0, DeviceHandlerIF::GET_READ); #endif -#if OBSW_ADD_TMP_DEVICES == 1 - 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_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_TMP_DEVICES == 1 - thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::GET_WRITE); -#endif - -#if OBSW_ADD_TMP_DEVICES == 1 - thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_READ); -#endif - -#if OBSW_ADD_TMP_DEVICES == 1 - thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::GET_READ); -#endif #if OBSW_ADD_SUN_SENSORS == 1 @@ -430,28 +406,80 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { uint32_t length = thisSequence->getPeriodMs(); static_cast(length); #if OBSW_ADD_MGT == 1 - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::IMTQ_HANDLER, length * 0, DeviceHandlerIF::GET_READ); #endif #if OBSW_ADD_BPX_BATTERY_HANDLER == 1 - thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, + DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ); +#endif +#if OBSW_ADD_TMP_DEVICES == 1 + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, + DeviceHandlerIF::GET_READ); #endif static_cast(length); return thisSequence->checkSequence(); diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 66fa2187..603fb0e0 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -38,8 +38,8 @@ ThermalController::ThermalController(object_id_t objectId) EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set14(objects::RTD_14_IC17_TCS_BOARD, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set15(objects::RTD_15_IC18_IMTQ, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), - tmp1075Set1(objects::TMP1075_HANDLER_1), - tmp1075Set2(objects::TMP1075_HANDLER_2), + tmp1075Set1(objects::TMP1075_HANDLER_TCS_0), + tmp1075Set2(objects::TMP1075_HANDLER_TCS_1), susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB), susSet2(objects::SUS_2_N_LOC_XFYBZB_PT_YB), diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index 4b7cff57..1946aa5a 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -128,6 +128,4 @@ ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &local return returnvalue::OK; } -void Tmp1075Handler::setModeNormal() { - setMode(_MODE_TO_NORMAL); -} +void Tmp1075Handler::setModeNormal() { setMode(_MODE_TO_NORMAL); } diff --git a/mission/devices/Tmp1075Handler.h b/mission/devices/Tmp1075Handler.h index 7d0c0fbf..6840db0f 100644 --- a/mission/devices/Tmp1075Handler.h +++ b/mission/devices/Tmp1075Handler.h @@ -21,6 +21,7 @@ class Tmp1075Handler : public DeviceHandlerBase { virtual ~Tmp1075Handler(); void setModeNormal(); + protected: void doStartUp() override; void doShutDown() override; From d4de445112a0f7fe6a3e654873aebe9bef87e7f5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 16:26:16 +0100 Subject: [PATCH 04/22] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 348e7023..33604f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ list yields a list of all related PRs for each release. - MAX3185 Low Level Handler and Device Handler: Simplifications and bugfixes to allow switching off without triggering unrequested replies PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/313 +- Add remaining missing TMP1075 device handlers. + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/318 # [v1.15.0] 27.10.2022 From 6261296a0a1362434920e2d7ea56ae7c75b49359 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 17:01:19 +0100 Subject: [PATCH 05/22] there is an issue.. --- bsp_q7s/OBSWConfig.h.in | 1 + .../pollingSequenceFactory.cpp | 94 +++++++++---------- mission/devices/Tmp1075Handler.cpp | 2 +- 3 files changed, 49 insertions(+), 48 deletions(-) diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 840e2575..499d8e6b 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -104,6 +104,7 @@ #define OBSW_PRINT_CORE_HK 0 #define OBSW_DEBUG_PDU1 0 #define OBSW_DEBUG_PDU2 0 +#define OBSW_DEBUG_TMP1075 0 #define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_SYRLINKS 0 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 7b577b26..47245acc 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -427,59 +427,59 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.2, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.25, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.25, DeviceHandlerIF::GET_READ); #endif #if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, +// DeviceHandlerIF::GET_READ); #endif static_cast(length); return thisSequence->checkSequence(); diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index 1946aa5a..56e83ab7 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -86,7 +86,7 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id, const u int16_t tempValueRaw = 0; tempValueRaw = packet[0] << 4 | packet[1] >> 4; float tempValue = ((static_cast(tempValueRaw)) * 0.0625); -#if OBSW_VERBOSE_LEVEL >= 1 +#if OBSW_DEBUG_TMP1075 == 1 sif::info << "Tmp1075 with object id: 0x" << std::hex << getObjectId() << ": Temperature: " << tempValue << " °C" << std::endl; #endif From 1a17770bbc827f9661e6c8fceb08de802bebb268 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 18:52:12 +0100 Subject: [PATCH 06/22] all TMP1075 dev except the OBC IF board one working --- bsp_q7s/boardconfig/busConf.h | 3 +- bsp_q7s/core/ObjectFactory.cpp | 9 ++- .../pollingSequenceFactory.cpp | 70 +++++++++---------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 1db53d3e..7b50af4e 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -8,7 +8,8 @@ static constexpr uint32_t SPI_MAIN_BUS_LOCK_TIMEOUT = 50; static constexpr char SPI_RW_DEV[] = "/dev/spi_rw"; -static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c_eive"; +static constexpr char I2C_PL_EIVE[] = "/dev/i2c_eive"; +static constexpr char I2C_PS_EIVE[] = "/dev/i2c-2"; static constexpr char UART_GNSS_DEV[] = "/dev/gps0"; static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul_plmpsoc"; diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index f05dfc46..83d6d1c1 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -135,7 +135,7 @@ void ObjectFactory::createTmpComponents() { for (size_t idx = 0; idx < tmpDevIds.size(); idx++) { tmpDevCookies.push_back( - new I2cCookie(tmpDevIds[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_DEFAULT_DEV)); + new I2cCookie(tmpDevIds[idx].second, TMP1075::MAX_REPLY_LENGTH, q7s::I2C_PS_EIVE)); auto* tmpDevHandler = new Tmp1075Handler(tmpDevIds[idx].first, objects::I2C_COM_IF, tmpDevCookies[idx]); // TODO: Remove this after TCS subsystem was added @@ -904,7 +904,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { new SpiTestClass(objects::SPI_TEST, gpioComIF); #endif #if OBSW_ADD_I2C_TEST_CODE == 1 - new I2cTestClass(objects::I2C_TEST, q7s::I2C_DEFAULT_DEV); + new I2cTestClass(objects::I2C_TEST, q7s::I2C_PL_EIVE); #endif #if OBSW_ADD_UART_TEST_CODE == 1 // auto* reader= new ScexUartReader(objects::SCEX_UART_READER); @@ -926,8 +926,7 @@ void ObjectFactory::createStrComponents(PowerSwitchIF* pwrSwitcher) { } void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher) { - I2cCookie* imtqI2cCookie = - new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); + I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_PL_EIVE); auto imtqHandler = new ImtqHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie, pcdu::Switches::PDU1_CH3_MGT_5V); imtqHandler->setPowerSwitcher(pwrSwitcher); @@ -943,7 +942,7 @@ void ObjectFactory::createImtqComponents(PowerSwitchIF* pwrSwitcher) { } void ObjectFactory::createBpxBatteryComponent() { - I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_DEFAULT_DEV); + I2cCookie* bpxI2cCookie = new I2cCookie(addresses::BPX_BATTERY, 100, q7s::I2C_PL_EIVE); BpxBatteryHandler* bpxHandler = new BpxBatteryHandler(objects::BPX_BATT_HANDLER, objects::I2C_COM_IF, bpxI2cCookie); bpxHandler->setStartUpImmediately(); diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 47245acc..cb30ce5a 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -433,43 +433,43 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { #if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_1, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_0, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_PLPCDU_1, length * 0.4, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, From ee6bb4df3bdc641eb5c334f0396bf2170029fc75 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Nov 2022 18:56:34 +0100 Subject: [PATCH 07/22] add some informative comments --- linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index cb30ce5a..af7175a3 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -401,6 +401,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { return thisSequence->checkSequence(); } +// I don't think this needs to be in a PST because linux takes care of bus serialization, but +// keep it like this for now, it works ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { // Length of a communication cycle uint32_t length = thisSequence->getPeriodMs(); @@ -430,6 +432,7 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.25, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::BPX_BATT_HANDLER, length * 0.25, DeviceHandlerIF::GET_READ); #endif + // These are actually part of another bus, but this works, so keep it like this for now #if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_TCS_0, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION); From a855920fb2df88c5ba714e62516c59f399f01bd2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 09:12:15 +0100 Subject: [PATCH 08/22] README update, I2C addr update --- README.md | 16 ++++++++++++---- bsp_q7s/core/ObjectFactory.cpp | 4 ++-- linux/fsfwconfig/devices/addresses.h | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 040bc5ed..f68eb210 100644 --- a/README.md +++ b/README.md @@ -1108,11 +1108,19 @@ cat /proc/tty/driver ## I2C -Getting information about I2C device -```` +Getting information about some I2C device + +```sh ls /sys/class/i2c-dev/i2c-0/device/device/driver -```` -This shows the memory mapping of /dev/i2c-0 +``` +This shows the memory mapping of `/dev/i2c-0`. + +You can use the `i2cdetect` utility to scan for I2C devices. +For example, to do this for bus 0 (`/dev/i2c-0`), you can use + +```sh +i2cdetect -r -y 0 +``` ## CAN diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 83d6d1c1..bc2d7562 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -128,8 +128,8 @@ void ObjectFactory::createTmpComponents() { {objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1}, {objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0}, {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, - {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, - {objects::TMP1075_HANDLER_OBC_IF_BOARD, addresses::TMP1075_OBC_IF_BOARD}, + {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD_0}, + {objects::TMP1075_HANDLER_OBC_IF_BOARD, addresses::TMP1075_IF_BOARD_1}, }}; std::vector tmpDevCookies; diff --git a/linux/fsfwconfig/devices/addresses.h b/linux/fsfwconfig/devices/addresses.h index 1395569b..ce936fcb 100644 --- a/linux/fsfwconfig/devices/addresses.h +++ b/linux/fsfwconfig/devices/addresses.h @@ -50,8 +50,8 @@ enum i2cAddresses : address_t { TMP1075_TCS_1 = 0x49, TMP1075_PLPCDU_0 = 0x4A, TMP1075_PLPCDU_1 = 0x4B, - TMP1075_IF_BOARD = 0x4C, - TMP1075_OBC_IF_BOARD = 0x4D + TMP1075_IF_BOARD_0 = 0x4C, + TMP1075_IF_BOARD_1 = 0x4D }; enum spiAddresses : address_t { From a39ff34a0ab6ead2070098f220973b45abede5ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 09:13:20 +0100 Subject: [PATCH 09/22] re-name enum --- linux/fsfwconfig/devices/addresses.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/fsfwconfig/devices/addresses.h b/linux/fsfwconfig/devices/addresses.h index ce936fcb..d87eacb4 100644 --- a/linux/fsfwconfig/devices/addresses.h +++ b/linux/fsfwconfig/devices/addresses.h @@ -43,7 +43,7 @@ enum logicalAddresses : address_t { DUMMY_GPS1 = 131, }; -enum i2cAddresses : address_t { +enum I2cAddress : address_t { BPX_BATTERY = 0x07, IMTQ = 0x10, TMP1075_TCS_0 = 0x48, From d51c088afd39c5c8f26d9028705a23bb8ed2f2f3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 09:16:17 +0100 Subject: [PATCH 10/22] there is only one tmp1075 left --- bsp_q7s/core/ObjectFactory.cpp | 5 ++--- linux/fsfwconfig/devices/addresses.h | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index bc2d7562..fc9240a0 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -123,13 +123,12 @@ void Factory::setStaticFrameworkObjectIds() { void ObjectFactory::setStatics() { Factory::setStaticFrameworkObjectIds(); } void ObjectFactory::createTmpComponents() { - std::array, 6> tmpDevIds = {{ + std::array, 5> tmpDevIds = {{ {objects::TMP1075_HANDLER_TCS_0, addresses::TMP1075_TCS_0}, {objects::TMP1075_HANDLER_TCS_1, addresses::TMP1075_TCS_1}, {objects::TMP1075_HANDLER_PLPCDU_0, addresses::TMP1075_PLPCDU_0}, {objects::TMP1075_HANDLER_PLPCDU_1, addresses::TMP1075_PLPCDU_1}, - {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD_0}, - {objects::TMP1075_HANDLER_OBC_IF_BOARD, addresses::TMP1075_IF_BOARD_1}, + {objects::TMP1075_HANDLER_IF_BOARD, addresses::TMP1075_IF_BOARD}, }}; std::vector tmpDevCookies; diff --git a/linux/fsfwconfig/devices/addresses.h b/linux/fsfwconfig/devices/addresses.h index d87eacb4..d7056307 100644 --- a/linux/fsfwconfig/devices/addresses.h +++ b/linux/fsfwconfig/devices/addresses.h @@ -50,8 +50,7 @@ enum I2cAddress : address_t { TMP1075_TCS_1 = 0x49, TMP1075_PLPCDU_0 = 0x4A, TMP1075_PLPCDU_1 = 0x4B, - TMP1075_IF_BOARD_0 = 0x4C, - TMP1075_IF_BOARD_1 = 0x4D + TMP1075_IF_BOARD = 0x4C, }; enum spiAddresses : address_t { From 31f6a865d3a7f4a7b7d106a0a940096f80612316 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 09:19:34 +0100 Subject: [PATCH 11/22] remove unused code --- .../pollingsequence/pollingSequenceFactory.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index af7175a3..f10043b5 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -473,16 +473,6 @@ ReturnValue_t pst::pstI2c(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_IF_BOARD, length * 0.4, DeviceHandlerIF::GET_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::TMP1075_HANDLER_OBC_IF_BOARD, length * 0.4, -// DeviceHandlerIF::GET_READ); #endif static_cast(length); return thisSequence->checkSequence(); From 012590273fe65d18f32c4e9b3688c2c95abcaa37 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 10:04:41 +0100 Subject: [PATCH 12/22] add missing TMP1075 devs in TCS ctrl --- mission/controller/ThermalController.cpp | 65 ++++++++++++++----- mission/controller/ThermalController.h | 7 +- .../ThermalControllerDefinitions.h | 17 +++-- 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 603fb0e0..7e5ded8b 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -38,8 +38,11 @@ ThermalController::ThermalController(object_id_t objectId) EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set14(objects::RTD_14_IC17_TCS_BOARD, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set15(objects::RTD_15_IC18_IMTQ, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), - tmp1075Set1(objects::TMP1075_HANDLER_TCS_0), - tmp1075Set2(objects::TMP1075_HANDLER_TCS_1), + tmp1075SetTcs0(objects::TMP1075_HANDLER_TCS_0), + tmp1075SetTcs1(objects::TMP1075_HANDLER_TCS_1), + tmp1075SetPlPcdu0(objects::TMP1075_HANDLER_PLPCDU_0), + tmp1075SetPlPcdu1(objects::TMP1075_HANDLER_PLPCDU_1), + tmp1075SetIfBoard(objects::TMP1075_HANDLER_IF_BOARD), susSet0(objects::SUS_0_N_LOC_XFYFZM_PT_XF), susSet1(objects::SUS_1_N_LOC_XBYFZM_PT_XB), susSet2(objects::SUS_2_N_LOC_XFYBZB_PT_YB), @@ -128,9 +131,9 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo new PoolEntry({14.0})); localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER, new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_1, + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_2, + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, new PoolEntry({15.0})); localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF, @@ -415,23 +418,53 @@ void ThermalController::copySensors() { } { - PoolReadGuard pg111(&tmp1075Set1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); - if (pg111.getReadResult() == returnvalue::OK) { - sensorTemperatures.sensor_tmp1075_1.value = tmp1075Set1.temperatureCelcius.value; - sensorTemperatures.sensor_tmp1075_1.setValid(tmp1075Set1.temperatureCelcius.isValid()); - if (not tmp1075Set1.temperatureCelcius.isValid()) { - sensorTemperatures.sensor_tmp1075_1.value = INVALID_TEMPERATURE; + PoolReadGuard pg(&tmp1075SetTcs0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075Tcs0.value = tmp1075SetTcs0.temperatureCelcius.value; + sensorTemperatures.tmp1075Tcs0.setValid(tmp1075SetTcs0.temperatureCelcius.isValid()); + if (not tmp1075SetTcs0.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075Tcs0.value = INVALID_TEMPERATURE; } } } { - PoolReadGuard pg112(&tmp1075Set2, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); - if (pg112.getReadResult() == returnvalue::OK) { - sensorTemperatures.sensor_tmp1075_2.value = tmp1075Set2.temperatureCelcius.value; - sensorTemperatures.sensor_tmp1075_2.setValid(tmp1075Set2.temperatureCelcius.isValid()); - if (not tmp1075Set2.temperatureCelcius.isValid()) { - sensorTemperatures.sensor_tmp1075_2.value = INVALID_TEMPERATURE; + PoolReadGuard pg(&tmp1075SetTcs1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075Tcs1.value = tmp1075SetTcs1.temperatureCelcius.value; + sensorTemperatures.tmp1075Tcs1.setValid(tmp1075SetTcs1.temperatureCelcius.isValid()); + if (not tmp1075SetTcs1.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075Tcs1.value = INVALID_TEMPERATURE; + } + } + } + { + PoolReadGuard pg(&tmp1075SetPlPcdu0, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075PlPcdu0.value = tmp1075SetPlPcdu0.temperatureCelcius.value; + sensorTemperatures.tmp1075PlPcdu0.setValid(tmp1075SetPlPcdu0.temperatureCelcius.isValid()); + if (not tmp1075SetPlPcdu0.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075PlPcdu0.value = INVALID_TEMPERATURE; + } + } + } + { + PoolReadGuard pg(&tmp1075SetPlPcdu1, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075PlPcdu1.value = tmp1075SetPlPcdu1.temperatureCelcius.value; + sensorTemperatures.tmp1075PlPcdu1.setValid(tmp1075SetPlPcdu1.temperatureCelcius.isValid()); + if (not tmp1075SetPlPcdu1.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075PlPcdu1.value = INVALID_TEMPERATURE; + } + } + } + { + PoolReadGuard pg(&tmp1075SetIfBoard, MutexIF::TimeoutType::WAITING, MUTEX_TIMEOUT); + if (pg.getReadResult() == returnvalue::OK) { + sensorTemperatures.tmp1075IfBrd.value = tmp1075SetIfBoard.temperatureCelcius.value; + sensorTemperatures.tmp1075IfBrd.setValid(tmp1075SetIfBoard.temperatureCelcius.isValid()); + if (not tmp1075SetIfBoard.temperatureCelcius.isValid()) { + sensorTemperatures.tmp1075IfBrd.value = INVALID_TEMPERATURE; } } } diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 76366d0c..9fabae71 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -55,8 +55,11 @@ class ThermalController : public ExtendedControllerBase { MAX31865::Max31865Set max31865Set13; MAX31865::Max31865Set max31865Set14; MAX31865::Max31865Set max31865Set15; - TMP1075::Tmp1075Dataset tmp1075Set1; - TMP1075::Tmp1075Dataset tmp1075Set2; + TMP1075::Tmp1075Dataset tmp1075SetTcs0; + TMP1075::Tmp1075Dataset tmp1075SetTcs1; + TMP1075::Tmp1075Dataset tmp1075SetPlPcdu0; + TMP1075::Tmp1075Dataset tmp1075SetPlPcdu1; + TMP1075::Tmp1075Dataset tmp1075SetIfBoard; // SUS SUS::SusDataset susSet0; diff --git a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h index c2824c58..6eaa28e4 100644 --- a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h @@ -30,8 +30,11 @@ enum PoolIds : lp_id_t { SENSOR_PLPCDU_HEATSPREADER, SENSOR_TCS_BOARD, SENSOR_MAGNETTORQUER, - SENSOR_TMP1075_1, - SENSOR_TMP1075_2, + SENSOR_TMP1075_TCS_0, + SENSOR_TMP1075_TCS_1, + SENSOR_TMP1075_PLPCDU_0, + SENSOR_TMP1075_PLPCDU_1, + SENSOR_TMP1075_IF_BOARD, SUS_0_N_LOC_XFYFZM_PT_XF, SUS_6_R_LOC_XFYBZM_PT_XF, @@ -111,8 +114,14 @@ class SensorTemperatures : public StaticLocalDataSet sensor_tcs_board = lp_var_t(sid.objectId, PoolIds::SENSOR_TCS_BOARD, this); lp_var_t sensor_magnettorquer = lp_var_t(sid.objectId, PoolIds::SENSOR_MAGNETTORQUER, this); - lp_var_t sensor_tmp1075_1 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_1, this); - lp_var_t sensor_tmp1075_2 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_2, this); + lp_var_t tmp1075Tcs0 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_TCS_0, this); + lp_var_t tmp1075Tcs1 = lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_TCS_1, this); + lp_var_t tmp1075PlPcdu0 = + lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_PLPCDU_0, this); + lp_var_t tmp1075PlPcdu1 = + lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_PLPCDU_1, this); + lp_var_t tmp1075IfBrd = + lp_var_t(sid.objectId, PoolIds::SENSOR_TMP1075_IF_BOARD, this); }; /** From 876c2b36bfb4822938b1391bd07bea8e68a7f334 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 10:11:44 +0100 Subject: [PATCH 13/22] add missing tmp devs in ctrel map as well --- mission/controller/ThermalController.cpp | 9 +++++---- mission/controller/ThermalController.h | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 7e5ded8b..45f26f8b 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -131,10 +131,11 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo new PoolEntry({14.0})); localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_MAGNETTORQUER, new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, - new PoolEntry({15.0})); - localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, - new PoolEntry({15.0})); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_0, &tmp1075Tcs0); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_TCS_1, &tmp1075Tcs1); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_PLPCDU_0, &tmp1075PlPcdu0); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_PLPCDU_1, &tmp1075PlPcdu1); + localDataPoolMap.emplace(thermalControllerDefinitions::SENSOR_TMP1075_IF_BOARD, &tmp1075IfBrd); localDataPoolMap.emplace(thermalControllerDefinitions::SUS_0_N_LOC_XFYFZM_PT_XF, new PoolEntry({0.0})); diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 9fabae71..5071d811 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -78,6 +78,12 @@ class ThermalController : public ExtendedControllerBase { // Initial delay to make sure all pool variables have been initialized their owners Countdown initialCountdown = Countdown(DELAY); + PoolEntry tmp1075Tcs0 = PoolEntry(10.0); + PoolEntry tmp1075Tcs1 = PoolEntry(10.0); + PoolEntry tmp1075PlPcdu0 = PoolEntry(10.0); + PoolEntry tmp1075PlPcdu1 = PoolEntry(10.0); + PoolEntry tmp1075IfBrd = PoolEntry(10.0); + static constexpr dur_millis_t MUTEX_TIMEOUT = 50; void copySensors(); void copySus(); From 0d08a282b4652955fe6cf426163ce383d56ab9fc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 17:05:46 +0100 Subject: [PATCH 14/22] fix for set capacity --- .../controllerdefinitions/ThermalControllerDefinitions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h index 6eaa28e4..9f800bec 100644 --- a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h @@ -78,7 +78,7 @@ enum PoolIds : lp_id_t { TEMP_ADC_PAYLOAD_PCDU }; -static const uint8_t ENTRIES_SENSOR_TEMPERATURE_SET = 18; +static const uint8_t ENTRIES_SENSOR_TEMPERATURE_SET = 25; static const uint8_t ENTRIES_DEVICE_TEMPERATURE_SET = 25; static const uint8_t ENTRIES_SUS_TEMPERATURE_SET = 12; From 89af06a3109881899f0ed37b84b3f8c4b4e66bbc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Nov 2022 17:10:41 +0100 Subject: [PATCH 15/22] update object list --- generators/bsp_q7s_objects.csv | 8 +++++-- generators/events/translateEvents.cpp | 2 +- generators/objects/translateObjects.cpp | 24 ++++++++++++++----- linux/fsfwconfig/events/translateEvents.cpp | 2 +- linux/fsfwconfig/objects/translateObjects.cpp | 24 ++++++++++++++----- tmtc | 2 +- 6 files changed, 45 insertions(+), 17 deletions(-) diff --git a/generators/bsp_q7s_objects.csv b/generators/bsp_q7s_objects.csv index 10ac10ed..bca5b872 100644 --- a/generators/bsp_q7s_objects.csv +++ b/generators/bsp_q7s_objects.csv @@ -50,8 +50,12 @@ 0x44330032;SCEX 0x444100A2;SOLAR_ARRAY_DEPL_HANDLER 0x444100A4;HEATER_HANDLER -0x44420004;TMP1075_HANDLER_1 -0x44420005;TMP1075_HANDLER_2 +0x44420004;TMP1075_HANDLER_TCS_0 +0x44420005;TMP1075_HANDLER_TCS_1 +0x44420006;TMP1075_HANDLER_PLPCDU_0 +0x44420007;TMP1075_HANDLER_PLPCDU_1 +0x44420008;TMP1075_HANDLER_IF_BOARD +0x44420009;TMP1075_HANDLER_OBC_IF_BOARD 0x44420016;RTD_0_IC3_PLOC_HEATSPREADER 0x44420017;RTD_1_IC4_PLOC_MISSIONBOARD 0x44420018;RTD_2_IC5_4K_CAMERA diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 87c790d7..ee85e05c 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 234 translations. * @details - * Generated on: 2022-11-10 18:07:26 + * Generated on: 2022-11-14 17:10:10 */ #include "translateEvents.h" diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index cfb7f9a5..96a2d656 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 144 translations. - * Generated on: 2022-11-10 18:07:26 + * Contains 148 translations. + * Generated on: 2022-11-14 17:10:10 */ #include "translateObjects.h" @@ -58,8 +58,12 @@ const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; const char *SCEX_STRING = "SCEX"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; -const char *TMP1075_HANDLER_1_STRING = "TMP1075_HANDLER_1"; -const char *TMP1075_HANDLER_2_STRING = "TMP1075_HANDLER_2"; +const char *TMP1075_HANDLER_TCS_0_STRING = "TMP1075_HANDLER_TCS_0"; +const char *TMP1075_HANDLER_TCS_1_STRING = "TMP1075_HANDLER_TCS_1"; +const char *TMP1075_HANDLER_PLPCDU_0_STRING = "TMP1075_HANDLER_PLPCDU_0"; +const char *TMP1075_HANDLER_PLPCDU_1_STRING = "TMP1075_HANDLER_PLPCDU_1"; +const char *TMP1075_HANDLER_IF_BOARD_STRING = "TMP1075_HANDLER_IF_BOARD"; +const char *TMP1075_HANDLER_OBC_IF_BOARD_STRING = "TMP1075_HANDLER_OBC_IF_BOARD"; const char *RTD_0_IC3_PLOC_HEATSPREADER_STRING = "RTD_0_IC3_PLOC_HEATSPREADER"; const char *RTD_1_IC4_PLOC_MISSIONBOARD_STRING = "RTD_1_IC4_PLOC_MISSIONBOARD"; const char *RTD_2_IC5_4K_CAMERA_STRING = "RTD_2_IC5_4K_CAMERA"; @@ -258,9 +262,17 @@ const char *translateObject(object_id_t object) { case 0x444100A4: return HEATER_HANDLER_STRING; case 0x44420004: - return TMP1075_HANDLER_1_STRING; + return TMP1075_HANDLER_TCS_0_STRING; case 0x44420005: - return TMP1075_HANDLER_2_STRING; + return TMP1075_HANDLER_TCS_1_STRING; + case 0x44420006: + return TMP1075_HANDLER_PLPCDU_0_STRING; + case 0x44420007: + return TMP1075_HANDLER_PLPCDU_1_STRING; + case 0x44420008: + return TMP1075_HANDLER_IF_BOARD_STRING; + case 0x44420009: + return TMP1075_HANDLER_OBC_IF_BOARD_STRING; case 0x44420016: return RTD_0_IC3_PLOC_HEATSPREADER_STRING; case 0x44420017: diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 87c790d7..ee85e05c 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** * @brief Auto-generated event translation file. Contains 234 translations. * @details - * Generated on: 2022-11-10 18:07:26 + * Generated on: 2022-11-14 17:10:10 */ #include "translateEvents.h" diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index cfb7f9a5..96a2d656 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -1,8 +1,8 @@ /** * @brief Auto-generated object translation file. * @details - * Contains 144 translations. - * Generated on: 2022-11-10 18:07:26 + * Contains 148 translations. + * Generated on: 2022-11-14 17:10:10 */ #include "translateObjects.h" @@ -58,8 +58,12 @@ const char *PLOC_SUPERVISOR_HELPER_STRING = "PLOC_SUPERVISOR_HELPER"; const char *SCEX_STRING = "SCEX"; const char *SOLAR_ARRAY_DEPL_HANDLER_STRING = "SOLAR_ARRAY_DEPL_HANDLER"; const char *HEATER_HANDLER_STRING = "HEATER_HANDLER"; -const char *TMP1075_HANDLER_1_STRING = "TMP1075_HANDLER_1"; -const char *TMP1075_HANDLER_2_STRING = "TMP1075_HANDLER_2"; +const char *TMP1075_HANDLER_TCS_0_STRING = "TMP1075_HANDLER_TCS_0"; +const char *TMP1075_HANDLER_TCS_1_STRING = "TMP1075_HANDLER_TCS_1"; +const char *TMP1075_HANDLER_PLPCDU_0_STRING = "TMP1075_HANDLER_PLPCDU_0"; +const char *TMP1075_HANDLER_PLPCDU_1_STRING = "TMP1075_HANDLER_PLPCDU_1"; +const char *TMP1075_HANDLER_IF_BOARD_STRING = "TMP1075_HANDLER_IF_BOARD"; +const char *TMP1075_HANDLER_OBC_IF_BOARD_STRING = "TMP1075_HANDLER_OBC_IF_BOARD"; const char *RTD_0_IC3_PLOC_HEATSPREADER_STRING = "RTD_0_IC3_PLOC_HEATSPREADER"; const char *RTD_1_IC4_PLOC_MISSIONBOARD_STRING = "RTD_1_IC4_PLOC_MISSIONBOARD"; const char *RTD_2_IC5_4K_CAMERA_STRING = "RTD_2_IC5_4K_CAMERA"; @@ -258,9 +262,17 @@ const char *translateObject(object_id_t object) { case 0x444100A4: return HEATER_HANDLER_STRING; case 0x44420004: - return TMP1075_HANDLER_1_STRING; + return TMP1075_HANDLER_TCS_0_STRING; case 0x44420005: - return TMP1075_HANDLER_2_STRING; + return TMP1075_HANDLER_TCS_1_STRING; + case 0x44420006: + return TMP1075_HANDLER_PLPCDU_0_STRING; + case 0x44420007: + return TMP1075_HANDLER_PLPCDU_1_STRING; + case 0x44420008: + return TMP1075_HANDLER_IF_BOARD_STRING; + case 0x44420009: + return TMP1075_HANDLER_OBC_IF_BOARD_STRING; case 0x44420016: return RTD_0_IC3_PLOC_HEATSPREADER_STRING; case 0x44420017: diff --git a/tmtc b/tmtc index 89285ad5..66a1362e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 89285ad511ef11582b67b307c3840a09efd0577a +Subproject commit 66a1362e7e977e427a66fd3176a9e7b6bc1b5998 From 5690e35a58dd13a05bb2a363c8db804910a72b77 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 09:55:23 +0100 Subject: [PATCH 16/22] bump fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index e03e7f52..00284510 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e03e7f5260eb92d1903188c5ea14ea01616600ae +Subproject commit 002845108d24abe9fbb26618f004f04ccb160938 From 6c568102337c680fc0e7d6e8266016d1586f9421 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 09:55:38 +0100 Subject: [PATCH 17/22] bump fsfw --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 66a1362e..89285ad5 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 66a1362e7e977e427a66fd3176a9e7b6bc1b5998 +Subproject commit 89285ad511ef11582b67b307c3840a09efd0577a From f6729cb3b45c4c7b3a7ea7b081615bf03a09353f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 13:20:12 +0100 Subject: [PATCH 18/22] bump deps --- fsfw | 2 +- tmtc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsfw b/fsfw index 00284510..c5f91926 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 002845108d24abe9fbb26618f004f04ccb160938 +Subproject commit c5f91926c95a8db0c7921176aa3f62cc2bebef47 diff --git a/tmtc b/tmtc index 89285ad5..66a1362e 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 89285ad511ef11582b67b307c3840a09efd0577a +Subproject commit 66a1362e7e977e427a66fd3176a9e7b6bc1b5998 From 9da5a55ef31b3bfdde4239f0c94bf148e3c6a57c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 13:32:05 +0100 Subject: [PATCH 19/22] lets see if that works --- CMakeLists.txt | 7 +++++-- bsp_linux_board/CMakeLists.txt | 1 + linux/CMakeLists.txt | 5 ++++- linux/InitMission.cpp | 1 + linux/boardtest/SpiTestClass.cpp | 27 ++++++++++++++++----------- linux/boardtest/UartTestClass.cpp | 3 ++- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddf101a4..97b7601c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,7 +233,7 @@ set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/arcsec_star_tracker) set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json) set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF) -set(EIVE_ADD_LINUX_FILES False) +set(EIVE_ADD_LINUX_FILES OFF) # Analyse different OS and architecture/target options, determine BSP_PATH, # display information about compiler etc. @@ -253,12 +253,15 @@ if(TGT_BSP) set(FSFW_CONFIG_PATH "linux/fsfwconfig") if(NOT BUILD_Q7S_SIMPLE_MODE) set(EIVE_ADD_LINUX_FILES TRUE) + set(EIVE_ADD_LINUX_FSFWCONFIG TRUE) set(ADD_GOMSPACE_CSP TRUE) set(ADD_GOMSPACE_CLIENTS TRUE) set(FSFW_HAL_ADD_LINUX ON) set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON) set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON) endif() + elseif(UNIX) + set(EIVE_ADD_LINUX_FILES ON) endif() if(TGT_BSP MATCHES "arm/raspberrypi") @@ -393,7 +396,7 @@ if(EIVE_ADD_JSON_LIB) add_subdirectory(${LIB_JSON_PATH}) endif() -add_subdirectory(thirdparty/rapidcsv) +add_subdirectory(thirdparty) if(EIVE_ADD_LINUX_FILES) add_subdirectory(${LIB_ARCSEC_PATH}) diff --git a/bsp_linux_board/CMakeLists.txt b/bsp_linux_board/CMakeLists.txt index c1817ac1..39f06401 100644 --- a/bsp_linux_board/CMakeLists.txt +++ b/bsp_linux_board/CMakeLists.txt @@ -3,3 +3,4 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp gpioInit.cpp add_subdirectory(boardconfig) add_subdirectory(boardtest) +add_subdirectory(fsfwconfig) diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index d7e6ca93..f8c8935f 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -3,7 +3,10 @@ add_subdirectory(utility) add_subdirectory(callbacks) add_subdirectory(boardtest) add_subdirectory(devices) -add_subdirectory(fsfwconfig) add_subdirectory(ipcore) +if(EIVE_ADD_LINUX_FSFWCONFIG) + add_subdirectory(fsfwconfig) +endif() + target_sources(${OBSW_NAME} PUBLIC ObjectFactory.cpp InitMission.cpp) diff --git a/linux/InitMission.cpp b/linux/InitMission.cpp index 5bc8698c..4b7dc1f1 100644 --- a/linux/InitMission.cpp +++ b/linux/InitMission.cpp @@ -6,6 +6,7 @@ #include "OBSWConfig.h" #include "ObjectFactory.h" +#include "eive/objects.h" void scheduling::schedulingScex(TaskFactory& factory, PeriodicTaskIF*& scexDevHandler, PeriodicTaskIF*& scexReaderTask) { diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index dc5a5e3b..91e8893c 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -333,14 +333,12 @@ void SpiTestClass::performPeriodicMax1227Test() { } void SpiTestClass::performMax1227Test() { + std::string deviceName = ""; #ifdef XIPHOS_Q7S - std::string deviceName = q7s::SPI_DEFAULT_DEV; + deviceName = q7s::SPI_DEFAULT_DEV; #elif defined(RASPBERRY_PI) - std::string deviceName = ""; #elif defined(EGSE) - std::string deviceName = ""; #elif defined(TE0720_1CFA) - std::string deviceName = ""; #endif int fd = 0; UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface"); @@ -381,8 +379,9 @@ void SpiTestClass::max1227RadSensorTest(int fd) { DiffSel::NONE_0); spiTransferStruct[0].len = 1; transfer(fd, gpioIds::CS_RAD_SENSOR); - max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 7, spiTransferStruct[0].len); - size_t tmpLen = spiTransferStruct[0].len; + size_t tmpSz = spiTransferStruct[0].len; + max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 7, tmpSz); + size_t tmpLen = tmpSz; spiTransferStruct[0].len = 1; transfer(fd, gpioIds::CS_RAD_SENSOR); std::memcpy(sendBuffer.data(), sendBuffer.data() + 1, tmpLen - 1); @@ -403,7 +402,8 @@ void SpiTestClass::max1227RadSensorTest(int fd) { for (int idx = 0; idx < 8; idx++) { sif::info << "ADC raw " << idx << ": " << adcRaw[idx] << std::endl; } - max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), spiTransferStruct[0].len); + tmpSz = spiTransferStruct[0].len; + max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data(), tmpSz); spiTransferStruct[0].len = 1; transfer(fd, gpioIds::CS_RAD_SENSOR); usleep(65); @@ -467,7 +467,8 @@ void SpiTestClass::max1227SusTest(int fd, SusTestCfg &cfg) { spiTransferStruct[0].len = 1; transfer(fd, cfg.gpioId); - max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 5, spiTransferStruct[0].len); + size_t tmpSz = spiTransferStruct[0].len; + max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), 5, tmpSz); transfer(fd, cfg.gpioId); uint16_t adcRaw[6] = {}; adcRaw[0] = (recvBuffer[1] << 8) | recvBuffer[2]; @@ -552,7 +553,9 @@ void SpiTestClass::max1227PlPcduTest(int fd) { spiTransferStruct[0].len = 1; transfer(fd, gpioIds::PLPCDU_ADC_CS); uint8_t n = 11; - max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len); + size_t tmpSz = spiTransferStruct[0].len; + max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, tmpSz); + spiTransferStruct[0].len = tmpSz; size_t dummy = 0; max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len, dummy); @@ -585,9 +588,11 @@ void SpiTestClass::max1227PlPcduTest(int fd) { spiTransferStruct[0].len = 1; transfer(fd, gpioIds::PLPCDU_ADC_CS); uint8_t n = 11; - max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, spiTransferStruct[0].len); + size_t tmpLen = spiTransferStruct[0].len; + max1227::prepareExternallyClockedRead0ToN(sendBuffer.data(), n, tmpLen); max1227::prepareExternallyClockedTemperatureRead(sendBuffer.data() + spiTransferStruct[0].len, - spiTransferStruct[0].len); + tmpLen); + spiTransferStruct[0].len = tmpLen; transfer(fd, gpioIds::PLPCDU_ADC_CS); uint16_t adcRaw[n + 1] = {}; for (uint8_t idx = 0; idx < n + 1; idx++) { diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 51ea237f..1f707c8f 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -13,6 +13,7 @@ #include #include "OBSWConfig.h" +#include "eive/objects.h" #include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/DleEncoder.h" #include "fsfw/globalfunctions/arrayprinter.h" @@ -164,7 +165,7 @@ void UartTestClass::scexInit() { #else std::string devname = "/dev/ul-scex"; #endif - uartCookie = new SerialCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); + uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); reader->setDebugMode(false); ReturnValue_t result = reader->initializeInterface(uartCookie); if (result != OK) { From 478e3b92374d67279d4092232ca27ef880a271fa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 13:33:53 +0100 Subject: [PATCH 20/22] add thirdparty CMakeLists.txt --- thirdparty/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 thirdparty/CMakeLists.txt diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt new file mode 100644 index 00000000..68ea851d --- /dev/null +++ b/thirdparty/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(rapidcsv) From 3c469e5c7a1ab5a1f9d7f42213d61b03f8fe258a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 13:35:18 +0100 Subject: [PATCH 21/22] uart test class tweak --- linux/boardtest/UartTestClass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 1f707c8f..def7da8b 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -165,7 +165,7 @@ void UartTestClass::scexInit() { #else std::string devname = "/dev/ul-scex"; #endif - uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); + uartCookie = new SerialCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096); reader->setDebugMode(false); ReturnValue_t result = reader->initializeInterface(uartCookie); if (result != OK) { From 7384c5ce16d4d104b00b7b7e602a7f54cc11ae65 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 15 Nov 2022 13:41:39 +0100 Subject: [PATCH 22/22] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33604f09..acef9e92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ list yields a list of all related PRs for each release. # [unreleased] +- It is now possible to compile Linux components for the hosted build conditionally + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/322 - ACS Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231 - Payload Subsystem. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/231 - Add IRQ mode for PDEC handler. PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/310