taken over upstream fixes
This commit is contained in:
parent
692aa087d8
commit
f161a94113
@ -1,4 +1,5 @@
|
|||||||
#include "ThermalComponentCore.h"
|
#include "ThermalComponentCore.h"
|
||||||
|
#include "tcsDefinitions.h"
|
||||||
|
|
||||||
ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
|
ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId,
|
||||||
uint8_t domainId, gp_id_t temperaturePoolId,
|
uint8_t domainId, gp_id_t temperaturePoolId,
|
||||||
@ -60,7 +61,7 @@ ThermalComponentIF::HeaterRequest ThermalComponentCore::performOperation(
|
|||||||
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
//SHOULDDO: Better pass db_float_t* to getTemperature and set it invalid if invalid.
|
||||||
temperature = getTemperature();
|
temperature = getTemperature();
|
||||||
updateMinMaxTemp();
|
updateMinMaxTemp();
|
||||||
if (temperature != INVALID_TEMPERATURE) {
|
if (temperature != thermal::INVALID_TEMPERATURE) {
|
||||||
temperature.setValid(PoolVariableIF::VALID);
|
temperature.setValid(PoolVariableIF::VALID);
|
||||||
State state = getState(temperature.value, getParameters(),
|
State state = getState(temperature.value, getParameters(),
|
||||||
targetState.value);
|
targetState.value);
|
||||||
@ -119,7 +120,7 @@ ReturnValue_t ThermalComponentCore::setTargetState(int8_t newState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThermalComponentCore::setOutputInvalid() {
|
void ThermalComponentCore::setOutputInvalid() {
|
||||||
temperature = INVALID_TEMPERATURE;
|
temperature = thermal::INVALID_TEMPERATURE;
|
||||||
temperature.setValid(PoolVariableIF::INVALID);
|
temperature.setValid(PoolVariableIF::INVALID);
|
||||||
currentState.setValid(PoolVariableIF::INVALID);
|
currentState.setValid(PoolVariableIF::INVALID);
|
||||||
heaterRequest = HEATER_DONT_CARE;
|
heaterRequest = HEATER_DONT_CARE;
|
||||||
@ -144,13 +145,13 @@ float ThermalComponentCore::getTemperature() {
|
|||||||
|
|
||||||
if (thermalModule != nullptr) {
|
if (thermalModule != nullptr) {
|
||||||
float temperature = thermalModule->getTemperature();
|
float temperature = thermalModule->getTemperature();
|
||||||
if (temperature != ThermalModuleIF::INVALID_TEMPERATURE) {
|
if (temperature != thermal::INVALID_TEMPERATURE) {
|
||||||
return temperature;
|
return temperature;
|
||||||
} else {
|
} else {
|
||||||
return INVALID_TEMPERATURE;
|
return thermal::INVALID_TEMPERATURE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return INVALID_TEMPERATURE;
|
return thermal::INVALID_TEMPERATURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ ThermalComponentIF::State ThermalComponentCore::getIgnoredState(int8_t state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThermalComponentCore::updateMinMaxTemp() {
|
void ThermalComponentCore::updateMinMaxTemp() {
|
||||||
if (temperature == INVALID_TEMPERATURE) {
|
if (temperature == thermal::INVALID_TEMPERATURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (temperature < minTemp) {
|
if (temperature < minTemp) {
|
||||||
|
@ -107,7 +107,7 @@ void ThermalModule::calculateTemperature() {
|
|||||||
moduleTemperature = moduleTemperature.value / numberOfValidSensors;
|
moduleTemperature = moduleTemperature.value / numberOfValidSensors;
|
||||||
moduleTemperature.setValid(PoolVariableIF::VALID);
|
moduleTemperature.setValid(PoolVariableIF::VALID);
|
||||||
} else {
|
} else {
|
||||||
moduleTemperature = INVALID_TEMPERATURE;
|
moduleTemperature.value = thermal::INVALID_TEMPERATURE;
|
||||||
moduleTemperature.setValid(PoolVariableIF::INVALID);
|
moduleTemperature.setValid(PoolVariableIF::INVALID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@ void ThermalModule::initialize(PowerSwitchIF* powerSwitch) {
|
|||||||
bool ThermalModule::calculateModuleHeaterRequestAndSetModuleStatus(
|
bool ThermalModule::calculateModuleHeaterRequestAndSetModuleStatus(
|
||||||
Strategy strategy) {
|
Strategy strategy) {
|
||||||
currentState.setValid(PoolVariableIF::VALID);
|
currentState.setValid(PoolVariableIF::VALID);
|
||||||
if (moduleTemperature == INVALID_TEMPERATURE) {
|
if (moduleTemperature == thermal::INVALID_TEMPERATURE) {
|
||||||
currentState = UNKNOWN;
|
currentState = UNKNOWN;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ void ThermalModule::updateTargetTemperatures(ThermalComponentIF* component,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThermalModule::setOutputInvalid() {
|
void ThermalModule::setOutputInvalid() {
|
||||||
moduleTemperature = INVALID_TEMPERATURE;
|
moduleTemperature = thermal::INVALID_TEMPERATURE;
|
||||||
moduleTemperature.setValid(PoolVariableIF::INVALID);
|
moduleTemperature.setValid(PoolVariableIF::INVALID);
|
||||||
currentState.setValid(PoolVariableIF::INVALID);
|
currentState.setValid(PoolVariableIF::INVALID);
|
||||||
std::list<ComponentData>::iterator iter = components.begin();
|
std::list<ComponentData>::iterator iter = components.begin();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define THERMALMODULEIF_H_
|
#define THERMALMODULEIF_H_
|
||||||
|
|
||||||
#include "ThermalComponentIF.h"
|
#include "ThermalComponentIF.h"
|
||||||
|
|
||||||
class AbstractTemperatureSensor;
|
class AbstractTemperatureSensor;
|
||||||
|
|
||||||
class ThermalModuleIF{
|
class ThermalModuleIF{
|
||||||
@ -18,8 +19,6 @@ public:
|
|||||||
NON_OPERATIONAL = 0, OPERATIONAL = 1, UNKNOWN = 2
|
NON_OPERATIONAL = 0, OPERATIONAL = 1, UNKNOWN = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr float INVALID_TEMPERATURE = 999;
|
|
||||||
|
|
||||||
virtual ~ThermalModuleIF() {
|
virtual ~ThermalModuleIF() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef TCSDEFINITIONS_H_
|
#ifndef TCSDEFINITIONS_H_
|
||||||
#define TCSDEFINITIONS_H_
|
#define TCSDEFINITIONS_H_
|
||||||
|
|
||||||
|
namespace thermal {
|
||||||
static const float INVALID_TEMPERATURE = 999;
|
static constexpr float INVALID_TEMPERATURE = 999;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* TCSDEFINITIONS_H_ */
|
#endif /* TCSDEFINITIONS_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user