testArduino/mission/Controller/ArduinoTCSTemperatureSensor.cpp

58 lines
1.8 KiB
C++
Raw Normal View History

/*
HELP
*/
#include <mission/Controller/ArduinoTCSTemperatureSensor.h>
#include <fsfw/ipc/QueueFactory.h>
ArduinoTCSTemperatureSensor::ArduinoTCSTemperatureSensor(object_id_t setObjectid,
float *inputTemperature, PoolVariableIF *poolVariable,
uint8_t vectorIndex, Parameters parameters, uint32_t datapoolId,
DataSet *outputSet, ThermalModuleIF *thermalModule) :
AbstractTemperatureSensor(setObjectid, thermalModule), parameters(
parameters), inputTemperature(inputTemperature), poolVariable(
poolVariable), outputTemperature(datapoolId, outputSet,
PoolVariableIF::VAR_WRITE) {
}
ArduinoTCSTemperatureSensor::~ArduinoTCSTemperatureSensor() {}
void ArduinoTCSTemperatureSensor::setInvalid() {
outputTemperature = INVALID_TEMPERATURE;
outputTemperature.setValid(false);
}
float ArduinoTCSTemperatureSensor::calculateOutputTemperature(float inputTemperature) {
return inputTemperature; // [°C]
}
void ArduinoTCSTemperatureSensor::doChildOperation() {
if (!poolVariable->isValid() || !healthHelper.healthTable->isHealthy(getObjectId())) {
setInvalid();
return;
}
outputTemperature = calculateOutputTemperature(*inputTemperature);
if (outputTemperature<parameters.lowerLimit || outputTemperature>parameters.upperLimit){
outputTemperature.setValid(PoolVariableIF::INVALID);
outputTemperature = INVALID_TEMPERATURE;
} else {
outputTemperature.setValid(PoolVariableIF::VALID);
}
}
float ArduinoTCSTemperatureSensor::getTemperature() {
return outputTemperature;
}
bool ArduinoTCSTemperatureSensor::isValid() {
return outputTemperature.isValid();
}
void ArduinoTCSTemperatureSensor::resetOldState() {}
ReturnValue_t ArduinoTCSTemperatureSensor::getParameter(uint8_t domainId, uint16_t parameterId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex){
return HasReturnvaluesIF::RETURN_OK;
}