add health IF to heater handler
This commit is contained in:
parent
0abb726b30
commit
238afbaa8b
@ -33,8 +33,16 @@ ObjectManagerIF* objectManager = nullptr;
|
|||||||
|
|
||||||
void initmission::initMission() {
|
void initmission::initMission() {
|
||||||
sif::info << "Building global objects.." << std::endl;
|
sif::info << "Building global objects.." << std::endl;
|
||||||
/* Instantiate global object manager and also create all objects */
|
try {
|
||||||
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
/* Instantiate global object manager and also create all objects */
|
||||||
|
ObjectManager::instance()->setObjectFactoryFunction(ObjectFactory::produce, nullptr);
|
||||||
|
} catch (const std::invalid_argument& e) {
|
||||||
|
sif::error << "initmission::initMission: Object Construction failed with an "
|
||||||
|
"invalid argument: "
|
||||||
|
<< e.what();
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
sif::info << "Initializing all objects.." << std::endl;
|
sif::info << "Initializing all objects.." << std::endl;
|
||||||
ObjectManager::instance()->initialize();
|
ObjectManager::instance()->initialize();
|
||||||
|
|
||||||
|
@ -131,7 +131,8 @@ void Factory::setStaticFrameworkObjectIds() {
|
|||||||
|
|
||||||
void ObjectFactory::produce(void* args) {
|
void ObjectFactory::produce(void* args) {
|
||||||
ObjectFactory::setStatics();
|
ObjectFactory::setStatics();
|
||||||
ObjectFactory::produceGenericObjects();
|
HealthTableIF* healthTable = nullptr;
|
||||||
|
ObjectFactory::produceGenericObjects(&healthTable);
|
||||||
|
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
UartComIF* uartComIF = nullptr;
|
UartComIF* uartComIF = nullptr;
|
||||||
@ -151,7 +152,7 @@ void ObjectFactory::produce(void* args) {
|
|||||||
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
createHeaterComponents();
|
createHeaterComponents(pwrSwitcher, healthTable);
|
||||||
createSolarArrayDeploymentComponents();
|
createSolarArrayDeploymentComponents();
|
||||||
createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher);
|
createPlPcduComponents(gpioComIF, spiComIF, pwrSwitcher);
|
||||||
#if OBSW_ADD_SYRLINKS == 1
|
#if OBSW_ADD_SYRLINKS == 1
|
||||||
@ -580,7 +581,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
|
|||||||
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
|
#endif /* OBSW_ADD_ACS_HANDLERS == 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createHeaterComponents() {
|
void ObjectFactory::createHeaterComponents(PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable) {
|
||||||
using namespace gpio;
|
using namespace gpio;
|
||||||
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
@ -621,8 +622,8 @@ void ObjectFactory::createHeaterComponents() {
|
|||||||
Levels::LOW);
|
Levels::LOW);
|
||||||
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
|
||||||
|
|
||||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
|
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, pwrSwitcher,
|
||||||
objects::PCDU_HANDLER, pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
|
pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V, healthTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
||||||
|
@ -6,6 +6,7 @@ class UartComIF;
|
|||||||
class SpiComIF;
|
class SpiComIF;
|
||||||
class I2cComIF;
|
class I2cComIF;
|
||||||
class PowerSwitchIF;
|
class PowerSwitchIF;
|
||||||
|
class HealthTableIF;
|
||||||
class AcsBoardAssembly;
|
class AcsBoardAssembly;
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
@ -22,7 +23,7 @@ void createTmpComponents();
|
|||||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
||||||
PowerSwitchIF* pwrSwitcher);
|
PowerSwitchIF* pwrSwitcher);
|
||||||
void createHeaterComponents();
|
void createHeaterComponents(PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable);
|
||||||
void createSolarArrayDeploymentComponents();
|
void createSolarArrayDeploymentComponents();
|
||||||
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
|
@ -44,10 +44,13 @@
|
|||||||
#define OBSW_TM_TO_PTME 0
|
#define OBSW_TM_TO_PTME 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ObjectFactory::produceGenericObjects() {
|
void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) {
|
||||||
// Framework objects
|
// Framework objects
|
||||||
new EventManager(objects::EVENT_MANAGER);
|
new EventManager(objects::EVENT_MANAGER);
|
||||||
new HealthTable(objects::HEALTH_TABLE);
|
auto healthTable = new HealthTable(objects::HEALTH_TABLE);
|
||||||
|
if (healthTable != nullptr) {
|
||||||
|
*healthTable_ = healthTable;
|
||||||
|
}
|
||||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||||
new TimeStamper(objects::TIME_STAMPER);
|
new TimeStamper(objects::TIME_STAMPER);
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#ifndef MISSION_CORE_GENERICFACTORY_H_
|
#ifndef MISSION_CORE_GENERICFACTORY_H_
|
||||||
#define MISSION_CORE_GENERICFACTORY_H_
|
#define MISSION_CORE_GENERICFACTORY_H_
|
||||||
|
|
||||||
|
class HealthTableIF;
|
||||||
|
|
||||||
namespace ObjectFactory {
|
namespace ObjectFactory {
|
||||||
|
|
||||||
void produceGenericObjects();
|
void produceGenericObjects(HealthTableIF** healthTable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,31 @@
|
|||||||
#include "HeaterHandler.h"
|
#include "HeaterHandler.h"
|
||||||
|
|
||||||
|
#include <fsfw/health/HealthTableIF.h>
|
||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "devices/gpioIds.h"
|
#include "devices/gpioIds.h"
|
||||||
#include "devices/powerSwitcherList.h"
|
#include "devices/powerSwitcherList.h"
|
||||||
|
|
||||||
HeaterHandler::HeaterHandler(object_id_t setObjectId_, object_id_t gpioDriverId_,
|
HeaterHandler::HeaterHandler(object_id_t setObjectId_, object_id_t gpioDriverId_,
|
||||||
CookieIF* gpioCookie_, object_id_t mainLineSwitcherObjectId_,
|
CookieIF* gpioCookie_, PowerSwitchIF* mainLineSwitcher_,
|
||||||
uint8_t mainLineSwitch_)
|
power::Switch_t mainLineSwitch_, HealthTableIF* healthTable_)
|
||||||
: SystemObject(setObjectId_),
|
: SystemObject(setObjectId_),
|
||||||
gpioDriverId(gpioDriverId_),
|
gpioDriverId(gpioDriverId_),
|
||||||
gpioCookie(gpioCookie_),
|
gpioCookie(gpioCookie_),
|
||||||
mainLineSwitcherObjectId(mainLineSwitcherObjectId_),
|
mainLineSwitcher(mainLineSwitcher_),
|
||||||
mainLineSwitch(mainLineSwitch_),
|
mainLineSwitch(mainLineSwitch_),
|
||||||
|
healthTable(healthTable_),
|
||||||
actionHelper(this, nullptr) {
|
actionHelper(this, nullptr) {
|
||||||
|
if (mainLineSwitcher == nullptr) {
|
||||||
|
throw std::invalid_argument("HeaterHandler::HeaterHandler: Invalid PowerSwitchIF");
|
||||||
|
}
|
||||||
|
if (healthTable == nullptr) {
|
||||||
|
throw std::invalid_argument("HeaterHandler::HeaterHandler: Invalid HealthTableIF");
|
||||||
|
}
|
||||||
auto mqArgs = MqArgs(setObjectId_, static_cast<void*>(this));
|
auto mqArgs = MqArgs(setObjectId_, static_cast<void*>(this));
|
||||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||||
cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
|
||||||
@ -55,21 +65,16 @@ ReturnValue_t HeaterHandler::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (healthTable != nullptr) {
|
||||||
|
healthTable->registerObject(getObjectId());
|
||||||
|
}
|
||||||
|
|
||||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
if (IPCStore == nullptr) {
|
if (IPCStore == nullptr) {
|
||||||
sif::error << "HeaterHandler::initialize: IPC store not set up in factory." << std::endl;
|
sif::error << "HeaterHandler::initialize: IPC store not set up in factory." << std::endl;
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainLineSwitcherObjectId != objects::NO_OBJECT) {
|
|
||||||
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
|
|
||||||
if (mainLineSwitcher == nullptr) {
|
|
||||||
sif::error << "HeaterHandler::initialize: Failed to get main line switcher. Make sure "
|
|
||||||
<< "main line switcher object is initialized." << std::endl;
|
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = actionHelper.initialize(commandQueue);
|
result = actionHelper.initialize(commandQueue);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
@ -345,4 +350,19 @@ ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { return 0;
|
|||||||
|
|
||||||
ReturnValue_t HeaterHandler::getFuseState(uint8_t fuseNr) const { return 0; }
|
ReturnValue_t HeaterHandler::getFuseState(uint8_t fuseNr) const { return 0; }
|
||||||
|
|
||||||
uint32_t HeaterHandler::getSwitchDelayMs(void) const { return 0; }
|
uint32_t HeaterHandler::getSwitchDelayMs(void) const { return 2000; }
|
||||||
|
|
||||||
|
ReturnValue_t HeaterHandler::setHealth(HealthState health) {
|
||||||
|
if (healthTable != nullptr) {
|
||||||
|
healthTable->setHealth(getObjectId(), health);
|
||||||
|
return RETURN_OK;
|
||||||
|
}
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
HasHealthIF::HealthState HeaterHandler::getHealth() {
|
||||||
|
if (healthTable != nullptr) {
|
||||||
|
return healthTable->getHealth(getObjectId());
|
||||||
|
}
|
||||||
|
return HasHealthIF::HealthState::HEALTHY;
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <fsfw/action/HasActionsIF.h>
|
#include <fsfw/action/HasActionsIF.h>
|
||||||
#include <fsfw/devicehandlers/CookieIF.h>
|
#include <fsfw/devicehandlers/CookieIF.h>
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
#include <fsfw/health/HasHealthIF.h>
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
#include <fsfw/power/PowerSwitchIF.h>
|
#include <fsfw/power/PowerSwitchIF.h>
|
||||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||||
@ -15,6 +16,9 @@
|
|||||||
|
|
||||||
#include "devices/heaterSwitcherList.h"
|
#include "devices/heaterSwitcherList.h"
|
||||||
|
|
||||||
|
class PowerSwitchIF;
|
||||||
|
class HealthTableIF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class intends the control of heaters.
|
* @brief This class intends the control of heaters.
|
||||||
*
|
*
|
||||||
@ -22,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
class HeaterHandler : public ExecutableObjectIF,
|
class HeaterHandler : public ExecutableObjectIF,
|
||||||
public PowerSwitchIF,
|
public PowerSwitchIF,
|
||||||
|
public HasHealthIF,
|
||||||
public SystemObject,
|
public SystemObject,
|
||||||
public HasActionsIF {
|
public HasActionsIF {
|
||||||
public:
|
public:
|
||||||
@ -37,10 +42,24 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
static const DeviceCommandId_t SWITCH_HEATER = 0x0;
|
static const DeviceCommandId_t SWITCH_HEATER = 0x0;
|
||||||
|
|
||||||
HeaterHandler(object_id_t setObjectId, object_id_t gpioDriverId, CookieIF* gpioCookie,
|
HeaterHandler(object_id_t setObjectId, object_id_t gpioDriverId, CookieIF* gpioCookie,
|
||||||
object_id_t mainLineSwitcherObjectId, uint8_t mainLineSwitch);
|
PowerSwitchIF* mainLineSwitcherObjectId, power::Switch_t mainLineSwitch,
|
||||||
|
HealthTableIF* healthTable);
|
||||||
|
|
||||||
virtual ~HeaterHandler();
|
virtual ~HeaterHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the Health State
|
||||||
|
* The parent will be informed, if the Health changes
|
||||||
|
* @param health
|
||||||
|
*/
|
||||||
|
ReturnValue_t setHealth(HealthState health) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Health State
|
||||||
|
* @return Health State of the object
|
||||||
|
*/
|
||||||
|
HasHealthIF::HealthState getHealth() override;
|
||||||
|
|
||||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
|
||||||
virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
|
virtual ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;
|
||||||
@ -114,16 +133,15 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
/** Queue to receive messages from other objects. */
|
/** Queue to receive messages from other objects. */
|
||||||
MessageQueueIF* commandQueue = nullptr;
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
|
||||||
object_id_t mainLineSwitcherObjectId;
|
|
||||||
|
|
||||||
/** Switch number of the heater power supply switch */
|
|
||||||
uint8_t mainLineSwitch;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Power switcher object which controls the 8V main line of the heater
|
* Power switcher object which controls the 8V main line of the heater
|
||||||
* logic on the TCS board.
|
* logic on the TCS board.
|
||||||
*/
|
*/
|
||||||
PowerSwitchIF* mainLineSwitcher = nullptr;
|
PowerSwitchIF* mainLineSwitcher = nullptr;
|
||||||
|
/** Switch number of the heater power supply switch */
|
||||||
|
power::Switch_t mainLineSwitch;
|
||||||
|
|
||||||
|
HealthTableIF* healthTable = nullptr;
|
||||||
|
|
||||||
ActionHelper actionHelper;
|
ActionHelper actionHelper;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user