2022-11-24 16:40:59 +01:00
|
|
|
#include "TemperatureSensorInserter.h"
|
|
|
|
|
|
|
|
#include <objects/systemObjectList.h>
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
2023-01-21 16:51:32 +01:00
|
|
|
TemperatureSensorInserter::TemperatureSensorInserter(
|
2023-01-22 20:37:51 +01:00
|
|
|
object_id_t objectId, const std::map<object_id_t, Max31865Dummy*>& tempSensorDummies_,
|
|
|
|
const std::map<object_id_t, Tmp1075Dummy*>& tempTmpSensorDummies_)
|
2023-01-22 20:07:10 +01:00
|
|
|
: SystemObject(objects::THERMAL_TEMP_INSERTER) {}
|
2022-11-24 16:40:59 +01:00
|
|
|
|
|
|
|
ReturnValue_t TemperatureSensorInserter::initialize() {
|
2023-01-17 16:16:59 +01:00
|
|
|
if (performTest) {
|
2023-01-21 16:51:32 +01:00
|
|
|
if (testCase == TestCase::OVERCOOL_SYRLINKS) {
|
|
|
|
}
|
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) {
|
|
|
|
iteration++;
|
|
|
|
value = sin(iteration / 80. * M_PI) * 10;
|
|
|
|
|
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
|
|
|
*/
|
2022-11-24 16:40:59 +01:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|