From df5b0a19de3c047a8c832e11071d5462d3bc4119 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:38:26 +0200 Subject: [PATCH] improved preprocessor defines --- bsp_q7s/boardconfig/q7sConfig.h.in | 5 --- bsp_q7s/core/InitMission.cpp | 4 +- bsp_q7s/core/ObjectFactory.cpp | 6 +-- linux/boardtest/SpiTestClass.cpp | 2 +- linux/fsfwconfig/OBSWConfig.h.in | 4 +- .../pollingSequenceFactory.cpp | 40 +++++++++---------- 6 files changed, 29 insertions(+), 32 deletions(-) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 0eb4f759..40b5a510 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -30,11 +30,6 @@ #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 #define Q7S_ADD_RTD_DEVICES 0 -// Only one of those 2 should be enabled! -#if OBSW_ADD_ACS_BOARD == 0 -#define Q7S_ADD_SPI_TEST 0 -#endif - #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 namespace config { diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index 49e9d8ca..5ddb6b9b 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -167,7 +167,7 @@ void initmission::createPstTasks(TaskFactory& factory, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; #if BOARD_TE0720 == 0 /* Polling Sequence Table Default */ -#if Q7S_ADD_SPI_TEST == 0 +#if OBSW_ADD_SPI_TEST_CODE == 0 FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc); @@ -297,7 +297,7 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } -#if Q7S_ADD_SPI_TEST == 1 +#if OBSW_ADD_SPI_TEST_CODE == 1 result = testTask->addComponent(objects::SPI_TEST); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("SPI_TEST", objects::SPI_TEST); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e3a284fc..d8b34aac 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -229,9 +229,9 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF, new CspComIF(objects::CSP_COM_IF); new I2cComIF(objects::I2C_COM_IF); *uartComIF = new UartComIF(objects::UART_COM_IF); -#if Q7S_ADD_SPI_TEST == 0 +#if OBSW_ADD_SPI_TEST_CODE == 0 *spiComIF = new SpiComIF(objects::SPI_COM_IF, *gpioComIF); -#endif /* Q7S_ADD_SPI_TEST == 0 */ +#endif /* Q7S_ADD_SPI_TEST_CODE == 0 */ #if BOARD_TE0720 == 0 /* Adding gpios for chip select decoding to the gpioComIf */ @@ -903,7 +903,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) { plocSupervisor->setStartUpImmediately(); #endif -#if Q7S_ADD_SPI_TEST == 1 +#if OBSW_ADD_SPI_TEST_CODE == 1 new SpiTestClass(objects::SPI_TEST, gpioComIF); #endif diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 21af4a2f..a5a773d1 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -24,7 +24,7 @@ gpioIF(gpioIF) { if(gpioIF == nullptr) { sif::error << "SpiTestClass::SpiTestClass: Invalid GPIO ComIF!" << std::endl; } - testMode = TestModes::MGM_LIS3MDL; + testMode = TestModes::MGM_RM3100; spiTransferStruct.rx_buf = reinterpret_cast<__u64>(recvBuffer.data()); spiTransferStruct.tx_buf = reinterpret_cast<__u64>(sendBuffer.data()); } diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 5db0243c..dc397635 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -47,7 +47,9 @@ debugging. */ //! /* Can be used to switch device to NORMAL mode immediately */ #define OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP 1 #define OBSW_PRINT_MISSED_DEADLINES 1 -#define OBSW_ADD_TEST_CODE 0 +// If this is enabled, all other SPI code should be disabled +#define OBSW_ADD_TEST_CODE 1 +#define OBSW_ADD_SPI_TEST_CODE 0 #define OBSW_ADD_TEST_PST 0 #define OBSW_ADD_TEST_TASK 0 #define OBSW_TEST_LIBGPIOD 0 diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 8342b3cb..0074ecec 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -458,16 +458,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); // -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, -// DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, -// DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, -// DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, -// DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, -// DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); @@ -480,16 +480,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION);