diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 1d502fef..ced1d12a 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -127,12 +127,14 @@ void initmission::initTasks() { "SYS_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.4, missedDeadlineFunc); result = sysTask->addComponent(objects::ACS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("ACS_ASS", objects::ACS_BOARD_ASS); + initmission::printAddObjectError("ACS_BOARD_ASS", objects::ACS_BOARD_ASS); } +#if OBSW_ADD_SUS_BOARD_ASS == 1 result = sysTask->addComponent(objects::SUS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { - initmission::printAddObjectError("SUS_ASS", objects::SUS_BOARD_ASS); + initmission::printAddObjectError("SUS_BOARD_ASS", objects::SUS_BOARD_ASS); } +#endif result = sysTask->addComponent(objects::TCS_BOARD_ASS); if (result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 2728a0c7..123ef60e 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -252,10 +252,8 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); - pdu1handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF); PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); - pdu2handler->assignChannelHookFunction(&pcdu::switchCallback, gpioComIF); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); auto pcduHandler = new PCDUHandler(objects::PCDU_HANDLER, 50); @@ -558,15 +556,6 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI auto acsAss = new AcsBoardAssembly(objects::ACS_BOARD_ASS, objects::NO_OBJECT, pwrSwitcher, acsBoardHelper, gpioComIF); static_cast(acsAss); -#if OBSW_TEST_ACS_BOARD_ASS == 1 - CommandMessage msg; - ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL, - duallane::A_SIDE); - ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg); - if (result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "Sending mode command failed" << std::endl; - } -#endif #endif /* OBSW_ADD_ACS_HANDLERS == 1 */ } @@ -962,3 +951,13 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { new UartTestClass(objects::UART_TEST); #endif } + +void ObjectFactory::testAcsBrdAss(AcsBoardAssembly* acsAss) { + CommandMessage msg; + ModeMessage::setModeMessage(&msg, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL, + duallane::A_SIDE); + ReturnValue_t result = MessageQueueSenderIF::sendMessage(acsAss->getCommandQueue(), &msg); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "Sending mode command failed" << std::endl; + } +} diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index 9bb2043c..bfa045c1 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -6,6 +6,7 @@ class UartComIF; class SpiComIF; class I2cComIF; class PowerSwitchIF; +class AcsBoardAssembly; namespace ObjectFactory { @@ -29,6 +30,8 @@ void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF); void createCcsdsComponents(LinuxLibgpioIF* gpioComIF); void createTestComponents(LinuxLibgpioIF* gpioComIF); +void testAcsBrdAss(AcsBoardAssembly* assAss); + }; // namespace ObjectFactory #endif /* BSP_Q7S_OBJECTFACTORY_H_ */ diff --git a/generators/fsfwgen b/generators/fsfwgen index 1c8be25e..5ad9fb94 160000 --- a/generators/fsfwgen +++ b/generators/fsfwgen @@ -1 +1 @@ -Subproject commit 1c8be25e185aada13392a75234fa463240f424a0 +Subproject commit 5ad9fb94af3312d29863527106396395f7b808a5 diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index e8525df1..bbf8da64 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -44,6 +44,7 @@ debugging. */ #define OBSW_ADD_PLOC_SUPERVISOR 0 #define OBSW_ADD_PLOC_MPSOC 0 #define OBSW_ADD_SUN_SENSORS 1 +#define OBSW_ADD_SUS_BOARD_ASS 1 #define OBSW_ADD_ACS_BOARD 1 #define OBSW_ADD_ACS_HANDLERS 1 #define OBSW_ADD_RW 0 @@ -115,7 +116,6 @@ debugging. */ #define OBSW_ADD_UART_TEST_CODE 0 #define OBSW_TEST_ACS 0 -#define OBSW_TEST_ACS_BOARD_ASS 0 #define OBSW_DEBUG_ACS 0 #define OBSW_TEST_SUS 0 #define OBSW_DEBUG_SUS 0 diff --git a/mission/system/AcsBoardAssembly.cpp b/mission/system/AcsBoardAssembly.cpp index 5a8f0956..e319f32b 100644 --- a/mission/system/AcsBoardAssembly.cpp +++ b/mission/system/AcsBoardAssembly.cpp @@ -142,12 +142,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm0Lis3IdSideA, helper.mgm0SideAMode, ModeTableIdx::MGM_0_A); cmdSeq(helper.mgm1Rm3100IdSideA, helper.mgm1SideAMode, ModeTableIdx::MGM_1_A); if (gpsUsable) { - if (gpioIF->pullLow(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { -#if OBSW_VERBOSE_LEVEL >= 1 - sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low" - << std::endl; -#endif - } + gpioHandler(gpioIds::GNSS_0_NRESET, true, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 high (used GNSS)"); + gpioHandler(gpioIds::GNSS_1_NRESET, false, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 low (unused GNSS)"); + gpioHandler(gpioIds::GNSS_SELECT, false, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select low"); } break; } @@ -165,12 +167,14 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm2Lis3IdSideB, helper.mgm2SideBMode, ModeTableIdx::MGM_2_B); cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); if (gpsUsable) { - if (gpioIF->pullHigh(gpioIds::GNSS_SELECT) != HasReturnvaluesIF::RETURN_OK) { -#if OBSW_VERBOSE_LEVEL >= 1 - sif::error << "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high" - << std::endl; -#endif - } + gpioHandler(gpioIds::GNSS_0_NRESET, false, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 low (unused GNSS)"); + gpioHandler(gpioIds::GNSS_1_NRESET, true, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 high (used GNSS)"); + gpioHandler(gpioIds::GNSS_SELECT, true, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull GNSS select high"); } break; } @@ -186,6 +190,12 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s cmdSeq(helper.mgm3Rm3100IdSideB, helper.mgm3SideBMode, ModeTableIdx::MGM_3_B); ReturnValue_t status = RETURN_OK; if (gpsUsable) { + gpioHandler(gpioIds::GNSS_0_NRESET, true, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 0 high (used GNSS)"); + gpioHandler(gpioIds::GNSS_1_NRESET, true, + "AcsBoardAssembly::handleNormalOrOnModeCmd: Could not pull nReset pin" + "of GNSS 1 high (used GNSS)"); if (defaultSubmode == Submodes::A_SIDE) { status = gpioIF->pullLow(gpioIds::GNSS_SELECT); } else { @@ -233,6 +243,20 @@ void AcsBoardAssembly::selectGpsInDualMode(duallane::Submodes side) { } } +void AcsBoardAssembly::gpioHandler(gpioId_t gpio, bool high, std::string error) { + ReturnValue_t result = RETURN_OK; + if(high) { + result = gpioIF->pullHigh(gpio); + } else { + result = gpioIF->pullLow(gpio); + } + if (result != HasReturnvaluesIF::RETURN_OK) { +#if OBSW_VERBOSE_LEVEL >= 1 + sif::error << error << std::endl; +#endif + } +} + void AcsBoardAssembly::refreshHelperModes() { try { helper.gyro0SideAMode = childrenMap.at(helper.gyro0AdisIdSideA).mode; diff --git a/mission/system/AcsBoardAssembly.h b/mission/system/AcsBoardAssembly.h index 45242d1c..0ed65227 100644 --- a/mission/system/AcsBoardAssembly.h +++ b/mission/system/AcsBoardAssembly.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "DualLaneAssemblyBase.h" #include "DualLanePowerStateMachine.h" @@ -115,6 +116,7 @@ class AcsBoardAssembly : public DualLaneAssemblyBase { GpioIF* gpioIF = nullptr; FixedArrayList modeTable; + void gpioHandler(gpioId_t gpio, bool high, std::string error); ReturnValue_t initialize() override; diff --git a/mission/system/DualLaneAssemblyBase.h b/mission/system/DualLaneAssemblyBase.h index e0996848..3017afc0 100644 --- a/mission/system/DualLaneAssemblyBase.h +++ b/mission/system/DualLaneAssemblyBase.h @@ -50,6 +50,7 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF { * @return */ bool isUseable(object_id_t object, Mode_t mode); + /** * Thin wrapper function which is required because the helper class * can not access protected member functions.