From 6c326489cbc59f2d70993542f05676472ca0102f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 10:18:46 +0200 Subject: [PATCH 1/3] adapt EM SW: GS PCDU added, but use dummy for ACU --- CMakeLists.txt | 5 ++++- bsp_q7s/OBSWConfig.h.in | 3 +++ bsp_q7s/core/ObjectFactory.cpp | 7 +++++-- bsp_q7s/em/emObjectFactory.cpp | 4 +++- dummies/helperFactory.cpp | 3 ++- dummies/helperFactory.h | 3 +++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f632d2d..6f67e669 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,8 +146,11 @@ set(OBSW_ADD_TMP_DEVICES ${INIT_VAL} CACHE STRING "Add TMP devices") set(OBSW_ADD_GOMSPACE_PCDU - ${INIT_VAL} + 1 CACHE STRING "Add GomSpace PCDU modules") +set(OBSW_ADD_GOMSPACE_ACU + ${INIT_VAL} + CACHE STRING "Add GomSpace ACU submodule") set(OBSW_ADD_RW ${INIT_VAL} CACHE STRING "Add RW modules") diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 3502a7bb..51ed8828 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -22,6 +22,9 @@ #define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1 #define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@ +// This define is necessary because the EM setup has the P60 dock module, but no ACU on the P60 +// module because it broke. +#define OBSW_ADD_GOMSPACE_ACU @OBSW_ADD_GOMSPACE_ACU@ #define OBSW_ADD_MGT @OBSW_ADD_MGT@ #define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@ #define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 964d728b..dd363e3d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -189,7 +189,6 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, *i2cComIF = new I2cComIF(objects::I2C_COM_IF); *uartComIF = new SerialComIF(objects::UART_COM_IF); *spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF); - //*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, **gpioComIF); } void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher, @@ -197,7 +196,6 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500); - CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500); auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER); P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, @@ -211,9 +209,12 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI Pdu2Handler* pdu2handler = new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir, enableHkSets); +#if OBSW_ADD_GOMSPACE_ACU == 1 + CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500); auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir, enableHkSets); +#endif auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50); /** @@ -223,7 +224,9 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI p60dockhandler->setModeNormal(); pdu1handler->setModeNormal(); pdu2handler->setModeNormal(); +#if OBSW_ADD_GOMSPACE_ACU == 1 acuhandler->setModeNormal(); +#endif if (pwrSwitcher != nullptr) { *pwrSwitcher = pcduHandler; } diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 05a3fee0..c0211478 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -56,6 +56,8 @@ void ObjectFactory::produce(void* args) { #endif #if OBSW_ADD_GOMSPACE_PCDU == 1 dummyCfg.addPowerDummies = false; + // The ACU broke. + dummyCfg.addOnlyAcuDummy = true; #endif #if OBSW_ADD_ACS_BOARD == 1 dummyCfg.addAcsBoardDummies = false; @@ -89,7 +91,7 @@ void ObjectFactory::produce(void* args) { // createRadSensorComponent(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 - createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher); + createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true); #else // Still add all GPIOs for EM. GpioCookie* acsBoardGpios = new GpioCookie(); diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 98d2ecfa..bda847d7 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -75,8 +75,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->connectModeTreeParent(*imtqAssy); - if (cfg.addPowerDummies) { + if (cfg.addOnlyAcuDummy) { new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + } else if (cfg.addPowerDummies) { new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); diff --git a/dummies/helperFactory.h b/dummies/helperFactory.h index 2181c79c..e4953a32 100644 --- a/dummies/helperFactory.h +++ b/dummies/helperFactory.h @@ -6,8 +6,11 @@ class GpioIF; namespace dummy { +// Default values targeted towards EM. struct DummyCfg { bool addCoreCtrlCfg = true; + // Special variant because the ACU broke. Overrides addPowerDummies, only ACU dummy will be added. + bool addOnlyAcuDummy = false; bool addPowerDummies = true; bool addSyrlinksDummies = true; bool addAcsBoardDummies = true; From a12794281bfc2ebb27a02bbc151696023e69a9f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 10:20:31 +0200 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5127ae..5de8f514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- Adapt EM configuration to include all GomSpace PCDU devices except the ACU. For the ACU + (which broke), a dummy will still be used. + # [v2.0.4] 2023-04-19 ## Fixed From 74d5d70973b46c70d1483077e71e2820d3ca4ad6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 13:58:08 +0200 Subject: [PATCH 3/3] this bugfix might be super important --- mission/system/acs/DualLaneAssemblyBase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index 7d22fbd1..dd9cef3c 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -183,11 +183,11 @@ void DualLaneAssemblyBase::handleModeTransitionFailed(ReturnValue_t result) { // transition to dual mode. if (not tryingOtherSide) { triggerEvent(CANT_KEEP_MODE, mode, submode); - startTransition(mode, nextSubmode); + startTransition(targetMode, nextSubmode); tryingOtherSide = true; } else { - triggerEvent(transitionOtherSideFailedEvent, mode, targetSubmode); - startTransition(mode, Submodes::DUAL_MODE); + triggerEvent(transitionOtherSideFailedEvent, targetMode, targetSubmode); + startTransition(targetMode, Submodes::DUAL_MODE); } }