2022-11-24 16:40:59 +01:00
|
|
|
#include "TemperatureSensorInserter.h"
|
|
|
|
|
2023-04-06 12:13:24 +02:00
|
|
|
#include <fsfw/datapool/PoolReadGuard.h>
|
2022-11-24 16:40:59 +01:00
|
|
|
#include <objects/systemObjectList.h>
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
#include <cstdlib>
|
2023-02-09 17:17:58 +01:00
|
|
|
#include <utility>
|
2022-11-24 16:40:59 +01:00
|
|
|
|
2023-02-06 15:59:30 +01:00
|
|
|
TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId,
|
2023-02-09 17:17:58 +01:00
|
|
|
Max31865DummyMap tempSensorDummies_,
|
|
|
|
Tmp1075DummyMap tempTmpSensorDummies_)
|
2023-02-22 17:30:30 +01:00
|
|
|
: SystemObject(objectId),
|
2023-02-09 17:17:58 +01:00
|
|
|
max31865DummyMap(std::move(tempSensorDummies_)),
|
|
|
|
tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {}
|
2022-11-24 16:40:59 +01:00
|
|
|
|
|
|
|
ReturnValue_t TemperatureSensorInserter::initialize() {
|
2023-04-06 12:13:24 +02:00
|
|
|
testCase = TestCase::COOL_MGT;
|
2022-11-24 16:40:59 +01:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TemperatureSensorInserter::performOperation(uint8_t opCode) {
|
2023-03-09 09:37:10 +01:00
|
|
|
// TODO: deviceSensors
|
2023-02-22 21:46:56 +01:00
|
|
|
if (not tempsWereInitialized) {
|
|
|
|
for (auto& rtdDummy : max31865DummyMap) {
|
2023-02-22 17:30:30 +01:00
|
|
|
rtdDummy.second->setTemperature(10, true);
|
|
|
|
}
|
2023-02-22 21:46:56 +01:00
|
|
|
for (auto& tmpDummy : tmp1075DummyMap) {
|
2023-02-22 17:30:30 +01:00
|
|
|
tmpDummy.second->setTemperature(10, true);
|
|
|
|
}
|
|
|
|
tempsWereInitialized = true;
|
|
|
|
}
|
|
|
|
|
2023-04-06 12:13:24 +02:00
|
|
|
switch (testCase) {
|
|
|
|
case (TestCase::NONE): {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (TestCase::COOL_SYRLINKS): {
|
|
|
|
// TODO: How do I insert this?
|
|
|
|
// Does not work on EM, where a real syrlinks device is connected.
|
|
|
|
if (cycles == 15) {
|
|
|
|
lp_var_t<float> tempSyrlinksBasebandBoard =
|
|
|
|
lp_var_t<float>(objects::SYRLINKS_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
|
|
|
|
PoolReadGuard pg(&tempSyrlinksBasebandBoard);
|
|
|
|
tempSyrlinksBasebandBoard.value = -50;
|
|
|
|
}
|
|
|
|
if (cycles == 30) {
|
|
|
|
lp_var_t<float> tempSyrlinksBasebandBoard =
|
|
|
|
lp_var_t<float>(objects::SYRLINKS_HANDLER, syrlinks::TEMP_BASEBAND_BOARD);
|
|
|
|
PoolReadGuard pg(&tempSyrlinksBasebandBoard);
|
|
|
|
tempSyrlinksBasebandBoard.value = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (TestCase::COOL_HPA): {
|
|
|
|
if (cycles == 15) {
|
|
|
|
max31865DummyMap[objects::RTD_9_IC12_HPA]->setTemperature(-60, true);
|
|
|
|
}
|
|
|
|
if (cycles == 30) {
|
|
|
|
max31865DummyMap[objects::RTD_9_IC12_HPA]->setTemperature(0, true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (TestCase::COOL_MGT): {
|
|
|
|
if (cycles == 15) {
|
|
|
|
max31865DummyMap[objects::RTD_15_IC18_IMTQ]->setTemperature(-60, true);
|
|
|
|
}
|
|
|
|
if (cycles == 30) {
|
|
|
|
max31865DummyMap[objects::RTD_15_IC18_IMTQ]->setTemperature(0, true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2022-11-24 16:40:59 +01:00
|
|
|
}
|
2023-02-22 17:50:03 +01:00
|
|
|
cycles++;
|
2022-11-24 16:40:59 +01:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
2023-02-22 21:46:56 +01:00
|
|
|
ReturnValue_t TemperatureSensorInserter::initializeAfterTaskCreation() { return returnvalue::OK; }
|