From 58f1c93de5fd8167f27a346c932f1c6952c653c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Jan 2023 16:16:59 +0100 Subject: [PATCH] add some stuff --- dummies/DummyHeaterHandler.cpp | 4 ---- dummies/DummyHeaterHandler.h | 13 ------------- dummies/Max31865Dummy.cpp | 5 +++++ dummies/Max31865Dummy.h | 1 + dummies/TemperatureSensorInserter.cpp | 14 ++++++++------ dummies/TemperatureSensorInserter.h | 11 +++++++---- dummies/helpers.cpp | 5 ++++- 7 files changed, 25 insertions(+), 28 deletions(-) delete mode 100644 dummies/DummyHeaterHandler.cpp delete mode 100644 dummies/DummyHeaterHandler.h diff --git a/dummies/DummyHeaterHandler.cpp b/dummies/DummyHeaterHandler.cpp deleted file mode 100644 index 59c49bde..00000000 --- a/dummies/DummyHeaterHandler.cpp +++ /dev/null @@ -1,4 +0,0 @@ -// -// Created by irini on 24.11.22. -// -#include "DummyHeaterHandler.h" diff --git a/dummies/DummyHeaterHandler.h b/dummies/DummyHeaterHandler.h deleted file mode 100644 index 8fb1e80b..00000000 --- a/dummies/DummyHeaterHandler.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// 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/Max31865Dummy.cpp b/dummies/Max31865Dummy.cpp index 5cbd1dec..687620ba 100644 --- a/dummies/Max31865Dummy.cpp +++ b/dummies/Max31865Dummy.cpp @@ -34,6 +34,11 @@ ReturnValue_t Max31865Dummy::initializeLocalDataPool(localpool::DataPool &localD localDataPoolMap.emplace(static_cast(PoolIds::FAULT_BYTE), new PoolEntry({0})); return OK; } + +void Max31865Dummy::setTemperature(float temperature) { + set.temperatureCelcius.value = temperature; +} + LocalPoolDataSetBase *Max31865Dummy::getDataSetHandle(sid_t sid) { return &set; } Max31865Dummy::Max31865Dummy(object_id_t objectId, CookieIF *cookie) : DeviceHandlerBase(objectId, objects::DUMMY_COM_IF, cookie), diff --git a/dummies/Max31865Dummy.h b/dummies/Max31865Dummy.h index 011296d6..58655870 100644 --- a/dummies/Max31865Dummy.h +++ b/dummies/Max31865Dummy.h @@ -9,6 +9,7 @@ class Max31865Dummy : public DeviceHandlerBase { Max31865Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie); Max31865Dummy(object_id_t objectId, CookieIF *comCookie); + void setTemperature(float temperature); private: MAX31865::PrimarySet set; diff --git a/dummies/TemperatureSensorInserter.cpp b/dummies/TemperatureSensorInserter.cpp index 314f7496..028f95ee 100644 --- a/dummies/TemperatureSensorInserter.cpp +++ b/dummies/TemperatureSensorInserter.cpp @@ -6,14 +6,14 @@ #include TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId) - : 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) { -} + : SystemObject(objects::THERMAL_TEMP_INSERTER) {} ReturnValue_t TemperatureSensorInserter::initialize() { - max31865PlocHeatspreaderSet.temperatureCelcius = 20.0; - max31865PlocMissionboardSet.temperatureCelcius = 20.0; + if (performTest) { + if(testCase == TestCase::OVERCOOL_SYRLINKS) { + + } + } return returnvalue::OK; } @@ -21,6 +21,7 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) { iteration++; value = sin(iteration / 80. * M_PI) * 10; + /* ReturnValue_t result = max31865PlocHeatspreaderSet.read(); if (result != returnvalue::OK) { sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl; @@ -33,5 +34,6 @@ ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) { max31865PlocHeatspreaderSet.setValidity(true, true); } max31865PlocHeatspreaderSet.commit(); + */ return returnvalue::OK; } diff --git a/dummies/TemperatureSensorInserter.h b/dummies/TemperatureSensorInserter.h index 8c87176d..38604b6d 100644 --- a/dummies/TemperatureSensorInserter.h +++ b/dummies/TemperatureSensorInserter.h @@ -13,10 +13,13 @@ class TemperatureSensorInserter : public ExecutableObjectIF, public SystemObject ReturnValue_t performOperation(uint8_t opCode) override; private: - int iteration = 0; - float value = 0; - MAX31865::PrimarySet max31865PlocHeatspreaderSet; - MAX31865::PrimarySet max31865PlocMissionboardSet; + enum TestCase { + OVERCOOL_SYRLINKS = 0 + }; + int iteration = 0; + bool performTest = false; + float value = 0; + TestCase testCase; // void noise(); }; diff --git a/dummies/helpers.cpp b/dummies/helpers.cpp index a9e34e2f..470f6b29 100644 --- a/dummies/helpers.cpp +++ b/dummies/helpers.cpp @@ -82,7 +82,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) { } if (cfg.addTempSensorDummies) { - new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER, objects::DUMMY_COM_IF, comCookieDummy); + + std::map tempSensorDummies; + tempSensorDummies.emplace(objects::RTD_0_IC3_PLOC_HEATSPREADER, new Max31865Dummy(objects::RTD_0_IC3_PLOC_HEATSPREADER, objects::DUMMY_COM_IF, comCookieDummy)); new Max31865Dummy(objects::RTD_1_IC4_PLOC_MISSIONBOARD, objects::DUMMY_COM_IF, comCookieDummy); new Max31865Dummy(objects::RTD_2_IC5_4K_CAMERA, objects::DUMMY_COM_IF, comCookieDummy); new Max31865Dummy(objects::RTD_3_IC6_DAC_HEATSPREADER, objects::DUMMY_COM_IF, comCookieDummy); @@ -104,6 +106,7 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitch) { new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy); new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, comCookieDummy); new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy); + new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER); } new CamSwitcher(objects::CAM_SWITCHER, pwrSwitch, power::NO_SWITCH);