Merge branch 'development' into mueller/FreeRTOS

This commit is contained in:
Robin Müller 2020-12-14 21:51:19 +01:00
commit 7f93c4a6aa
14 changed files with 85 additions and 32 deletions

View File

@ -97,7 +97,6 @@ ReturnValue_t ExtendedControllerBase::initializeAfterTaskCreation() {
ReturnValue_t ExtendedControllerBase::performOperation(uint8_t opCode) { ReturnValue_t ExtendedControllerBase::performOperation(uint8_t opCode) {
handleQueue(); handleQueue();
hkSwitcher.performOperation();
localPoolManager.performHkOperation(); localPoolManager.performHkOperation();
performControlOperation(); performControlOperation();
return RETURN_OK; return RETURN_OK;

View File

@ -4,6 +4,7 @@
#include "DeviceHandlerMessage.h" #include "DeviceHandlerMessage.h"
#include "../action/HasActionsIF.h" #include "../action/HasActionsIF.h"
#include "../datapoollocal/locPoolDefinitions.h"
#include "../events/Event.h" #include "../events/Event.h"
#include "../modes/HasModesIF.h" #include "../modes/HasModesIF.h"
#include "../ipc/MessageQueueSenderIF.h" #include "../ipc/MessageQueueSenderIF.h"
@ -21,12 +22,13 @@ using DeviceCommandId_t = uint32_t;
*/ */
class DeviceHandlerIF { class DeviceHandlerIF {
public: public:
static constexpr DeviceCommandId_t NO_COMMAND = -1;
static constexpr uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20;
static constexpr uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10;
static const uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20; using dh_heater_request_t = uint8_t;
static const uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10; using dh_thermal_state_t = int8_t;
static constexpr Command_t NO_COMMAND = -1;
/** /**
* @brief This is the mode the <strong>device handler</strong> is in. * @brief This is the mode the <strong>device handler</strong> is in.
@ -150,6 +152,14 @@ public:
NOTHING //!< Do nothing. NOTHING //!< Do nothing.
}; };
static constexpr uint32_t DEFAULT_THERMAL_SET_ID = sid_t::INVALID_SET_ID - 1;
static constexpr lp_id_t DEFAULT_THERMAL_STATE_POOL_ID =
localpool::INVALID_LPID - 2;
static constexpr lp_id_t DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID =
localpool::INVALID_LPID - 1;
/** /**
* Default Destructor * Default Destructor
*/ */

View File

@ -0,0 +1,44 @@
#ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERTHERMALSET_H_
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERTHERMALSET_H_
#include "DeviceHandlerIF.h"
#include "../datapoollocal/StaticLocalDataSet.h"
#include "../datapoollocal/LocalPoolVariable.h"
class DeviceHandlerThermalSet: public StaticLocalDataSet<2> {
public:
DeviceHandlerThermalSet(HasLocalDataPoolIF* hkOwner, uint32_t setId =
DeviceHandlerIF::DEFAULT_THERMAL_SET_ID,
lp_id_t thermalStateId =
DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
lp_id_t heaterRequestId =
DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID):
DeviceHandlerThermalSet(hkOwner->getObjectId(), setId,
thermalStateId, heaterRequestId) {}
DeviceHandlerThermalSet(object_id_t deviceHandler, uint32_t setId =
DeviceHandlerIF::DEFAULT_THERMAL_SET_ID,
lp_id_t thermalStateId =
DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
lp_id_t thermalStateRequestId =
DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID):
StaticLocalDataSet(sid_t(deviceHandler, setId)),
thermalStatePoolId(thermalStateId),
heaterRequestPoolId(thermalStateRequestId) {}
const lp_id_t thermalStatePoolId;
const lp_id_t heaterRequestPoolId;
lp_var_t<DeviceHandlerIF::dh_thermal_state_t> thermalState =
lp_var_t<DeviceHandlerIF::dh_thermal_state_t>(
thermalStatePoolId, sid.objectId, this);
lp_var_t<DeviceHandlerIF::dh_heater_request_t> heaterRequest =
lp_var_t<DeviceHandlerIF::dh_heater_request_t>(
heaterRequestPoolId, sid.objectId, this);
};
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERTHERMALSET_H_ */

View File

@ -76,7 +76,7 @@ ReturnValue_t FaultCounter::getParameter(uint8_t domainId, uint16_t parameterId,
parameterWrapper->set(timer.timeout); parameterWrapper->set(timer.timeout);
break; break;
default: default:
return INVALID_MATRIX_ID; return INVALID_IDENTIFIER_ID;
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -9,7 +9,6 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/controller/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/coordinates/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/coordinates/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datalinklayer/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datalinklayer/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapool/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapool/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoolglob/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoollocal/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoollocal/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/housekeeping/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/housekeeping/*.cpp)
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/devicehandlers/*.cpp) CXXSRC += $(wildcard $(FRAMEWORK_PATH)/devicehandlers/*.cpp)

View File

@ -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) {

View File

@ -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();

View File

@ -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() {
} }

View File

@ -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_ */

View File

@ -1,8 +1,8 @@
#include "IntTestMq.h" #include "IntTestMq.h"
#include "../UnittDefinitions.h" #include "../UnittDefinitions.h"
#include "../../ipc/MessageQueueIF.h" #include "../../../ipc/MessageQueueIF.h"
#include "../../ipc/QueueFactory.h" #include "../../../ipc/QueueFactory.h"
#include <array> #include <array>

View File

@ -1,6 +1,6 @@
#include "IntTestMutex.h" #include "IntTestMutex.h"
#include "../../ipc/MutexFactory.h" #include "../../../ipc/MutexFactory.h"
#include "../UnittDefinitions.h" #include "../UnittDefinitions.h"
#if defined(hosted) #if defined(hosted)

View File

@ -1,9 +1,9 @@
#include "IntTestSemaphore.h" #include "IntTestSemaphore.h"
#include "../UnittDefinitions.h" #include "../UnittDefinitions.h"
#include "../../tasks/SemaphoreFactory.h" #include "../../../tasks/SemaphoreFactory.h"
#include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../../serviceinterface/ServiceInterfaceStream.h"
#include "../../timemanager/Stopwatch.h" #include "../../../timemanager/Stopwatch.h"
void testsemaph::testBinSemaph() { void testsemaph::testBinSemaph() {

View File

@ -1,8 +1,9 @@
#include "IntTestSerialization.h" #include "IntTestSerialization.h"
#include "../UnittDefinitions.h" #include "../UnittDefinitions.h"
#include "../../serialize/SerializeElement.h"
#include "../../serialize/SerialBufferAdapter.h" #include "../../../serialize/SerializeElement.h"
#include "../../serialize/SerializeIF.h" #include "../../../serialize/SerialBufferAdapter.h"
#include "../../../serialize/SerializeIF.h"
#include <array> #include <array>

View File

@ -1,7 +1,7 @@
#ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ #ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
#define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ #define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
#include "../../returnvalues/HasReturnvaluesIF.h" #include "../../../returnvalues/HasReturnvaluesIF.h"
#include <array> #include <array>
namespace testserialize { namespace testserialize {