Extend Power Switch Handling #212

Merged
meierj merged 3 commits from mueller/extend-power-switch-handling into develop 2022-04-14 11:21:36 +02:00
6 changed files with 25 additions and 9 deletions

View File

@ -160,7 +160,8 @@ void ObjectFactory::produce(void* args) {
#if OBSW_ADD_MGT == 1
I2cCookie* imtqI2cCookie =
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie,
pcdu::Switches::PDU1_CH3_MGT_5V);
imtqHandler->setPowerSwitcher(pwrSwitcher);
static_cast<void>(imtqHandler);
#if OBSW_DEBUG_IMTQ == 1
@ -628,14 +629,15 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
}
void ObjectFactory::createSyrlinksComponents() {
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
UartCookie* syrlinksUartCookie =
new UartCookie(objects::SYRLINKS_HK_HANDLER, q7s::UART_SYRLINKS_DEV, uart::SYRLINKS_BAUD,
syrlinks::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
syrlinksUartCookie->setParityEven();
new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
pcdu::PDU1_CH1_SYRLINKS_12V);
auto syrlinksHandler = new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER, objects::UART_COM_IF,
syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V);
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
}
void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {

View File

@ -24,7 +24,7 @@ void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
PowerSwitchIF* pwrSwitcher);
void createHeaterComponents();
void createSolarArrayDeploymentComponents();
void createSyrlinksComponents();
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
void createCcsdsComponents(LinuxLibgpioIF* gpioComIF);

2
fsfw

@ -1 +1 @@
Subproject commit e949368b062e8703c35d2043ece8d7258cd2608b
Subproject commit 186b3565e0eb6ca10ec2203febdbc7eb7e7f7fe0

@ -1 +1 @@
Subproject commit 9a92c7de0a2fedfcc638c0517e3edea123e977f8
Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5

View File

@ -7,8 +7,10 @@
#include "OBSWConfig.h"
IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie)
IMTQHandler::IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t pwrSwitcher)
: DeviceHandlerBase(objectId, comIF, comCookie),
switcher(pwrSwitcher),
engHkDataset(this),
calMtmMeasurementSet(this),
rawMtmMeasurementSet(this),
@ -2178,3 +2180,12 @@ std::string IMTQHandler::makeStepString(const uint8_t step) {
}
return stepString;
}
ReturnValue_t IMTQHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
if (switcher != power::NO_SWITCH) {
*numberOfSwitches = 1;
*switches = &switcher;
return RETURN_OK;
}
return DeviceHandlerBase::NO_SWITCH;
}

View File

@ -12,7 +12,8 @@
*/
class IMTQHandler : public DeviceHandlerBase {
public:
IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie);
IMTQHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
power::Switch_t pwrSwitcher);
virtual ~IMTQHandler();
/**
@ -36,6 +37,7 @@ class IMTQHandler : public DeviceHandlerBase {
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;
ReturnValue_t getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) override;
private:
static const uint8_t INTERFACE_ID = CLASS_ID::IMTQ_HANDLER;
@ -111,6 +113,7 @@ class IMTQHandler : public DeviceHandlerBase {
StartupStep startupStep = StartupStep::COMMAND_SELF_TEST;
power::Switch_t switcher = power::NO_SWITCH;
bool selfTestPerformed = false;
/**