eive-obsw/dummies/TemperatureSensorInserter.cpp

69 lines
2.3 KiB
C++
Raw Normal View History

2022-11-24 16:40:59 +01:00
#include "TemperatureSensorInserter.h"
#include <objects/systemObjectList.h>
#include <cmath>
#include <cstdlib>
#include <utility>
2022-11-24 16:40:59 +01:00
2023-02-06 15:59:30 +01:00
TemperatureSensorInserter::TemperatureSensorInserter(object_id_t objectId,
Max31865DummyMap tempSensorDummies_,
Tmp1075DummyMap tempTmpSensorDummies_)
: SystemObject(objectId),
max31865DummyMap(std::move(tempSensorDummies_)),
tmp1075DummyMap(std::move(tempTmpSensorDummies_)) {}
2022-11-24 16:40:59 +01:00
ReturnValue_t TemperatureSensorInserter::initialize() {
2023-01-17 16:16:59 +01:00
if (performTest) {
2023-02-06 15:59:30 +01:00
if (testCase == TestCase::COOL_SYRLINKS) {
2023-01-21 16:51:32 +01:00
}
2023-01-17 16:16:59 +01:00
}
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) {
rtdDummy.second->setTemperature(10, true);
}
2023-02-22 21:46:56 +01:00
for (auto& tmpDummy : tmp1075DummyMap) {
tmpDummy.second->setTemperature(10, true);
}
tempsWereInitialized = true;
}
2023-02-22 21:46:56 +01:00
if (cycles == 10) {
2023-03-05 13:27:42 +01:00
max31865DummyMap[objects::RTD_9_IC12_HPA]->setTemperature(-100, true);
max31865DummyMap[objects::RTD_11_IC14_MPA]->setTemperature(-100, true);
2023-03-08 15:56:05 +01:00
}
2023-03-09 09:37:10 +01:00
if (cycles == 35) {
2023-03-08 15:56:05 +01:00
max31865DummyMap[objects::RTD_9_IC12_HPA]->setTemperature(0, true);
max31865DummyMap[objects::RTD_11_IC14_MPA]->setTemperature(0, true);
max31865DummyMap[objects::RTD_2_IC5_4K_CAMERA]->setTemperature(-100, true);
2023-02-22 17:50:03 +01:00
}
2023-03-09 09:37:10 +01:00
if (cycles == 60) {
2023-03-08 15:56:05 +01:00
max31865DummyMap[objects::RTD_9_IC12_HPA]->setTemperature(-100, true);
max31865DummyMap[objects::RTD_11_IC14_MPA]->setTemperature(0, true);
}
2023-01-17 16:16:59 +01:00
/*
2022-11-24 16:40:59 +01:00
ReturnValue_t result = max31865PlocHeatspreaderSet.read();
if (result != returnvalue::OK) {
sif::warning << "Failed to read temperature from MAX31865 dataset" << std::endl;
}
max31865PlocHeatspreaderSet.rtdValue = value - 5;
max31865PlocHeatspreaderSet.temperatureCelcius = value;
if ((iteration % 100) < 20) {
max31865PlocHeatspreaderSet.setValidity(false, true);
} else {
max31865PlocHeatspreaderSet.setValidity(true, true);
}
max31865PlocHeatspreaderSet.commit();
2023-01-17 16:16: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; }