diff --git a/CMakeLists.txt b/CMakeLists.txt index ef87352e..66adc209 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -175,6 +175,7 @@ set(LIB_CXX_FS -lstdc++fs) set(LIB_CATCH2 Catch2) set(LIB_GPS gps) set(LIB_JSON_NAME nlohmann_json::nlohmann_json) +set(LIB_DUMMIES dummies) # Set path names set(FSFW_PATH fsfw) @@ -182,6 +183,7 @@ set(TEST_PATH test) set(UNITTEST_PATH unittest) set(LINUX_PATH linux) set(COMMON_PATH common) +set(DUMMY_PATH dummies) set(WATCHDOG_PATH watchdog) set(COMMON_CONFIG_PATH ${COMMON_PATH}/config) set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg) @@ -312,6 +314,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") endif() add_library(${LIB_EIVE_MISSION}) +add_library(${LIB_DUMMIES}) # Add main executable add_executable(${OBSW_NAME}) @@ -357,6 +360,7 @@ if(ADD_CSP_LIB) endif() add_subdirectory(${COMMON_PATH}) +add_subdirectory(${DUMMY_PATH}) add_subdirectory(${LIB_LWGPS_PATH}) add_subdirectory(${FSFW_PATH}) @@ -429,15 +433,18 @@ endif() # Add libraries target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_FSFW_NAME} ${LIB_LWGPS_NAME} ${LIB_OS_NAME}) + +target_link_libraries(${LIB_DUMMIES} + PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME}) -target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_EIVE_MISSION}) +target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_EIVE_MISSION} ${LIB_DUMMIES}) if(TGT_BSP MATCHES "arm/q7s") target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC}) endif() target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} - rapidcsv) + rapidcsv ${LIB_DUMMIES}) if(TGT_BSP MATCHES "arm/egse") target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) @@ -461,6 +468,10 @@ target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_CXX_FS}) target_include_directories( ${LIB_EIVE_MISSION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH} ${CMAKE_CURRENT_BINARY_DIR} ${LIB_ARCSEC_PATH}) + +target_include_directories( + ${LIB_DUMMIES} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH} + ${CMAKE_CURRENT_BINARY_DIR}) if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse") target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH}) diff --git a/bsp_hosted/CMakeLists.txt b/bsp_hosted/CMakeLists.txt index 2e979ff4..2804977d 100644 --- a/bsp_hosted/CMakeLists.txt +++ b/bsp_hosted/CMakeLists.txt @@ -2,4 +2,3 @@ target_sources(${OBSW_NAME} PUBLIC InitMission.cpp main.cpp ObjectFactory.cpp) add_subdirectory(fsfwconfig) add_subdirectory(boardconfig) -add_subdirectory(dummies) diff --git a/bsp_hosted/InitMission.cpp b/bsp_hosted/InitMission.cpp index 6f85ad2c..c2fbf139 100644 --- a/bsp_hosted/InitMission.cpp +++ b/bsp_hosted/InitMission.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -148,11 +149,23 @@ void initmission::initTasks() { initmission::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF); } - result = thermalTask->addComponent(objects::THERMAL_CONTROLLER); + result = thermalTask->addComponent(objects::CORE_CONTROLLER); if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER); + initmission::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER); } + result = thermalTask->addComponent(objects::THERMAL_CONTROLLER); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER); + } + + FixedTimeslotTaskIF* pstTask = factory->createFixedTimeslotTask( + "DUMMY_PST", 75, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5, missedDeadlineFunc); + result = dummy_pst::pst(pstTask); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "Failed to add dummy pst to fixed timeslot task" << std::endl; + } + #if OBSW_ADD_TEST_CODE == 1 result = testTask->addComponent(objects::TEST_TASK); if (result != HasReturnvaluesIF::RETURN_OK) { @@ -171,6 +184,7 @@ void initmission::initTasks() { pusMedPrio->startTask(); pusLowPrio->startTask(); + pstTask->startTask(); thermalTask->startTask(); #if OBSW_ADD_TEST_CODE == 1 diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index e7fa270f..0cc4ac31 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -4,8 +4,8 @@ #include #include #include -#include #include +#include #include #include @@ -26,8 +26,23 @@ #include #endif -#include "dummies/TemperatureSensorsDummy.h" -#include "dummies/SusDummy.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; @@ -48,7 +63,28 @@ void ObjectFactory::produce(void* args) { Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); - + new ComIFDummy(objects::DUMMY_COM_IF); + ComCookieDummy* comCookieDummy = new ComCookieDummy(); + new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new CoreControllerDummy(objects::CORE_CONTROLLER); + new RwDummy(objects::RW1, objects::DUMMY_COM_IF, comCookieDummy); + new RwDummy(objects::RW2, objects::DUMMY_COM_IF, comCookieDummy); + new RwDummy(objects::RW3, objects::DUMMY_COM_IF, comCookieDummy); + new RwDummy(objects::RW4, objects::DUMMY_COM_IF, comCookieDummy); + new StarTrackerDummy(objects::STAR_TRACKER, objects::DUMMY_COM_IF, comCookieDummy); + new SyrlinksDummy(objects::SYRLINKS_HK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new GyroAdisDummy(objects::GYRO_0_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new GyroL3GD20Dummy(objects::GYRO_1_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new GyroAdisDummy(objects::GYRO_2_ADIS_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new GyroL3GD20Dummy(objects::GYRO_3_L3G_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new MgmLIS3MDLDummy(objects::MGM_0_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new MgmLIS3MDLDummy(objects::MGM_2_LIS3_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + new PlPcduDummy(objects::PLPCDU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new TemperatureSensorsDummy(); new SusDummy(); new ThermalController(objects::THERMAL_CONTROLLER, objects::NO_OBJECT); diff --git a/bsp_hosted/dummies/CMakeLists.txt b/bsp_hosted/dummies/CMakeLists.txt deleted file mode 100644 index a875e22d..00000000 --- a/bsp_hosted/dummies/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -target_sources(${OBSW_NAME} PUBLIC TemperatureSensorsDummy.cpp SusDummy.cpp) diff --git a/bsp_hosted/dummies/SusDummy.cpp b/bsp_hosted/dummies/SusDummy.cpp deleted file mode 100644 index 439046a5..00000000 --- a/bsp_hosted/dummies/SusDummy.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "SusDummy.h" - -#include - -#include -#include - -SusDummy::SusDummy() - : ExtendedControllerBase(objects::SUS_0_N_LOC_XFYFZM_PT_XF, objects::NO_OBJECT), - susSet(this) { - ObjectManager::instance()->insert(objects::SUS_6_R_LOC_XFYBZM_PT_XF, this); - ObjectManager::instance()->insert(objects::SUS_1_N_LOC_XBYFZM_PT_XB, this); - ObjectManager::instance()->insert(objects::SUS_7_R_LOC_XBYBZM_PT_XB, this); - ObjectManager::instance()->insert(objects::SUS_2_N_LOC_XFYBZB_PT_YB, this); - ObjectManager::instance()->insert(objects::SUS_8_R_LOC_XBYBZB_PT_YB, this); - ObjectManager::instance()->insert(objects::SUS_3_N_LOC_XFYBZF_PT_YF, this); - ObjectManager::instance()->insert(objects::SUS_9_R_LOC_XBYBZB_PT_YF, this); - ObjectManager::instance()->insert(objects::SUS_4_N_LOC_XMYFZF_PT_ZF, this); - ObjectManager::instance()->insert(objects::SUS_10_N_LOC_XMYBZF_PT_ZF, this); - ObjectManager::instance()->insert(objects::SUS_5_N_LOC_XFYMZB_PT_ZB, this); - ObjectManager::instance()->insert(objects::SUS_11_R_LOC_XBYMZB_PT_ZB, this); -} - -ReturnValue_t SusDummy::initialize() { - static bool done = false; - if (not done) { - done = true; - ReturnValue_t result = ExtendedControllerBase::initialize(); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - } - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t SusDummy::handleCommandMessage(CommandMessage* message) { - return RETURN_FAILED; -} - -void SusDummy::performControlOperation() { - iteration++; - value = sin(iteration / 80. * M_PI + 10) * 10 - 10; - - susSet.read(); - susSet.temperatureCelcius = value; - if ((iteration % 100) < 20) { - susSet.setValidity(false, true); - } else { - susSet.setValidity(true, true); - } - susSet.commit(); -} - -ReturnValue_t SusDummy::initializeLocalDataPool( - localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { - localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, - new PoolEntry({0}, 1, true)); - localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC, new PoolEntry({0})); - - return RETURN_OK; -} - -LocalPoolDataSetBase* SusDummy::getDataSetHandle(sid_t sid) { - switch (sid.ownerSetId) { - case SUS::SUS_DATA_SET_ID: - return &susSet; - default: - return nullptr; - } -} - -ReturnValue_t SusDummy::checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t* msToReachTheMode) { - if (submode != SUBMODE_NONE) { - return INVALID_SUBMODE; - } - if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { - return INVALID_MODE; - } - return RETURN_OK; -} diff --git a/bsp_hosted/dummies/SusDummy.h b/bsp_hosted/dummies/SusDummy.h deleted file mode 100644 index bdabaafc..00000000 --- a/bsp_hosted/dummies/SusDummy.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include - -class SusDummy : public ExtendedControllerBase { - public: - SusDummy(); - - ReturnValue_t initialize() override; - - protected: - virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; - virtual void performControlOperation() override; - virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) override; - virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; - - // Mode abstract functions - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t* msToReachTheMode) override; - - private: - int iteration = 0; - float value = 0; - SUS::SusDataset susSet; -}; \ No newline at end of file diff --git a/bsp_hosted/dummies/TemperatureSensorsDummy.cpp b/bsp_hosted/dummies/TemperatureSensorsDummy.cpp deleted file mode 100644 index b32b3fec..00000000 --- a/bsp_hosted/dummies/TemperatureSensorsDummy.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "TemperatureSensorsDummy.h" - -#include - -#include -#include - -TemperatureSensorsDummy::TemperatureSensorsDummy() - : ExtendedControllerBase(objects::RTD_0_IC3_PLOC_HEATSPREADER, objects::NO_OBJECT), - max31865Set(this, MAX31865::MAX31865_SET_ID) { - ObjectManager::instance()->insert(objects::RTD_1_IC4_PLOC_MISSIONBOARD, this); - ObjectManager::instance()->insert(objects::RTD_2_IC5_4K_CAMERA, this); - ObjectManager::instance()->insert(objects::RTD_3_IC6_DAC_HEATSPREADER, this); - ObjectManager::instance()->insert(objects::RTD_4_IC7_STARTRACKER, this); - ObjectManager::instance()->insert(objects::RTD_5_IC8_RW1_MX_MY, this); - ObjectManager::instance()->insert(objects::RTD_6_IC9_DRO, this); - ObjectManager::instance()->insert(objects::RTD_7_IC10_SCEX, this); - ObjectManager::instance()->insert(objects::RTD_8_IC11_X8, this); - ObjectManager::instance()->insert(objects::RTD_9_IC12_HPA, this); - ObjectManager::instance()->insert(objects::RTD_10_IC13_PL_TX, this); - ObjectManager::instance()->insert(objects::RTD_11_IC14_MPA, this); - ObjectManager::instance()->insert(objects::RTD_12_IC15_ACU, this); - 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); -} - -ReturnValue_t TemperatureSensorsDummy::initialize() { - static bool done = false; - if (not done) { - done = true; - ReturnValue_t result = ExtendedControllerBase::initialize(); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - } - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t TemperatureSensorsDummy::handleCommandMessage(CommandMessage* message) { - return RETURN_FAILED; -} - -void TemperatureSensorsDummy::performControlOperation() { - iteration++; - value = sin(iteration / 80. * M_PI) * 10; - - ReturnValue_t result = max31865Set.read(); - if (result != RETURN_OK) { - sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl; - } - max31865Set.rtdValue = value - 5; - max31865Set.temperatureCelcius = value; - if ((iteration % 100) < 20) { - max31865Set.setValidity(false, true); - } else { - max31865Set.setValidity(true, true); - } - max31865Set.commit(); -} - -ReturnValue_t TemperatureSensorsDummy::initializeLocalDataPool( - localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { - localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::RTD_VALUE), - new PoolEntry({0})); - localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::TEMPERATURE_C), - new PoolEntry({0})); - localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::LAST_FAULT_BYTE), - new PoolEntry({0})); - localDataPoolMap.emplace(static_cast(MAX31865::PoolIds::FAULT_BYTE), - new PoolEntry({0})); - - return RETURN_OK; -} - -LocalPoolDataSetBase* TemperatureSensorsDummy::getDataSetHandle(sid_t sid) { - sif::debug << "getHandle" << std::endl; - switch (sid.ownerSetId) { - case MAX31865::MAX31865_SET_ID: - return &max31865Set; - default: - return nullptr; - } -} - -ReturnValue_t TemperatureSensorsDummy::checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t* msToReachTheMode) { - if (submode != SUBMODE_NONE) { - return INVALID_SUBMODE; - } - if ((mode != MODE_OFF) && (mode != MODE_ON) && (mode != MODE_NORMAL)) { - return INVALID_MODE; - } - return RETURN_OK; -} diff --git a/bsp_hosted/dummies/TemperatureSensorsDummy.h b/bsp_hosted/dummies/TemperatureSensorsDummy.h deleted file mode 100644 index e41a9af0..00000000 --- a/bsp_hosted/dummies/TemperatureSensorsDummy.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include - -class TemperatureSensorsDummy : public ExtendedControllerBase { - public: - TemperatureSensorsDummy(); - - ReturnValue_t initialize() override; - - protected: - virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override; - virtual void performControlOperation() override; - virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) override; - virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; - - // Mode abstract functions - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t* msToReachTheMode) override; - - private: - int iteration = 0; - float value = 0; - MAX31865::Max31865Set max31865Set; - - void noise(); -}; diff --git a/bsp_hosted/fsfwconfig/CMakeLists.txt b/bsp_hosted/fsfwconfig/CMakeLists.txt index d5b5e7e5..95e43c2e 100644 --- a/bsp_hosted/fsfwconfig/CMakeLists.txt +++ b/bsp_hosted/fsfwconfig/CMakeLists.txt @@ -13,3 +13,5 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") target_sources(${OBSW_NAME} PRIVATE events/translateEvents.cpp) target_sources(${UNITTEST_NAME} PRIVATE events/translateEvents.cpp) endif() + +add_subdirectory(pollingsequence) diff --git a/bsp_hosted/fsfwconfig/objects/systemObjectList.h b/bsp_hosted/fsfwconfig/objects/systemObjectList.h index 91bd2bed..008c7b80 100644 --- a/bsp_hosted/fsfwconfig/objects/systemObjectList.h +++ b/bsp_hosted/fsfwconfig/objects/systemObjectList.h @@ -22,10 +22,11 @@ enum sourceObjects : uint32_t { TEST_TASK = 0x42694269, DUMMY_INTERFACE = 0xCAFECAFE, - DUMMY_HANDLER = 0x4400AFFE, - + DUMMY_HANDLER = 0x44000001, /* 0x49 ('I') for Communication Interfaces **/ - ARDUINO_COM_IF = 0x49000001 + ARDUINO_COM_IF = 0x49000001, + + DUMMY_COM_IF = 0x49000002 }; } diff --git a/linux/fsfwconfig/objects/systemObjectList.h b/linux/fsfwconfig/objects/systemObjectList.h index 28c87d3c..13f199cb 100644 --- a/linux/fsfwconfig/objects/systemObjectList.h +++ b/linux/fsfwconfig/objects/systemObjectList.h @@ -1,5 +1,5 @@ -#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ -#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ +#ifndef LINUX_FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ +#define LINUX_FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #include @@ -61,7 +61,8 @@ enum sourceObjects : uint32_t { DUMMY_INTERFACE = 0x5400CAFE, DUMMY_HANDLER = 0x5400AFFE, P60DOCK_TEST_TASK = 0x00005060, + DUMMY_COM_IF= 0x54000040 }; } -#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ +#endif /* LINUX_FSFWCONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ diff --git a/misc/eclipse/host/eive-unittest.launch b/misc/eclipse/host/eive-unittest.launch index 6b2e845c..38577b76 100644 --- a/misc/eclipse/host/eive-unittest.launch +++ b/misc/eclipse/host/eive-unittest.launch @@ -20,12 +20,13 @@ - + + diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index 0de99a2b..0991e803 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1,27 +1,28 @@ #include "ThermalController.h" -#include -#include #include +#include +#include +#include #include -#include -#include -#include #include #include #include +#include +#include +#include #include -#include -#include +#include ThermalController::ThermalController(object_id_t objectId, object_id_t parentId) : ExtendedControllerBase(objectId, parentId), sensorTemperatures(this), susTemperatures(this), deviceTemperatures(this), - componentTemperatures(this), - max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), - max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), + max31865Set0(objects::RTD_0_IC3_PLOC_HEATSPREADER, + EiveMax31855::RtdCommands::EXCHANGE_SET_ID), + max31865Set1(objects::RTD_1_IC4_PLOC_MISSIONBOARD, + EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set2(objects::RTD_2_IC5_4K_CAMERA, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set3(objects::RTD_3_IC6_DAC_HEATSPREADER, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set4(objects::RTD_4_IC7_STARTRACKER, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), @@ -33,7 +34,8 @@ ThermalController::ThermalController(object_id_t objectId, object_id_t parentId) max31865Set10(objects::RTD_10_IC13_PL_TX, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set11(objects::RTD_11_IC14_MPA, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), max31865Set12(objects::RTD_12_IC15_ACU, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), - max31865Set13(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, EiveMax31855::RtdCommands::EXCHANGE_SET_ID), + max31865Set13(objects::RTD_13_IC16_PLPCDU_HEATSPREADER, + 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), @@ -53,7 +55,6 @@ ThermalController::ThermalController(object_id_t objectId, object_id_t parentId) ReturnValue_t ThermalController::initialize() { auto result = ExtendedControllerBase::initialize(); - return result; } @@ -62,6 +63,25 @@ ReturnValue_t ThermalController::handleCommandMessage(CommandMessage* message) { } void ThermalController::performControlOperation() { + switch (internalState) { + case InternalState::STARTUP: { + initialCountdown.resetTimer(); + internalState = InternalState::INITIAL_DELAY; + return; + } + case InternalState::INITIAL_DELAY: { + if (initialCountdown.hasTimedOut()) { + internalState = InternalState::READY; + } + return; + } + case InternalState::READY: { + break; + } + default: + break; + } + ReturnValue_t result = sensorTemperatures.read(); if (result == RETURN_OK) { copySensors(); @@ -74,18 +94,11 @@ void ThermalController::performControlOperation() { susTemperatures.commit(); } -// result = deviceTemperatures.read(); -// if (result == RETURN_OK) { -// copyDevices(); -// deviceTemperatures.commit(); -// } - - result = componentTemperatures.read(); - if (result != RETURN_OK) { - return; + result = deviceTemperatures.read(); + if (result == RETURN_OK) { + copyDevices(); + deviceTemperatures.commit(); } - - componentTemperatures.commit(); } ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, @@ -170,10 +183,8 @@ ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& lo localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_ACU, new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU1, new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_PDU2, new PoolEntry({0})); - localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_1_P60DOCK, - new PoolEntry({0})); - localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_2_P60DOCK, - new PoolEntry({0})); + localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_1_P60DOCK, new PoolEntry({0})); + localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_2_P60DOCK, new PoolEntry({0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_0_SIDE_A, new PoolEntry({0.0})); localDataPoolMap.emplace(thermalControllerDefinitions::TEMP_GYRO_1_SIDE_A, @@ -203,7 +214,7 @@ LocalPoolDataSetBase* ThermalController::getDataSetHandle(sid_t sid) { case thermalControllerDefinitions::SUS_TEMPERATURES: return &susTemperatures; case thermalControllerDefinitions::DEVICE_TEMPERATURES: - return &deviceTemperatures; + return &deviceTemperatures; default: return nullptr; } @@ -500,8 +511,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read Q7S temperature" << std::endl; deviceTemperatures.q7s.setValid(false); deviceTemperatures.q7s = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.q7s = tempQ7s; deviceTemperatures.q7s.setValid(tempQ7s.isValid()); } @@ -509,14 +519,14 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t battTemp1 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1); + lp_var_t battTemp1 = + lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_1); result = battTemp1.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read battery temperature 1" << std::endl; deviceTemperatures.batteryTemp1.setValid(false); deviceTemperatures.batteryTemp1 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.batteryTemp1 = battTemp1; deviceTemperatures.batteryTemp1.setValid(battTemp1.isValid()); } @@ -524,14 +534,14 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t battTemp2 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_2); + lp_var_t battTemp2 = + lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_2); result = battTemp2.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read battery temperature 2" << std::endl; deviceTemperatures.batteryTemp2.setValid(false); deviceTemperatures.batteryTemp2 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.batteryTemp2 = battTemp2; deviceTemperatures.batteryTemp2.setValid(battTemp2.isValid()); } @@ -539,14 +549,14 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t battTemp3 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_3); + lp_var_t battTemp3 = + lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_3); result = battTemp3.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read battery temperature 3" << std::endl; deviceTemperatures.batteryTemp3.setValid(false); deviceTemperatures.batteryTemp3 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.batteryTemp3 = battTemp3; deviceTemperatures.batteryTemp3.setValid(battTemp3.isValid()); } @@ -554,14 +564,14 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t battTemp4 = lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_4); + lp_var_t battTemp4 = + lp_var_t(objects::BPX_BATT_HANDLER, BpxBattery::BATT_TEMP_4); result = battTemp4.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read battery temperature 4" << std::endl; deviceTemperatures.batteryTemp4.setValid(false); deviceTemperatures.batteryTemp4 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.batteryTemp4 = battTemp4; deviceTemperatures.batteryTemp4.setValid(battTemp4.isValid()); } @@ -575,8 +585,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read reaction wheel 1 temperature" << std::endl; deviceTemperatures.rw1.setValid(false); deviceTemperatures.rw1 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.rw1.setValid(tempRw1.isValid()); deviceTemperatures.rw1 = tempRw1; } @@ -590,8 +599,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read reaction wheel 2 temperature" << std::endl; deviceTemperatures.rw2.setValid(false); deviceTemperatures.rw2 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.rw2.setValid(tempRw2.isValid()); deviceTemperatures.rw2 = tempRw2; } @@ -605,8 +613,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read reaction wheel 3 temperature" << std::endl; deviceTemperatures.rw3.setValid(false); deviceTemperatures.rw3 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.rw3.setValid(tempRw3.isValid()); deviceTemperatures.rw3 = tempRw3; } @@ -620,8 +627,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read reaction wheel 4 temperature" << std::endl; deviceTemperatures.rw4.setValid(false); deviceTemperatures.rw4 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.rw4.setValid(tempRw4.isValid()); deviceTemperatures.rw4 = tempRw4; } @@ -636,8 +642,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read startracker temperature" << std::endl; deviceTemperatures.startracker.setValid(false); deviceTemperatures.startracker = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.startracker.setValid(tempStartracker.isValid()); deviceTemperatures.startracker = tempStartracker; } @@ -649,11 +654,11 @@ void ThermalController::copyDevices() { lp_var_t(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_POWER_AMPLIFIER); result = tempSyrlinksPowerAmplifier.read(); if (result != RETURN_OK) { - sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature" << std::endl; + sif::warning << "ThermalController: Failed to read syrlinks power amplifier temperature" + << std::endl; deviceTemperatures.syrlinksPowerAmplifier.setValid(false); deviceTemperatures.syrlinksPowerAmplifier = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.syrlinksPowerAmplifier.setValid(tempSyrlinksPowerAmplifier.isValid()); deviceTemperatures.syrlinksPowerAmplifier = tempSyrlinksPowerAmplifier; } @@ -665,11 +670,11 @@ void ThermalController::copyDevices() { lp_var_t(objects::SYRLINKS_HK_HANDLER, syrlinks::TEMP_BASEBAND_BOARD); result = tempSyrlinksBasebandBoard.read(); if (result != RETURN_OK) { - sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature" << std::endl; + sif::warning << "ThermalController: Failed to read syrlinks baseband board temperature" + << std::endl; deviceTemperatures.syrlinksBasebandBoard.setValid(false); deviceTemperatures.syrlinksBasebandBoard = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.syrlinksBasebandBoard.setValid(tempSyrlinksBasebandBoard.isValid()); deviceTemperatures.syrlinksBasebandBoard = tempSyrlinksBasebandBoard; } @@ -677,15 +682,13 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempMgt = - lp_var_t(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE); + lp_var_t tempMgt = lp_var_t(objects::IMTQ_HANDLER, IMTQ::MCU_TEMPERATURE); result = tempMgt.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read MGT temperature" << std::endl; deviceTemperatures.mgt.setValid(false); deviceTemperatures.mgt = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.mgt.setValid(tempMgt.isValid()); deviceTemperatures.mgt = tempMgt; } @@ -702,8 +705,7 @@ void ThermalController::copyDevices() { deviceTemperatures.acu[0] = static_cast(INVALID_TEMPERATURE); deviceTemperatures.acu[1] = static_cast(INVALID_TEMPERATURE); deviceTemperatures.acu[2] = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.acu.setValid(tempAcu.isValid()); deviceTemperatures.acu = tempAcu; } @@ -718,8 +720,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read PDU1 temperature" << std::endl; deviceTemperatures.pdu1.setValid(false); deviceTemperatures.pdu1 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.pdu1.setValid(tempPdu1.isValid()); deviceTemperatures.pdu1 = tempPdu1; } @@ -734,8 +735,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read PDU2 temperature" << std::endl; deviceTemperatures.pdu2.setValid(false); deviceTemperatures.pdu2 = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.pdu2.setValid(tempPdu1.isValid()); deviceTemperatures.pdu2 = tempPdu1; } @@ -750,8 +750,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read P60 dock temperature 1" << std::endl; deviceTemperatures.temp1P60dock.setValid(false); deviceTemperatures.temp1P60dock = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.temp1P60dock.setValid(temp1P60dock.isValid()); deviceTemperatures.temp1P60dock = temp1P60dock; } @@ -766,8 +765,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read P60 dock temperature 2" << std::endl; deviceTemperatures.temp2P60dock.setValid(false); deviceTemperatures.temp2P60dock = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.temp2P60dock.setValid(temp2P60dock.isValid()); deviceTemperatures.temp2P60dock = temp2P60dock; } @@ -775,15 +773,13 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempGyro0 = - lp_var_t(objects::GYRO_0_ADIS_HANDLER, ADIS1650X::TEMPERATURE); + lp_var_t tempGyro0 = lp_var_t(objects::GYRO_0_ADIS_HANDLER, ADIS1650X::TEMPERATURE); result = tempGyro0.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read gyro 0 temperature" << std::endl; deviceTemperatures.gyro0SideA.setValid(false); deviceTemperatures.gyro0SideA = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.gyro0SideA.setValid(tempGyro0.isValid()); deviceTemperatures.gyro0SideA = tempGyro0; } @@ -791,15 +787,13 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempGyro1 = - lp_var_t(objects::GYRO_1_L3G_HANDLER, L3GD20H::TEMPERATURE); + lp_var_t tempGyro1 = lp_var_t(objects::GYRO_1_L3G_HANDLER, L3GD20H::TEMPERATURE); result = tempGyro1.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read gyro 1 temperature" << std::endl; deviceTemperatures.gyro1SideA.setValid(false); deviceTemperatures.gyro1SideA = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.gyro1SideA.setValid(tempGyro1.isValid()); deviceTemperatures.gyro1SideA = tempGyro1; } @@ -807,15 +801,13 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempGyro2 = - lp_var_t(objects::GYRO_2_ADIS_HANDLER, ADIS1650X::TEMPERATURE); + lp_var_t tempGyro2 = lp_var_t(objects::GYRO_2_ADIS_HANDLER, ADIS1650X::TEMPERATURE); result = tempGyro2.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read gyro 2 temperature" << std::endl; deviceTemperatures.gyro2SideB.setValid(false); deviceTemperatures.gyro2SideB = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.gyro2SideB.setValid(tempGyro2.isValid()); deviceTemperatures.gyro2SideB = tempGyro2; } @@ -823,15 +815,13 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempGyro3 = - lp_var_t(objects::GYRO_3_L3G_HANDLER, L3GD20H::TEMPERATURE); + lp_var_t tempGyro3 = lp_var_t(objects::GYRO_3_L3G_HANDLER, L3GD20H::TEMPERATURE); result = tempGyro3.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read gyro 3 temperature" << std::endl; deviceTemperatures.gyro3SideB.setValid(false); deviceTemperatures.gyro3SideB = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.gyro3SideB.setValid(tempGyro3.isValid()); deviceTemperatures.gyro3SideB = tempGyro3; } @@ -846,8 +836,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read MGM 0 temperature" << std::endl; deviceTemperatures.mgm0SideA.setValid(false); deviceTemperatures.mgm0SideA = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.mgm0SideA.setValid(tempMgm0.isValid()); deviceTemperatures.mgm0SideA = tempMgm0; } @@ -862,8 +851,7 @@ void ThermalController::copyDevices() { sif::warning << "ThermalController: Failed to read MGM 2 temperature" << std::endl; deviceTemperatures.mgm2SideB.setValid(false); deviceTemperatures.mgm2SideB = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.mgm2SideB.setValid(tempMgm2.isValid()); deviceTemperatures.mgm2SideB = tempMgm2; } @@ -871,15 +859,13 @@ void ThermalController::copyDevices() { if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to commit" << std::endl; } - lp_var_t tempAdcPayloadPcdu = - lp_var_t(objects::PLPCDU_HANDLER, plpcdu::TEMP); + lp_var_t tempAdcPayloadPcdu = lp_var_t(objects::PLPCDU_HANDLER, plpcdu::TEMP); result = tempAdcPayloadPcdu.read(); if (result != RETURN_OK) { sif::warning << "ThermalController: Failed to read payload PCDU ADC temperature" << std::endl; deviceTemperatures.adcPayloadPcdu.setValid(false); deviceTemperatures.adcPayloadPcdu = static_cast(INVALID_TEMPERATURE); - } - else { + } else { deviceTemperatures.adcPayloadPcdu.setValid(tempAdcPayloadPcdu.isValid()); deviceTemperatures.adcPayloadPcdu = tempAdcPayloadPcdu; } diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 2c998251..691c3986 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -6,6 +6,7 @@ #include #include #include +#include class ThermalController : public ExtendedControllerBase { public: @@ -27,10 +28,20 @@ class ThermalController : public ExtendedControllerBase { uint32_t* msToReachTheMode) override; private: + + static const uint32_t DELAY = 500; + + enum class InternalState { + STARTUP, + INITIAL_DELAY, + READY + }; + + InternalState internalState = InternalState::STARTUP; + thermalControllerDefinitions::SensorTemperatures sensorTemperatures; thermalControllerDefinitions::SusTemperatures susTemperatures; thermalControllerDefinitions::DeviceTemperatures deviceTemperatures; - thermalControllerDefinitions::ComponentTemperatures componentTemperatures; // Temperature Sensors MAX31865::Max31865Set max31865Set0; @@ -66,6 +77,9 @@ class ThermalController : public ExtendedControllerBase { SUS::SusDataset susSet10; SUS::SusDataset susSet11; + // Initial delay to make sure all pool variables have been initialized their owners + Countdown initialCountdown = Countdown(DELAY); + void copySensors(); void copySus(); void copyDevices(); diff --git a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h index b6f2c9af..3c8a3618 100644 --- a/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h +++ b/mission/controller/controllerdefinitions/ThermalControllerDefinitions.h @@ -193,20 +193,6 @@ class SusTemperatures : public StaticLocalDataSet { lp_var_t(sid.objectId, PoolIds::SUS_11_R_LOC_XBYMZB_PT_ZB, this); }; -/** - * @brief This dataset can be used to store the collected temperatures of all components - */ -class ComponentTemperatures : public StaticLocalDataSet<2> { - public: - ComponentTemperatures(HasLocalDataPoolIF* owner) - : StaticLocalDataSet(owner, COMPONENT_TEMPERATURES) {} - - ComponentTemperatures(object_id_t objectId) - : StaticLocalDataSet(sid_t(objectId, COMPONENT_TEMPERATURES)) {} - - lp_var_t rw = lp_var_t(sid.objectId, PoolIds::COMPONENT_RW, this); -}; - } // namespace thermalControllerDefinitions #endif /* MISSION_CONTROLLER_CONTROLLERDEFINITIONS_THERMALCONTROLLERDEFINITIONS_H_ */ diff --git a/unittest/controller/testThermalController.cpp b/unittest/controller/testThermalController.cpp index 908b4c78..8f849e0b 100644 --- a/unittest/controller/testThermalController.cpp +++ b/unittest/controller/testThermalController.cpp @@ -1,5 +1,9 @@ +#include +#include #include #include +#include +#include #include @@ -8,10 +12,20 @@ TEST_CASE("Thermal Controller", "[ThermalController]") { const object_id_t THERMAL_CONTROLLER_ID = 0x123; - ThermalController controller(THERMAL_CONTROLLER_ID, objects::NO_OBJECT); + new TemperatureSensorsDummy(); + new SusDummy(); testEnvironment::initialize(); + ThermalController controller(THERMAL_CONTROLLER_ID, objects::NO_OBJECT); + ReturnValue_t result = controller.initialize(); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + + PeriodicTaskIF* thermalTask = TaskFactory::instance()->createPeriodicTask( + "THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr); + result = thermalTask->addComponent(THERMAL_CONTROLLER_ID); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + REQUIRE(controller.initializeAfterTaskCreation() == HasReturnvaluesIF::RETURN_OK); testEnvironment::eventManager->clearEventList(); @@ -34,12 +48,5 @@ TEST_CASE("Thermal Controller", "[ThermalController]") { THERMAL_CONTROLLER_ID, HasModesIF::MODE_INFO, ControllerBase::MODE_NORMAL, HasModesIF::SUBMODE_NONE) == true); - thermalControllerDefinitions::ComponentTemperatures componentTemperatures(THERMAL_CONTROLLER_ID); - - componentTemperatures.read(); - REQUIRE(componentTemperatures.rw == 0); - - componentTemperatures.commit(); - QueueFactory::instance()->deleteMessageQueue(commandQueue); } diff --git a/unittest/mocks/HouseKeepingMock.cpp b/unittest/mocks/HouseKeepingMock.cpp index d6588b1b..6f1f996b 100644 --- a/unittest/mocks/HouseKeepingMock.cpp +++ b/unittest/mocks/HouseKeepingMock.cpp @@ -1,7 +1,12 @@ #include "HouseKeepingMock.h" +#include #include -HouseKeepingMock::HouseKeepingMock() : SystemObject(objects::PUS_SERVICE_3_HOUSEKEEPING) {} +HouseKeepingMock::HouseKeepingMock() : SystemObject(objects::PUS_SERVICE_3_HOUSEKEEPING) { + auto mqArgs = MqArgs(objects::PUS_SERVICE_3_HOUSEKEEPING, static_cast(this)); + commandQueue = QueueFactory::instance()->createMessageQueue( + 5, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); +} -MessageQueueId_t HouseKeepingMock::getHkQueue() const { return MessageQueueIF::NO_QUEUE; } \ No newline at end of file +MessageQueueId_t HouseKeepingMock::getHkQueue() const { return commandQueue->getId(); } diff --git a/unittest/mocks/HouseKeepingMock.h b/unittest/mocks/HouseKeepingMock.h index 6ad3e188..a916734b 100644 --- a/unittest/mocks/HouseKeepingMock.h +++ b/unittest/mocks/HouseKeepingMock.h @@ -10,6 +10,9 @@ class HouseKeepingMock : public SystemObject, public AcceptsHkPacketsIF { HouseKeepingMock(); virtual MessageQueueId_t getHkQueue() const; + + private: + MessageQueueIF *commandQueue = nullptr; }; -#endif /*HOUSEKEEPINGMOCK_H_*/ \ No newline at end of file +#endif /*HOUSEKEEPINGMOCK_H_*/