important bugfix for thermal set

This commit is contained in:
Robin Müller 2023-02-09 17:17:42 +01:00
parent b279985859
commit 1841f92944
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 18 additions and 23 deletions

View File

@ -1472,11 +1472,11 @@ void DeviceHandlerBase::performOperationHook() {}
ReturnValue_t DeviceHandlerBase::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t DeviceHandlerBase::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) { LocalDataPoolManager& poolManager) {
if (thermalSet != nullptr) { if (thermalStateCfg.has_value()) {
localDataPoolMap.emplace(thermalSet->thermalStatePoolId, localDataPoolMap.emplace(thermalStateCfg.value().thermalStatePoolId,
new PoolEntry<DeviceHandlerIF::dh_thermal_state_t>); new PoolEntry<DeviceHandlerIF::dh_thermal_state_t>());
localDataPoolMap.emplace(thermalSet->heaterRequestPoolId, localDataPoolMap.emplace(thermalStateCfg.value().thermalRequestPoolId,
new PoolEntry<DeviceHandlerIF::dh_heater_request_t>); new PoolEntry<DeviceHandlerIF::dh_heater_request_t>());
} }
return returnvalue::OK; return returnvalue::OK;
} }
@ -1490,11 +1490,12 @@ ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
this->poolManager.initializeAfterTaskCreation(); this->poolManager.initializeAfterTaskCreation();
if (thermalStateCfg.has_value()) { if (thermalStateCfg.has_value()) {
ThermalStateCfg& val = thermalStateCfg.value(); ThermalStateCfg& cfg = thermalStateCfg.value();
thermalSet = new DeviceHandlerThermalSet(this, val.thermalSetId, val.thermalStatePoolId, thermalSet = new DeviceHandlerThermalSet(this, cfg);
val.thermalRequestPoolId);
} }
if (setStartupImmediately) {
startTransition(MODE_ON, getInitialSubmode()); startTransition(MODE_ON, getInitialSubmode());
}
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -7,27 +7,21 @@
class DeviceHandlerThermalSet : public StaticLocalDataSet<2> { class DeviceHandlerThermalSet : public StaticLocalDataSet<2> {
public: public:
DeviceHandlerThermalSet( DeviceHandlerThermalSet(HasLocalDataPoolIF* hkOwner, ThermalStateCfg cfg)
HasLocalDataPoolIF* hkOwner, uint32_t setId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID, : DeviceHandlerThermalSet(hkOwner->getObjectId(), cfg) {}
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( DeviceHandlerThermalSet(object_id_t deviceHandler, ThermalStateCfg cfg)
object_id_t deviceHandler, uint32_t setId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID, : StaticLocalDataSet(sid_t(deviceHandler, cfg.thermalSetId)),
lp_id_t thermalStateId = DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID, thermalStatePoolId(cfg.thermalStatePoolId),
lp_id_t thermalStateRequestId = DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID) heaterRequestPoolId(cfg.thermalRequestPoolId) {}
: StaticLocalDataSet(sid_t(deviceHandler, setId)),
thermalStatePoolId(thermalStateId),
heaterRequestPoolId(thermalStateRequestId) {}
const lp_id_t thermalStatePoolId; const lp_id_t thermalStatePoolId;
const lp_id_t heaterRequestPoolId; const lp_id_t heaterRequestPoolId;
lp_var_t<DeviceHandlerIF::dh_thermal_state_t> thermalState = 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_thermal_state_t>(sid.objectId, thermalStatePoolId, this);
lp_var_t<DeviceHandlerIF::dh_heater_request_t> heaterRequest = lp_var_t<DeviceHandlerIF::dh_heater_request_t> heaterRequest =
lp_var_t<DeviceHandlerIF::dh_heater_request_t>(heaterRequestPoolId, sid.objectId, this); lp_var_t<DeviceHandlerIF::dh_heater_request_t>(sid.objectId, heaterRequestPoolId, this);
}; };
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERTHERMALSET_H_ */ #endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERTHERMALSET_H_ */