2022-02-14 13:49:12 +01:00
|
|
|
#include <fsfw/events/EventManagerIF.h>
|
2022-02-11 16:20:26 +01:00
|
|
|
#include <fsfw/health/HealthTable.h>
|
|
|
|
#include <fsfw/housekeeping/AcceptsHkPacketsIF.h>
|
|
|
|
#include <fsfw/internalerror/InternalErrorReporter.h>
|
2022-02-14 13:49:12 +01:00
|
|
|
#include <fsfw/ipc/QueueFactory.h>
|
2022-02-11 16:20:26 +01:00
|
|
|
#include <fsfw/objectmanager.h>
|
|
|
|
#include <fsfw/storagemanager/PoolManager.h>
|
|
|
|
#include <fsfw/timemanager/TimeStamper.h>
|
2022-02-10 18:29:28 +01:00
|
|
|
#include <mission/controller/ThermalController.h>
|
2022-02-10 18:54:09 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
#include <catch2/catch_test_macros.hpp>
|
2022-02-10 18:54:09 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
class HkDummy : public SystemObject, public AcceptsHkPacketsIF {
|
|
|
|
public:
|
|
|
|
HkDummy() : SystemObject(objects::PUS_SERVICE_3_HOUSEKEEPING) {}
|
2022-02-10 18:54:09 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
virtual MessageQueueId_t getHkQueue() const { return MessageQueueIF::NO_QUEUE; }
|
|
|
|
};
|
2022-02-10 18:54:09 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
void factory(void* args) {
|
|
|
|
new HkDummy();
|
2022-02-10 18:54:09 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
new HealthTable(objects::HEALTH_TABLE);
|
|
|
|
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
|
|
|
new TimeStamper(objects::TIME_STAMPER);
|
2022-02-10 18:54:09 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
{
|
|
|
|
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {200, 32}, {150, 64}, {150, 128},
|
|
|
|
{100, 256}, {50, 512}, {50, 1024}, {10, 2048}};
|
|
|
|
new PoolManager(objects::IPC_STORE, poolCfg);
|
|
|
|
}
|
|
|
|
}
|
2022-02-10 18:29:28 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
TEST_CASE("Thermal Controller", "[ThermalController]") {
|
2022-02-14 13:49:12 +01:00
|
|
|
|
|
|
|
const object_id_t THERMAL_CONTROLLER_ID = 0x123;
|
|
|
|
|
2022-02-10 18:15:33 +01:00
|
|
|
|
2022-02-14 13:49:12 +01:00
|
|
|
ThermalController controller(THERMAL_CONTROLLER_ID, objects::NO_OBJECT);
|
2022-02-10 18:29:28 +01:00
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
ObjectManager::instance()->setObjectFactoryFunction(factory, nullptr);
|
|
|
|
ObjectManager::instance()->initialize();
|
|
|
|
ObjectManager::instance()->printList();
|
2022-02-10 18:29:28 +01:00
|
|
|
|
2022-02-14 13:49:12 +01:00
|
|
|
controller.initializeAfterTaskCreation();
|
|
|
|
|
|
|
|
MessageQueueId_t controllerQueue = controller.getCommandQueue();
|
|
|
|
|
|
|
|
CommandMessage modeMessage;
|
|
|
|
|
|
|
|
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND,
|
|
|
|
ControllerBase::MODE_NORMAL, HasModesIF::SUBMODE_NONE);
|
|
|
|
|
|
|
|
MessageQueueIF* commandQueue = QueueFactory::instance()->createMessageQueue(
|
|
|
|
5, MessageQueueMessage::MAX_MESSAGE_SIZE);
|
|
|
|
|
|
|
|
commandQueue->sendMessage(controllerQueue,&modeMessage);
|
|
|
|
|
2022-02-11 16:20:26 +01:00
|
|
|
REQUIRE(controller.performOperation(0) == HasReturnvaluesIF::RETURN_OK);
|
2022-02-14 13:49:12 +01:00
|
|
|
|
|
|
|
thermalControllerDefinitions::ComponentTemperatures componentTemperatures(THERMAL_CONTROLLER_ID);
|
|
|
|
|
|
|
|
componentTemperatures.read();
|
|
|
|
REQUIRE(componentTemperatures.rw == 0);
|
|
|
|
|
|
|
|
componentTemperatures.commit();
|
|
|
|
|
|
|
|
QueueFactory::instance()->deleteMessageQueue(commandQueue);
|
2022-02-10 18:15:33 +01:00
|
|
|
}
|