bugfixes and improvements
This commit is contained in:
parent
3fb3039be5
commit
fff928a191
@ -13,10 +13,11 @@
|
||||
#include "../ipc/MessageQueueMessage.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../subsystem/SubsystemBase.h"
|
||||
#include "../datapoollocal/LocalPoolVariable.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "../datapoollocal/LocalPoolVariable.h"
|
||||
|
||||
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
||||
object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT;
|
||||
object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT;
|
||||
@ -57,9 +58,9 @@ void DeviceHandlerBase::setHkDestination(object_id_t hkDestination) {
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::setThermalStateRequestPoolIds(
|
||||
gp_id_t thermalStatePoolId, gp_id_t thermalRequestPoolId) {
|
||||
this->deviceThermalRequestPoolId = thermalStatePoolId;
|
||||
this->deviceThermalRequestPoolId = thermalRequestPoolId;
|
||||
lp_id_t thermalStatePoolId, lp_id_t thermalRequestPoolId) {
|
||||
this->deviceHeaterRequestPoolId = thermalStatePoolId;
|
||||
this->deviceHeaterRequestPoolId = thermalRequestPoolId;
|
||||
}
|
||||
|
||||
|
||||
@ -211,13 +212,17 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
||||
|
||||
fillCommandAndReplyMap();
|
||||
|
||||
//Set temperature target state to NON_OP.
|
||||
LocalPoolVar<int8_t> thermalRequest(deviceThermalRequestPoolId, nullptr,
|
||||
pool_rwm_t::VAR_WRITE);
|
||||
ReturnValue_t result = thermalRequest.read();
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
|
||||
thermalRequest.commit(PoolVariableIF::VALID);
|
||||
if(deviceHeaterRequestPoolId != localpool::INVALID_LPID) {
|
||||
//Set temperature target state to NON_OP.
|
||||
LocalPoolVar<DeviceHandlerIF::dh_heater_request_t>
|
||||
heaterRequest(this, deviceHeaterRequestPoolId, nullptr,
|
||||
pool_rwm_t::VAR_WRITE);
|
||||
result = heaterRequest.read();
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
heaterRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
|
||||
heaterRequest.commit(PoolVariableIF::VALID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return RETURN_OK;
|
||||
@ -509,10 +514,11 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
|
||||
Clock::getUptime(&timeoutStart);
|
||||
|
||||
if (mode == MODE_OFF) {
|
||||
LocalPoolVar<uint8_t> heaterRequest(deviceThermalRequestPoolId,
|
||||
LocalPoolVar<DeviceHandlerIF::dh_heater_request_t>
|
||||
heaterRequest(this, deviceHeaterRequestPoolId,
|
||||
nullptr, PoolVariableIF::VAR_READ_WRITE);
|
||||
ReturnValue_t result = heaterRequest.read();
|
||||
if(heaterRequest == HasReturnvaluesIF::RETURN_OK) {
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
if (heaterRequest.value !=
|
||||
ThermalComponentIF::STATE_REQUEST_IGNORE) {
|
||||
heaterRequest.value = ThermalComponentIF::
|
||||
@ -987,7 +993,7 @@ ReturnValue_t DeviceHandlerBase::checkModeCommand(Mode_t commandedMode,
|
||||
GlobDataSet mySet;
|
||||
gp_uint8_t thermalState(deviceThermalStatePoolId, &mySet,
|
||||
PoolVariableIF::VAR_READ);
|
||||
gp_uint8_t thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
gp_uint8_t thermalRequest(deviceHeaterRequestPoolId, &mySet,
|
||||
PoolVariableIF::VAR_READ);
|
||||
mySet.read();
|
||||
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
|
||||
@ -1015,7 +1021,7 @@ void DeviceHandlerBase::startTransition(Mode_t commandedMode,
|
||||
MODE_ON);
|
||||
triggerEvent(CHANGING_MODE, commandedMode, commandedSubmode);
|
||||
GlobDataSet mySet;
|
||||
gp_int8_t thermalRequest(deviceThermalRequestPoolId,
|
||||
gp_int8_t thermalRequest(deviceHeaterRequestPoolId,
|
||||
&mySet, PoolVariableIF::VAR_READ_WRITE);
|
||||
mySet.read();
|
||||
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
|
||||
@ -1393,6 +1399,15 @@ void DeviceHandlerBase::performOperationHook() {
|
||||
ReturnValue_t DeviceHandlerBase::initializeLocalDataPool(
|
||||
LocalDataPool &localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
if(deviceThermalStatePoolId != localpool::INVALID_LPID) {
|
||||
localDataPoolMap.emplace(deviceThermalStatePoolId,
|
||||
new PoolEntry<DeviceHandlerIF::dh_thermal_state_t>);
|
||||
}
|
||||
|
||||
if(deviceHeaterRequestPoolId != localpool::INVALID_LPID) {
|
||||
localDataPoolMap.emplace(deviceHeaterRequestPoolId,
|
||||
new PoolEntry<DeviceHandlerIF::dh_heater_request_t>);
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,18 @@ public:
|
||||
size_t cmdQueueSize = 20);
|
||||
|
||||
void setHkDestination(object_id_t hkDestination);
|
||||
void setThermalStateRequestPoolIds(gp_id_t thermalStatePoolId,
|
||||
gp_id_t thermalRequestPoolId);
|
||||
|
||||
/**
|
||||
* If the device handler is controlled by the FSFW thermal building blocks,
|
||||
* this function should be called. The device handler will then take care
|
||||
* of creating local pool entries for the device thermal state and device
|
||||
* heating request. Custom local pool IDs can be assigned as well.
|
||||
* @param thermalStatePoolId
|
||||
* @param thermalRequestPoolId
|
||||
*/
|
||||
void setThermalStateRequestPoolIds(
|
||||
lp_id_t thermalStatePoolId = localpool::INVALID_LPID - 1,
|
||||
lp_id_t thermalRequestPoolId = localpool::INVALID_LPID - 2);
|
||||
/**
|
||||
* @brief Helper function to ease device handler development.
|
||||
* This will instruct the transition to MODE_ON immediately
|
||||
@ -220,7 +230,7 @@ protected:
|
||||
* - If the device does not change the mode, the mode will be changed to
|
||||
* _MODE_POWER_DOWN, when the timeout (from getTransitionDelay())
|
||||
* has passed.
|
||||
*
|
||||
* 0xffffffff
|
||||
* #transitionFailure can be set to a failure code indicating the reason
|
||||
* for a failed transition
|
||||
*/
|
||||
@ -699,14 +709,14 @@ protected:
|
||||
*
|
||||
* can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking
|
||||
*/
|
||||
gp_id_t deviceThermalStatePoolId;
|
||||
lp_id_t deviceThermalStatePoolId = localpool::INVALID_LPID;
|
||||
|
||||
/**
|
||||
* this is the datapool variable with the thermal request of the device
|
||||
*
|
||||
* can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking
|
||||
*/
|
||||
gp_id_t deviceThermalRequestPoolId;
|
||||
lp_id_t deviceHeaterRequestPoolId = localpool::INVALID_LPID;
|
||||
|
||||
/**
|
||||
* Optional Error code. Can be set in doStartUp(), doShutDown() and
|
||||
|
@ -26,6 +26,9 @@ public:
|
||||
static const uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20;
|
||||
static const uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10;
|
||||
|
||||
using dh_heater_request_t = uint8_t;
|
||||
using dh_thermal_state_t = int8_t;
|
||||
|
||||
/**
|
||||
* @brief This is the mode the <strong>device handler</strong> is in.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user