refactor DHB: Bugfix for thermal module

This commit is contained in:
Robin Müller 2023-02-09 16:42:38 +01:00
parent 6ce80ea6c5
commit b279985859
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 16 additions and 12 deletions

View File

@ -58,12 +58,7 @@ void DeviceHandlerBase::setHkDestination(object_id_t hkDestination) {
this->hkDestination = hkDestination;
}
void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId,
lp_id_t heaterRequestPoolId,
uint32_t thermalSetId) {
thermalSet =
new DeviceHandlerThermalSet(this, thermalSetId, thermalStatePoolId, heaterRequestPoolId);
}
void DeviceHandlerBase::setUpThermalModule(ThermalStateCfg cfg) { this->thermalStateCfg = cfg; }
DeviceHandlerBase::~DeviceHandlerBase() {
if (comCookie != nullptr) {
@ -1494,9 +1489,12 @@ ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
}
this->poolManager.initializeAfterTaskCreation();
if (setStartupImmediately) {
startTransition(MODE_ON, getInitialSubmode());
if (thermalStateCfg.has_value()) {
ThermalStateCfg& val = thermalStateCfg.value();
thermalSet = new DeviceHandlerThermalSet(this, val.thermalSetId, val.thermalStatePoolId,
val.thermalRequestPoolId);
}
startTransition(MODE_ON, getInitialSubmode());
return returnvalue::OK;
}

View File

@ -2,6 +2,7 @@
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERBASE_H_
#include <map>
#include <optional>
#include "DeviceCommunicationIF.h"
#include "DeviceHandlerFailureIsolation.h"
@ -166,10 +167,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* @param thermalStatePoolId
* @param thermalRequestPoolId
*/
void setThermalStateRequestPoolIds(
lp_id_t thermalStatePoolId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
lp_id_t thermalRequestPoolId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID,
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID);
void setUpThermalModule(ThermalStateCfg cfg);
ReturnValue_t connectModeTreeParent(HasModeTreeChildrenIF &parent) override;
ModeTreeChildIF &getModeTreeChildIF() override;
@ -931,6 +929,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
//! Object which may be the root cause of an identified fault.
static object_id_t defaultFdirParentId;
std::optional<ThermalStateCfg> thermalStateCfg;
/**
* @brief Send a reply to a received device handler command.
*

View File

@ -136,4 +136,10 @@ class DeviceHandlerIF {
virtual MessageQueueId_t getCommandQueue() const = 0;
};
struct ThermalStateCfg {
lp_id_t thermalStatePoolId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID;
lp_id_t thermalRequestPoolId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID;
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID;
};
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERIF_H_ */