From ad168f18b3d88d5cfa59c123e507e850921d1f10 Mon Sep 17 00:00:00 2001 From: Irini Kosmidou Date: Thu, 24 Nov 2022 19:41:57 +0100 Subject: [PATCH] bugfixes --- bsp_hosted/ObjectFactory.cpp | 14 ++++++++++---- dummies/CMakeLists.txt | 3 ++- dummies/DummyHeaterHandler.cpp | 6 ++++++ dummies/DummyHeaterHandler.h | 13 +++++++++++++ dummies/TemperatureSensorInserter.cpp | 2 +- fsfw | 2 +- linux/ObjectFactory.cpp | 13 ------------- linux/ObjectFactory.h | 3 ++- mission/core/GenericFactory.cpp | 24 ++++++++++++++++++++++++ mission/core/GenericFactory.h | 6 ++++++ mission/devices/HeaterHandler.h | 3 ++- tmtc | 2 +- 12 files changed, 68 insertions(+), 23 deletions(-) create mode 100644 dummies/DummyHeaterHandler.cpp create mode 100644 dummies/DummyHeaterHandler.h diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 07e3163b..0c62efc2 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -10,10 +10,8 @@ #include "OBSWConfig.h" #include "devConf.h" -#include "eive/definitions.h" #include "fsfw/platform.h" #include "fsfw_tests/integration/task/TestTask.h" -#include "tmtc/pusIds.h" #if OBSW_USE_TMTC_TCP_BRIDGE == 0 #include "fsfw/osal/common/UdpTcPollingTask.h" @@ -79,7 +77,7 @@ void ObjectFactory::produce(void* args) { CfdpTmFunnel* cfdpFunnel; ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel); - DummyGpioIF* dummyGpioIF = new DummyGpioIF(); + auto* dummyGpioIF = new DummyGpioIF(); auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0); static_cast(dummyGpioIF); #ifdef PLATFORM_UNIX @@ -109,6 +107,14 @@ void ObjectFactory::produce(void* args) { dummy::DummyCfg cfg; dummy::createDummies(cfg, *dummySwitcher); - new ThermalController(objects::THERMAL_CONTROLLER); + + HeaterHandler* heaterHandler = nullptr; + //new ThermalController(objects::THERMAL_CONTROLLER); + ObjectFactory::createGenericHeaterComponents(*dummyGpioIF, *dummySwitcher, heaterHandler); + if(heaterHandler == nullptr){ + sif::error << "HeaterHandler could not be created" << std::endl; + }else{ + ObjectFactory::createThermalController(*heaterHandler); + } new TestTask(objects::TEST_TASK); } diff --git a/dummies/CMakeLists.txt b/dummies/CMakeLists.txt index 4f486f8a..6b499d7b 100644 --- a/dummies/CMakeLists.txt +++ b/dummies/CMakeLists.txt @@ -19,4 +19,5 @@ target_sources( PlPcduDummy.cpp CoreControllerDummy.cpp helpers.cpp - MgmRm3100Dummy.cpp) + MgmRm3100Dummy.cpp +DummyHeaterHandler.cpp) diff --git a/dummies/DummyHeaterHandler.cpp b/dummies/DummyHeaterHandler.cpp new file mode 100644 index 00000000..d006038e --- /dev/null +++ b/dummies/DummyHeaterHandler.cpp @@ -0,0 +1,6 @@ +// +// Created by irini on 24.11.22. +// +#include "DummyHeaterHandler.h" + + diff --git a/dummies/DummyHeaterHandler.h b/dummies/DummyHeaterHandler.h new file mode 100644 index 00000000..b0628c09 --- /dev/null +++ b/dummies/DummyHeaterHandler.h @@ -0,0 +1,13 @@ +// +// Created by irini on 24.11.22. +// + +#ifndef EIVE_OBSW_DUMMYHEATERHANDLER_H +#define EIVE_OBSW_DUMMYHEATERHANDLER_H + +#include "mission/devices/HeaterHandler.h" +class DummyHeaterHandler: public HeaterHandler{ + public: + //DummyHeaterHandler(); +}; +#endif // EIVE_OBSW_DUMMYHEATERHANDLER_H diff --git a/dummies/TemperatureSensorInserter.cpp b/dummies/TemperatureSensorInserter.cpp index ed71968c..314f7496 100644 --- a/dummies/TemperatureSensorInserter.cpp +++ b/dummies/TemperatureSensorInserter.cpp @@ -6,7 +6,7 @@ #include TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId) - : SystemObject(objects::THERMAL_CONTROLLER), + : SystemObject(objects::THERMAL_TEMP_INSERTER), max31865PlocHeatspreaderSet(objects::RTD_0_IC3_PLOC_HEATSPREADER, MAX31865::MAX31865_SET_ID), max31865PlocMissionboardSet(objects::RTD_1_IC4_PLOC_MISSIONBOARD, MAX31865::MAX31865_SET_ID) { } diff --git a/fsfw b/fsfw index 160ff799..c5f91926 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 160ff799ace61e24708dcf1fdeaf5fafdf23a4ca +Subproject commit c5f91926c95a8db0c7921176aa3f62cc2bebef47 diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index e35d7e96..6ca221f1 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -9,23 +9,14 @@ #include #include #include -#include #include -#include -#include -#include #include -#include -#include -#include #include "OBSWConfig.h" #include "devConf.h" #include "devices/addresses.h" #include "devices/gpioIds.h" #include "eive/definitions.h" -#include "mission/system/objects/SusAssembly.h" -#include "mission/system/objects/TcsBoardAssembly.h" #include "mission/system/tree/acsModeTree.h" #include "mission/system/tree/payloadModeTree.h" @@ -340,10 +331,6 @@ void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwr scexHandler->connectModeTreeParent(satsystem::pl::SUBSYSTEM); } -void ObjectFactory::createThermalController() { - new ThermalController(objects::THERMAL_CONTROLLER); -} - AcsController* ObjectFactory::createAcsController(bool connectSubsystem) { auto acsCtrl = new AcsController(objects::ACS_CONTROLLER); if (connectSubsystem) { diff --git a/linux/ObjectFactory.h b/linux/ObjectFactory.h index 3704e9bd..10b70df0 100644 --- a/linux/ObjectFactory.h +++ b/linux/ObjectFactory.h @@ -11,6 +11,8 @@ #include #include +#include "mission/devices/HeaterHandler.h" + class GpioIF; class SpiComIF; class PowerSwitchIF; @@ -29,7 +31,6 @@ void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher, void gpioChecker(ReturnValue_t result, std::string output); -void createThermalController(); AcsController* createAcsController(bool connectSubsystem); void addTmtcIpCoresToFunnels(CcsdsIpCoreHandler& ipCoreHandler, PusTmFunnel& pusFunnel, diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 114451b2..c881c3e1 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -36,8 +36,12 @@ #if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_USE_TMTC_TCP_BRIDGE == 0 // UDP server includes +#include "devices/gpioIds.h" #include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTmTcBridge.h" +#include "mission/controller/ThermalController.h" +#include "mission/devices/HeaterHandler.h" +#include "mission/devices/devicedefinitions/GomspaceDefinitions.h" #else // TCP server includes #include "fsfw/osal/common/TcpTmTcBridge.h" @@ -179,3 +183,23 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun ccsdsDistrib->registerApplication(info); #endif } + +void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, HeaterHandler*& heaterHandler) { + HeaterHelper helper({{ + {new HealthDevice(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE), + gpioIds::HEATER_0}, + {new HealthDevice(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_1}, + {new HealthDevice(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2}, + {new HealthDevice(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3}, + {new HealthDevice(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4}, + {new HealthDevice(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5}, + {new HealthDevice(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6}, + {new HealthDevice(objects::HEATER_7_HPA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_7}, + }}); + heaterHandler = new HeaterHandler(objects::HEATER_HANDLER, &gpioIF, helper, &pwrSwitcher, + pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V); +} + +void ObjectFactory::createThermalController(HeaterHandler& heaterHandler) { + new ThermalController(objects::THERMAL_CONTROLLER, heaterHandler); +} \ No newline at end of file diff --git a/mission/core/GenericFactory.h b/mission/core/GenericFactory.h index 2e2b0748..1704ef11 100644 --- a/mission/core/GenericFactory.h +++ b/mission/core/GenericFactory.h @@ -1,6 +1,10 @@ #ifndef MISSION_CORE_GENERICFACTORY_H_ #define MISSION_CORE_GENERICFACTORY_H_ +#include "fsfw_hal/common/gpio/GpioIF.h" +#include "fsfw/power/PowerSwitchIF.h" + +class HeaterHandler; class HealthTableIF; class PusTmFunnel; class CfdpTmFunnel; @@ -9,7 +13,9 @@ namespace ObjectFactory { void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel, CfdpTmFunnel** cfdpFunnel); +void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, HeaterHandler*& heaterHandler); +void createThermalController(HeaterHandler& heaterHandler); } #endif /* MISSION_CORE_GENERICFACTORY_H_ */ diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 271e1bd1..caa90bc4 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -15,6 +15,7 @@ #include #include +#include #include #include "devices/heaterSwitcherList.h" @@ -28,7 +29,7 @@ using HeaterPair = std::pair; struct HeaterHelper { public: - HeaterHelper(std::array heaters) : heaters(heaters) {} + HeaterHelper(std::array heaters) : heaters(std::move(heaters)) {} std::array heaters = {}; }; /** diff --git a/tmtc b/tmtc index 292bafa0..d5813e1a 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 292bafa0918d386e7f64bf9ed0e114a887420899 +Subproject commit d5813e1a422beae7d0cb092a885e0956e9f1ddc1