diff --git a/CMakeLists.txt b/CMakeLists.txt index ec6dc555..22e45134 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,8 +44,10 @@ set(FSFW_PATH fsfw) set(MISSION_PATH mission) set(CSPLIB_PATH libcsp) set(TEST_PATH test/testtasks) +set(LINUX_PATH linux) set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF) +set(ADD_LINUX_FILES FALSE) # Analyse different OS and architecture/target options, determine BSP_PATH, # display information about compiler etc. @@ -53,17 +55,15 @@ include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake) pre_source_hw_os_config() if(TGT_BSP) - if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi") - set(ROOT_CONFIG_FOLDER TRUE) - set(FSFW_CONFIG_PATH "fsfwconfig") - endif() - - if(${TGT_BSP} MATCHES "arm/q7s") - set(ADD_CSP_LIB TRUE) - endif() + if(${TGT_BSP} MATCHES "arm/q7s" OR ${TGT_BSP} MATCHES "arm/raspberrypi") + set(ROOT_CONFIG_FOLDER TRUE) + set(FSFW_CONFIG_PATH "fsfwconfig") + set(ADD_LINUX_FILES TRUE) + set(ADD_CSP_LIB TRUE) + endif() else() - # Required by FSFW library - set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") + # Required by FSFW library + set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") endif() ################################################################################ @@ -75,11 +75,15 @@ add_executable(${TARGET_NAME}) # Add subdirectories if(ROOT_CONFIG_FOLDER) - add_subdirectory(${FSFW_CONFIG_PATH}) + add_subdirectory(${FSFW_CONFIG_PATH}) endif() if(ADD_CSP_LIB) - add_subdirectory(${CSPLIB_PATH}) + add_subdirectory(${CSPLIB_PATH}) +endif() + +if(ADD_LINUX_FILES) + add_subdirectory(${LINUX_PATH}) endif() add_subdirectory(${BSP_PATH}) diff --git a/README.md b/README.md index 673ccbe4..4d8c0ecf 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,7 @@ Target systems: The steps in the primary README are related to the main OBC target Q7S. The CMake build system can be used to generate build systems as well (see helper scripts in `cmake/scripts`: -- Linux (Raspberry Pi): Using the `bsp_rpi` BSP folder, and a very similar cross-compiler. - For running the software on a Raspberry Pi, it is recommended to follow the steps specified in - [the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) and - using the TCF agent to have a similar set-up process also required for the Q7S. +- Linux (Raspberry Pi): See special section below. - Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator. - Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2. @@ -89,6 +86,13 @@ C++ applications. Alternatively you can download the toolchain sudo apt-get install cmake ```` +## Getting the Q7S system root + +It is necessary to copy the Q7S system root to your local development machine for libraries +like `libgpio`. You can find the system root [here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486). Download it and unzip it somewhere in the Xilinx installation folder. + +Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path. + ## Building the software with CMake When using Windows, run theses steps in MSYS2. @@ -149,9 +153,9 @@ The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debu After that, comfortable remote debugging should be possible with the Debug button. -A build configuration and a shell helper script has been provided to set up the path variables and build the Q7S binary -on Windows, but a launch configuration needs to be newly created because the IP address and path settings differ -from machine to machine. +A build configuration and a shell helper script has been provided to set up the path variables and +build the Q7S binary on Windows, but a launch configuration needs to be newly created because the +IP address and path settings differ from machine to machine. ## Building in Xilinx SDK 2018.2 @@ -501,6 +505,7 @@ GET out_en[0] = 1 * Remote File Path: /tmp/eive_obsw.elf ## Libgpiod + Detect all gpio device files: ```` gpiodetect @@ -527,3 +532,26 @@ gpioget ```` Example to get state: gpioget gpiochip7 14 + +## Running the EIVE OBSW on a Raspberry Pi + +Special section for running the EIVE OBSW on the Raspberry Pi. +The Raspberry Pi build uses the `bsp_rpi` BSP folder, and a very similar cross-compiler. + +For running the software on a Raspberry Pi, it is recommended to follow the steps specified in +[the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top) +and using the TCF agent to have a similar set-up process also required for the Q7S. +You should run the following command first on your Raspberry Pi + +```sh +sudo apt-get install gpiod libgpiod-dev +``` + +to install the required GPIO libraries before cloning the system root folder. + +## Special notes on Eclipse + +When using Eclipse, there are two special build variables in the project properties +→ C/C++ Build → Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set +the sysroot path in those variables to get any additional includes like `gpiod.h` in the +Eclipse indexer. \ No newline at end of file diff --git a/bsp_hosted/fsfwconfig/OBSWConfig.h b/bsp_hosted/fsfwconfig/OBSWConfig.h index fa3769b1..b784cd03 100644 --- a/bsp_hosted/fsfwconfig/OBSWConfig.h +++ b/bsp_hosted/fsfwconfig/OBSWConfig.h @@ -8,9 +8,9 @@ #define OBSW_ADD_TEST_CODE 0 -// These defines should be disabled for mission code but are useful for -// debugging. -#define OBSW_ENHANCED_PRINTOUT 1 +/* These defines should be disabled for mission code but are useful for +debugging. */ +#define OBSW_VEBOSE_LEVEL 1 #ifdef __cplusplus diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index 806feca9..3d3a1c91 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -6,7 +6,7 @@ target_sources(${TARGET_NAME} PUBLIC add_subdirectory(boardconfig) add_subdirectory(comIF) -add_subdirectory(gpio) +add_subdirectory(boardtest) diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/ObjectFactory.cpp index 5dde01d3..a4503981 100644 --- a/bsp_q7s/ObjectFactory.cpp +++ b/bsp_q7s/ObjectFactory.cpp @@ -26,147 +26,151 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -# if TEST_LIBGPIOD == 1 +#if TEST_LIBGPIOD == 1 #include "LibgpiodTest.h" #endif void Factory::setStaticFrameworkObjectIds() { - PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; - PusServiceBase::packetDestination = objects::TM_FUNNEL; + PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; + PusServiceBase::packetDestination = objects::TM_FUNNEL; - CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; - CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; + CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; + CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; - TmFunnel::downlinkDestination = objects::UDP_BRIDGE; - // No storage object for now. - TmFunnel::storageDestination = objects::NO_OBJECT; + TmFunnel::downlinkDestination = objects::UDP_BRIDGE; + // No storage object for now. + TmFunnel::storageDestination = objects::NO_OBJECT; - LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; + LocalDataPoolManager::defaultHkDestination = objects::NO_OBJECT; - VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; - TmPacketStored::timeStamperId = objects::TIME_STAMPER; + VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; + TmPacketStored::timeStamperId = objects::TIME_STAMPER; } void ObjectFactory::produce(){ - Factory::setStaticFrameworkObjectIds(); - ObjectFactory::produceGenericObjects(); + Factory::setStaticFrameworkObjectIds(); + ObjectFactory::produceGenericObjects(); #if TE0720 == 1 - I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, - TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); - I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, - TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); + I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, + TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); + I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, + TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); #else - I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, + I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1")); I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-1")); #endif /* Communication interfaces */ - new CspComIF(objects::CSP_COM_IF); - new I2cComIF(objects::I2C_COM_IF); + new CspComIF(objects::CSP_COM_IF); + new I2cComIF(objects::I2C_COM_IF); #if TE0720 == 0 - CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, - addresses::P60DOCK); + CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, + addresses::P60DOCK); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU1); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH, addresses::PDU2); CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_LENGTH, - addresses::ACU); + addresses::ACU); /* Device Handler */ - P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, p60DockCspCookie); - PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, objects::CSP_COM_IF, pdu1CspCookie); - PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie); - ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie); - new PCDUHandler(objects::PCDU_HANDLER, 50); + P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, + objects::CSP_COM_IF, p60DockCspCookie); + PDU1Handler* pdu1handler = new PDU1Handler(objects::PDU1_HANDLER, + objects::CSP_COM_IF, pdu1CspCookie); + PDU2Handler* pdu2handler = new PDU2Handler(objects::PDU2_HANDLER, + objects::CSP_COM_IF, pdu2CspCookie); + ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, + objects::CSP_COM_IF, acuCspCookie); + new PCDUHandler(objects::PCDU_HANDLER, 50); - /** - * Setting PCDU devices to mode normal immediately after start up because PCDU is always - * running. - */ - p60dockhandler->setModeNormal(); - pdu1handler->setModeNormal(); - pdu2handler->setModeNormal(); - acuhandler->setModeNormal(); + /** + * Setting PCDU devices to mode normal immediately after start up because PCDU is always + * running. + */ + p60dockhandler->setModeNormal(); + pdu1handler->setModeNormal(); + pdu2handler->setModeNormal(); + acuhandler->setModeNormal(); #endif - /* Temperature sensors */ - Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( - objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, - i2cCookieTmp1075tcs1); - tmp1075Handler_1->setStartUpImmediately(); - Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler( - objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, - i2cCookieTmp1075tcs2); - tmp1075Handler_2->setStartUpImmediately(); + /* Temperature sensors */ + Tmp1075Handler* tmp1075Handler_1 = new Tmp1075Handler( + objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, + i2cCookieTmp1075tcs1); + tmp1075Handler_1->setStartUpImmediately(); + Tmp1075Handler* tmp1075Handler_2 = new Tmp1075Handler( + objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, + i2cCookieTmp1075tcs2); + tmp1075Handler_2->setStartUpImmediately(); - GpioCookie* gpioCookie = new GpioCookie; - new LinuxLibgpioIF(objects::GPIO_IF); + GpioCookie* gpioCookie = new GpioCookie; + new LinuxLibgpioIF(objects::GPIO_IF); #if TE0720 == 0 - /* Pin H2-11 on stack connector */ - GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, - std::string("Heater0"), Gpio::OUT, 0); + /* Pin H2-11 on stack connector */ + GpioConfig_t gpioConfigHeater0(std::string("gpiochip7"), 18, + std::string("Heater0"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ GpioConfig_t gpioConfigHeater1(std::string("gpiochip7"), 14, - std::string("Heater1"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); + std::string("Heater1"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); - /* Pin H2-13 on stack connector */ + /* Pin H2-13 on stack connector */ GpioConfig_t gpioConfigHeater2(std::string("gpiochip7"), 20, - std::string("Heater2"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); + std::string("Heater2"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); GpioConfig_t gpioConfigHeater3(std::string("gpiochip7"), 16, - std::string("Heater3"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); + std::string("Heater3"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); GpioConfig_t gpioConfigHeater4(std::string("gpiochip7"), 24, - std::string("Heater4"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); + std::string("Heater4"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); GpioConfig_t gpioConfigHeater5(std::string("gpiochip7"), 26, - std::string("Heater5"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); + std::string("Heater5"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); GpioConfig_t gpioConfigHeater6(std::string("gpiochip7"), 22, - std::string("Heater6"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); + std::string("Heater6"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); GpioConfig_t gpioConfigHeater7(std::string("gpiochip7"), 28, - std::string("Heater7"), Gpio::OUT, 0); - gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); + std::string("Heater7"), gpio::OUT, 0); + gpioCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); - new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, - pcduSwitches::TCS_BOARD_8V_HEATER_IN); + new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, + pcduSwitches::TCS_BOARD_8V_HEATER_IN); #endif - new TmTcUnixUdpBridge(objects::UDP_BRIDGE, - objects::CCSDS_PACKET_DISTRIBUTOR, - objects::TM_STORE, objects::TC_STORE); - new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); + new TmTcUnixUdpBridge(objects::UDP_BRIDGE, + objects::CCSDS_PACKET_DISTRIBUTOR, + objects::TM_STORE, objects::TC_STORE); + new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); #if TE0720 == 1 && TEST_LIBGPIOD == 1 - /* Configure MIO0 as input */ + /* Configure MIO0 as input */ GpioConfig_t gpioConfigMio0(std::string("gpiochip0"), 0, - std::string("MIO0"), Gpio::IN, 0); + std::string("MIO0"), gpio::IN, 0); gpioCookie->addGpio(gpioIds::Test_ID, gpioConfigMio0); - new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); + new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); #elif TE0720 == 1 - // Configuration for MIO0 on TE0720-03-1CFA + /* Configuration for MIO0 on TE0720-03-1CFA */ GpioConfig_t gpioConfigForDummyHeater(std::string("gpiochip0"), 0, - std::string("Heater0"), Gpio::OUT, 0); + std::string("Heater0"), gpio::OUT, 0); gpioCookie->addGpio(gpioIds::HEATER_0, gpioConfigForDummyHeater); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN); diff --git a/bsp_q7s/ObjectFactory.h b/bsp_q7s/ObjectFactory.h index 5e3358ae..38ec0e9e 100644 --- a/bsp_q7s/ObjectFactory.h +++ b/bsp_q7s/ObjectFactory.h @@ -1,10 +1,9 @@ #ifndef BSP_Q7S_OBJECTFACTORY_H_ #define BSP_Q7S_OBJECTFACTORY_H_ - namespace ObjectFactory { - void setStatics(); - void produce(); +void setStatics(); +void produce(); }; #endif /* BSP_Q7S_OBJECTFACTORY_H_ */ diff --git a/bsp_q7s/boardtest/CMakeLists.txt b/bsp_q7s/boardtest/CMakeLists.txt new file mode 100644 index 00000000..7e59ddb9 --- /dev/null +++ b/bsp_q7s/boardtest/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${TARGET_NAME} PRIVATE + LibgpiodTest.cpp +) + + + + diff --git a/test/testtasks/LibgpiodTest.cpp b/bsp_q7s/boardtest/LibgpiodTest.cpp similarity index 92% rename from test/testtasks/LibgpiodTest.cpp rename to bsp_q7s/boardtest/LibgpiodTest.cpp index 3315f0f6..51f89abe 100644 --- a/test/testtasks/LibgpiodTest.cpp +++ b/bsp_q7s/boardtest/LibgpiodTest.cpp @@ -1,10 +1,11 @@ #include "LibgpiodTest.h" -#include "devices/gpioIds.h" +#include #include #include -LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) : +LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, + GpioCookie* gpioCookie): TestTask(objectId) { gpioInterface = objectManager->get(gpioIfobjectId); diff --git a/test/testtasks/LibgpiodTest.h b/bsp_q7s/boardtest/LibgpiodTest.h similarity index 89% rename from test/testtasks/LibgpiodTest.h rename to bsp_q7s/boardtest/LibgpiodTest.h index c64f25a3..678c06a3 100644 --- a/test/testtasks/LibgpiodTest.h +++ b/bsp_q7s/boardtest/LibgpiodTest.h @@ -2,8 +2,8 @@ #define TEST_TESTTASKS_LIBGPIODTEST_H_ #include "TestTask.h" -#include "GpioIF.h" -#include "GpioCookie.h" +#include +#include #include /** diff --git a/bsp_q7s/comIF/CMakeLists.txt b/bsp_q7s/comIF/CMakeLists.txt index a2236937..0599b73f 100644 --- a/bsp_q7s/comIF/CMakeLists.txt +++ b/bsp_q7s/comIF/CMakeLists.txt @@ -1,8 +1,4 @@ target_sources(${TARGET_NAME} PRIVATE - cookies/CspCookie.cpp - cookies/I2cCookie.cpp - CspComIF.cpp - I2cComIF.cpp ) diff --git a/bsp_q7s/gpio/CMakeLists.txt b/bsp_q7s/gpio/CMakeLists.txt deleted file mode 100644 index 3b789394..00000000 --- a/bsp_q7s/gpio/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -target_sources(${TARGET_NAME} PUBLIC - cookies/GpioCookie.cpp - LinuxLibgpioIF.cpp -) - -target_include_directories(${TARGET_NAME} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/cookies -) - - diff --git a/fsfw b/fsfw index 7d0916a4..c2839825 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1 +Subproject commit c28398257b68facbabb19d7228b045f1388305df diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index 6cdf0024..66eddf12 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -6,18 +6,17 @@ #ifndef FSFWCONFIG_OBSWCONFIG_H_ #define FSFWCONFIG_OBSWCONFIG_H_ -#define TEST_LIBGPIOD 0 -#define ADD_TEST_TAST 0 +#define TEST_LIBGPIOD 0 -// These defines should be disabled for mission code but are useful for -// debugging. -#define OBSW_ENHANCED_PRINTOUT 1 +/* These defines should be disabled for mission code but are useful for +debugging. */ +#define OBSW_VERBOSE_LEVEL 1 -#define TE0720 0 +#define TE0720 0 -#define P60DOCK_DEBUG 0 -#define PDU1_DEBUG 0 -#define PDU2_DEBUG 0 +#define P60DOCK_DEBUG 0 +#define PDU1_DEBUG 0 +#define PDU2_DEBUG 0 #include "OBSWVersion.h" diff --git a/fsfwconfig/devices/gpioIds.h b/fsfwconfig/devices/gpioIds.h index 332de906..cfef7e75 100644 --- a/fsfwconfig/devices/gpioIds.h +++ b/fsfwconfig/devices/gpioIds.h @@ -1,7 +1,7 @@ #ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_ #define FSFWCONFIG_DEVICES_GPIOIDS_H_ -#include +#include namespace gpioIds { enum gpioId_t { diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 00000000..9a25fdff --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(gpio) +add_subdirectory(i2c) +add_subdirectory(csp) +add_subdirectory(spi) + diff --git a/linux/csp/CMakeLists.txt b/linux/csp/CMakeLists.txt new file mode 100644 index 00000000..b5b2768e --- /dev/null +++ b/linux/csp/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + CspComIF.cpp + CspCookie.cpp +) + + + + diff --git a/bsp_q7s/comIF/CspComIF.cpp b/linux/csp/CspComIF.cpp similarity index 99% rename from bsp_q7s/comIF/CspComIF.cpp rename to linux/csp/CspComIF.cpp index 9d7543c3..64808eff 100644 --- a/bsp_q7s/comIF/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -1,5 +1,5 @@ #include "CspComIF.h" -#include "cookies/CspCookie.h" +#include "CspCookie.h" #include #include @@ -7,7 +7,6 @@ CspComIF::CspComIF(object_id_t objectId) : SystemObject(objectId) { - } CspComIF::~CspComIF() { diff --git a/bsp_q7s/comIF/CspComIF.h b/linux/csp/CspComIF.h similarity index 100% rename from bsp_q7s/comIF/CspComIF.h rename to linux/csp/CspComIF.h diff --git a/bsp_q7s/comIF/cookies/CspCookie.cpp b/linux/csp/CspCookie.cpp similarity index 100% rename from bsp_q7s/comIF/cookies/CspCookie.cpp rename to linux/csp/CspCookie.cpp diff --git a/bsp_q7s/comIF/cookies/CspCookie.h b/linux/csp/CspCookie.h similarity index 100% rename from bsp_q7s/comIF/cookies/CspCookie.h rename to linux/csp/CspCookie.h diff --git a/linux/gpio/CMakeLists.txt b/linux/gpio/CMakeLists.txt new file mode 100644 index 00000000..052173b3 --- /dev/null +++ b/linux/gpio/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + GpioCookie.cpp + LinuxLibgpioIF.cpp +) + + + + diff --git a/bsp_q7s/gpio/cookies/GpioCookie.cpp b/linux/gpio/GpioCookie.cpp similarity index 93% rename from bsp_q7s/gpio/cookies/GpioCookie.cpp rename to linux/gpio/GpioCookie.cpp index 36760c4d..f4e585d1 100644 --- a/bsp_q7s/gpio/cookies/GpioCookie.cpp +++ b/linux/gpio/GpioCookie.cpp @@ -1,4 +1,4 @@ -#include +#include "GpioCookie.h" #include GpioCookie::GpioCookie() { diff --git a/bsp_q7s/gpio/cookies/GpioCookie.h b/linux/gpio/GpioCookie.h similarity index 68% rename from bsp_q7s/gpio/cookies/GpioCookie.h rename to linux/gpio/GpioCookie.h index acc360e0..72011750 100644 --- a/bsp_q7s/gpio/cookies/GpioCookie.h +++ b/linux/gpio/GpioCookie.h @@ -1,17 +1,17 @@ #ifndef SAM9G20_COMIF_COOKIES_GPIO_COOKIE_H_ #define SAM9G20_COMIF_COOKIES_GPIO_COOKIE_H_ +#include "GpioIF.h" #include -#include #include #include #include -namespace Gpio { - enum Direction { - IN = 0, - OUT = 1 - }; +namespace gpio { +enum Direction { + IN = 0, + OUT = 1 +}; } /** @@ -29,17 +29,17 @@ namespace Gpio { * pointer. */ typedef struct GpioConfig { - GpioConfig(std::string chipname_, int lineNum_, std::string consumer_, - Gpio::Direction direction_, int initValue_) : - chipname(chipname_), lineNum(lineNum_), consumer(consumer_), direction( - direction_), initValue(initValue_) { - } - std::string chipname; - int lineNum; - std::string consumer; - Gpio::Direction direction; - int initValue; - struct gpiod_line* lineHandle; + GpioConfig(std::string chipname_, int lineNum_, std::string consumer_, + gpio::Direction direction_, int initValue_) : + chipname(chipname_), lineNum(lineNum_), consumer(consumer_), direction(direction_), + initValue(initValue_) { + } + std::string chipname; + int lineNum; + std::string consumer; + gpio::Direction direction; + int initValue; + struct gpiod_line* lineHandle = nullptr; } GpioConfig_t; using GpioMap = std::unordered_map; using GpioMapIter = GpioMap::iterator; @@ -57,20 +57,20 @@ using GpioMapIter = GpioMap::iterator; class GpioCookie: public CookieIF { public: - GpioCookie(); + GpioCookie(); - virtual ~GpioCookie(); + virtual ~GpioCookie(); - void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig); - /** - * @brief Get map with registered GPIOs. - */ - GpioMap getGpioMap() const; + void addGpio(gpioId_t gpioId, GpioConfig_t gpioConfig); + /** + * @brief Get map with registered GPIOs. + */ + GpioMap getGpioMap() const; private: - GpioMap gpioMap; - GpioMapIter gpioMapIter; + GpioMap gpioMap; + GpioMapIter gpioMapIter; }; #endif diff --git a/bsp_q7s/gpio/GpioIF.h b/linux/gpio/GpioIF.h similarity index 100% rename from bsp_q7s/gpio/GpioIF.h rename to linux/gpio/GpioIF.h diff --git a/bsp_q7s/gpio/LinuxLibgpioIF.cpp b/linux/gpio/LinuxLibgpioIF.cpp similarity index 61% rename from bsp_q7s/gpio/LinuxLibgpioIF.cpp rename to linux/gpio/LinuxLibgpioIF.cpp index 97159315..e5db2934 100644 --- a/bsp_q7s/gpio/LinuxLibgpioIF.cpp +++ b/linux/gpio/LinuxLibgpioIF.cpp @@ -1,5 +1,5 @@ -#include -#include +#include "LinuxLibgpioIF.h" +#include #include #include @@ -12,36 +12,36 @@ LinuxLibgpioIF::~LinuxLibgpioIF() { } ReturnValue_t LinuxLibgpioIF::initialize(CookieIF * cookie){ - ReturnValue_t result; - GpioMap mapToAdd; + ReturnValue_t result; + GpioMap mapToAdd; - if(cookie == nullptr) { - sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; - return RETURN_FAILED; - } - GpioCookie* gpioCookie = dynamic_cast(cookie); - if(gpioCookie == nullptr) { - sif::error << "LinuxLibgpioIF: Invalid Gpio Cookie!" - << std::endl; - return RETURN_FAILED; - } + if(cookie == nullptr) { + sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; + return RETURN_FAILED; + } + GpioCookie* gpioCookie = dynamic_cast(cookie); + if(gpioCookie == nullptr) { + sif::error << "LinuxLibgpioIF: Invalid Gpio Cookie!" + << std::endl; + return RETURN_FAILED; + } - mapToAdd = gpioCookie->getGpioMap(); + mapToAdd = gpioCookie->getGpioMap(); - result = checkForConflicts(mapToAdd); - if (result != RETURN_OK){ - return result; - } + result = checkForConflicts(mapToAdd); + if (result != RETURN_OK){ + return result; + } - result = configureGpios(&mapToAdd); - if (result != RETURN_OK) { - return RETURN_FAILED; - } + result = configureGpios(&mapToAdd); + if (result != RETURN_OK) { + return RETURN_FAILED; + } - /* Register new GPIOs in gpioMap*/ - gpioMap.insert(mapToAdd.begin(), mapToAdd.end()); + /* Register new GPIOs in gpioMap*/ + gpioMap.insert(mapToAdd.begin(), mapToAdd.end()); - return RETURN_OK; + return RETURN_OK; } ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { @@ -49,7 +49,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { std::string chipname; unsigned int lineNum; struct gpiod_chip *chip; - Gpio::Direction direction; + gpio::Direction direction; std::string consumer; struct gpiod_line *lineHandle; int result; @@ -77,7 +77,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { consumer = mapToAddIter->second.consumer; /* Configure direction and add a description to the GPIO */ switch (direction) { - case Gpio::OUT: + case gpio::OUT: result = gpiod_line_request_output(lineHandle, consumer.c_str(), mapToAddIter->second.initValue); if (result < 0) { @@ -88,7 +88,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { return RETURN_FAILED; } break; - case Gpio::IN: + case gpio::IN: result = gpiod_line_request_input(lineHandle, consumer.c_str()); if (result < 0) { sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " @@ -100,7 +100,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { break; default: sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified" - << std::endl; + << std::endl; return RETURN_FAILED; } /** @@ -113,33 +113,33 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap* mapToAdd) { } ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId){ - return driveGpio(gpioId, 1); + return driveGpio(gpioId, 1); } ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId){ - return driveGpio(gpioId, 0); + return driveGpio(gpioId, 0); } ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, - unsigned int logiclevel) { + unsigned int logiclevel) { int result; - struct gpiod_line *lineHandle; + struct gpiod_line *lineHandle; - gpioMapIter = gpioMap.find(gpioId); + gpioMapIter = gpioMap.find(gpioId); if (gpioMapIter == gpioMap.end()){ sif::debug << "LinuxLibgpioIF::driveGpio: Unknown gpio id " << gpioId << std::endl; return RETURN_FAILED; } lineHandle = gpioMapIter->second.lineHandle; - result = gpiod_line_set_value(lineHandle, logiclevel); - if (result < 0) { - sif::error << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " - << gpioId << " to logic level " << logiclevel << std::endl; - return DRIVE_GPIO_FAILURE; - } + result = gpiod_line_set_value(lineHandle, logiclevel); + if (result < 0) { + sif::error << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " + << gpioId << " to logic level " << logiclevel << std::endl; + return DRIVE_GPIO_FAILURE; + } - return RETURN_OK; + return RETURN_OK; } ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { @@ -158,23 +158,23 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { } ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap mapToAdd){ - gpioId_t gpioId; - GpioMapIter mapToAddIter = mapToAdd.begin(); - for(; mapToAddIter != mapToAdd.end(); mapToAddIter++){ - gpioId = mapToAddIter->first; - gpioMapIter = gpioMap.find(gpioId); - if(gpioMapIter != mapToAdd.end()){ - /* An entry for this GPIO already exists. Check if configuration - * of direction is equivalent */ - if (mapToAddIter->second.direction != gpioMapIter->second.direction){ - sif::error << "LinuxLibgpioIF::checkForConflicts: Detected conflict " - << "for GPIO " << mapToAddIter->first << std::endl; - return RETURN_OK; - } - /* Remove element from map to add because a entry for this GPIO - * already exists */ - mapToAdd.erase(mapToAddIter); - } - } - return RETURN_OK; + gpioId_t gpioId; + GpioMapIter mapToAddIter = mapToAdd.begin(); + for(; mapToAddIter != mapToAdd.end(); mapToAddIter++){ + gpioId = mapToAddIter->first; + gpioMapIter = gpioMap.find(gpioId); + if(gpioMapIter != mapToAdd.end()){ + /* An entry for this GPIO already exists. Check if configuration + * of direction is equivalent */ + if (mapToAddIter->second.direction != gpioMapIter->second.direction){ + sif::error << "LinuxLibgpioIF::checkForConflicts: Detected conflict " + << "for GPIO " << mapToAddIter->first << std::endl; + return RETURN_OK; + } + /* Remove element from map to add because a entry for this GPIO + * already exists */ + mapToAdd.erase(mapToAddIter); + } + } + return RETURN_OK; } diff --git a/bsp_q7s/gpio/LinuxLibgpioIF.h b/linux/gpio/LinuxLibgpioIF.h similarity index 96% rename from bsp_q7s/gpio/LinuxLibgpioIF.h rename to linux/gpio/LinuxLibgpioIF.h index f8cc1a09..f91a35ca 100644 --- a/bsp_q7s/gpio/LinuxLibgpioIF.h +++ b/linux/gpio/LinuxLibgpioIF.h @@ -1,9 +1,9 @@ #ifndef BSP_Q7S_GPIO_LINUXLIBGPIOIF_H_ #define BSP_Q7S_GPIO_LINUXLIBGPIOIF_H_ -#include +#include +#include #include -#include #include /** diff --git a/linux/i2c/CMakeLists.txt b/linux/i2c/CMakeLists.txt new file mode 100644 index 00000000..179abd06 --- /dev/null +++ b/linux/i2c/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + I2cComIF.cpp + I2cCookie.cpp +) + + + + diff --git a/bsp_q7s/comIF/I2cComIF.cpp b/linux/i2c/I2cComIF.cpp similarity index 98% rename from bsp_q7s/comIF/I2cComIF.cpp rename to linux/i2c/I2cComIF.cpp index 8cbd45b3..2f1d710a 100644 --- a/bsp_q7s/comIF/I2cComIF.cpp +++ b/linux/i2c/I2cComIF.cpp @@ -1,5 +1,6 @@ -#include -#include +#include "I2cComIF.h" +#include + #include #include #include diff --git a/bsp_q7s/comIF/I2cComIF.h b/linux/i2c/I2cComIF.h similarity index 97% rename from bsp_q7s/comIF/I2cComIF.h rename to linux/i2c/I2cComIF.h index 7bf339ad..5e75a280 100644 --- a/bsp_q7s/comIF/I2cComIF.h +++ b/linux/i2c/I2cComIF.h @@ -1,9 +1,9 @@ #ifndef BSP_Q7S_COMIF_I2COMIF_H_ #define BSP_Q7S_COMIF_I2COMIF_H_ +#include "I2cCookie.h" #include #include -#include #include #include diff --git a/bsp_q7s/comIF/cookies/I2cCookie.cpp b/linux/i2c/I2cCookie.cpp similarity index 90% rename from bsp_q7s/comIF/cookies/I2cCookie.cpp rename to linux/i2c/I2cCookie.cpp index 1b2ee675..7f86bdc3 100644 --- a/bsp_q7s/comIF/cookies/I2cCookie.cpp +++ b/linux/i2c/I2cCookie.cpp @@ -1,4 +1,4 @@ -#include +#include "I2cCookie.h" I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, std::string deviceFile_) : diff --git a/bsp_q7s/comIF/cookies/I2cCookie.h b/linux/i2c/I2cCookie.h similarity index 100% rename from bsp_q7s/comIF/cookies/I2cCookie.h rename to linux/i2c/I2cCookie.h diff --git a/linux/spi/CMakeLists.txt b/linux/spi/CMakeLists.txt new file mode 100644 index 00000000..45a7edcc --- /dev/null +++ b/linux/spi/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${TARGET_NAME} PUBLIC +) + + + + diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 7d08be5e..c8b1c059 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -219,6 +219,9 @@ + + + @@ -315,6 +318,7 @@ @@ -363,6 +368,9 @@ + + + @@ -459,6 +467,7 @@ @@ -507,6 +517,9 @@ + + + @@ -612,6 +625,7 @@ @@ -787,7 +801,7 @@ - + @@ -795,19 +809,26 @@ - + - + + + + + + + + @@ -816,17 +837,9 @@ - - make - -j16 - clean - true - true - true - make - -j16 + -f Makefile-Hosted -j16 hardclean true true @@ -836,10 +849,28 @@ - + - + + + + + + + + + + + + + + + + + + + diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index 22b33165..4c37c30f 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -11,8 +11,8 @@ #include #include #include +#include #include -#include /** * @brief This class intends the control of heaters. diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 2445620d..fad96f66 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -5,7 +5,7 @@ MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie): DeviceHandlerBase(objectId, deviceCommunication, comCookie), dataset(this) { -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 debugDivider = new PeriodicOperationDivider(10); #endif // Set to default values right away. @@ -247,7 +247,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, float mgmZ = static_cast(mgmMeasurementRawZ) * sensitivityFactor * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->checkAndIncrement()) { sif::info << "MGMHandlerLIS3: Magnetic field strength in" " microtesla:" << std::endl; @@ -271,7 +271,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, case MGMLIS3MDL::READ_TEMPERATURE: { int16_t tempValueRaw = packet[2] << 8 | packet[1]; float tempValue = 25.0 + ((static_cast(tempValueRaw)) / 8.0); -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->check()) { // Set terminal to utf-8 if there is an issue with micro printout. sif::info << "MGMHandlerLIS3: Temperature: " << tempValue<< " °C" diff --git a/mission/devices/MGMHandlerLIS3MDL.h b/mission/devices/MGMHandlerLIS3MDL.h index 4a62ba31..77874e33 100644 --- a/mission/devices/MGMHandlerLIS3MDL.h +++ b/mission/devices/MGMHandlerLIS3MDL.h @@ -157,7 +157,7 @@ private: CommunicationStep communicationStep = CommunicationStep::DATA; bool commandExecuted = false; -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 PeriodicOperationDivider* debugDivider; #endif diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index 62db06a7..76d3dd70 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -9,7 +9,7 @@ MGMHandlerRM3100::MGMHandlerRM3100(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie): DeviceHandlerBase(objectId, deviceCommunication, comCookie), primaryDataset(this) { -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 debugDivider = new PeriodicOperationDivider(10); #endif } @@ -328,7 +328,7 @@ ReturnValue_t MGMHandlerRM3100::handleDataReadout(const uint8_t *packet) { int32_t fieldStrengthZ = (packet[7] << 16 | packet[8] << 8 | packet[9]) * scaleFactorZ; -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 if(debugDivider->checkAndIncrement()) { sif::info << "MGMHandlerLIS3: Magnetic field strength in" " microtesla:" << std::endl; diff --git a/mission/devices/MGMHandlerRM3100.h b/mission/devices/MGMHandlerRM3100.h index 4af6b627..968953bf 100644 --- a/mission/devices/MGMHandlerRM3100.h +++ b/mission/devices/MGMHandlerRM3100.h @@ -6,7 +6,7 @@ #include -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 #include #endif @@ -97,7 +97,7 @@ private: const uint8_t *commandData,size_t commandDataLen); ReturnValue_t handleDataReadout(const uint8_t* packet); -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 PeriodicOperationDivider* debugDivider; #endif }; diff --git a/mission/devices/P60DockHandler.cpp b/mission/devices/P60DockHandler.cpp index 4c504f9a..e34f96c2 100644 --- a/mission/devices/P60DockHandler.cpp +++ b/mission/devices/P60DockHandler.cpp @@ -25,7 +25,7 @@ void P60DockHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t * */ handleDeviceTM(&p60dockHkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && P60DOCK_DEBUG == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && P60DOCK_DEBUG == 1 p60dockHkTableDataset.read(); float temperatureC = p60dockHkTableDataset.temperature1.value * 0.1; diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index d9aa0d8c..540f0637 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -23,7 +23,7 @@ void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac parseHkTableReply(packet); // handleDeviceTM(&pdu1HkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && PDU1_DEBUG == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && PDU1_DEBUG == 1 pdu1HkTableDataset.read(); sif::info << "PDU1 VCC: " << pdu1HkTableDataset.vcc << " mV" << std::endl; float vbat = pdu1HkTableDataset.vbat.value * 0.1; diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 117ae646..b442c12c 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -26,7 +26,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac */ handleDeviceTM(&pdu2HkTableDataset, id, true); -#if OBSW_ENHANCED_PRINTOUT == 1 && PDU2_DEBUG == 1 +#if OBSW_VERBOSE_LEVEL >= 1 && PDU2_DEBUG == 1 pdu2HkTableDataset.read(); sif::info << "PDU2 Q7S current voltage: " << pdu2HkTableDataset.voltageOutQ7S << " mV" << std::endl; sif::info << "PDU2 VCC: " << pdu2HkTableDataset.vcc << " mV" << std::endl; diff --git a/mission/devices/Tmp1075Handler.cpp b/mission/devices/Tmp1075Handler.cpp index e4eb1692..f0d95a18 100644 --- a/mission/devices/Tmp1075Handler.cpp +++ b/mission/devices/Tmp1075Handler.cpp @@ -98,7 +98,7 @@ ReturnValue_t Tmp1075Handler::interpretDeviceReply(DeviceCommandId_t id, int16_t tempValueRaw = 0; tempValueRaw = packet[0] << 4 | packet[1] >> 4; float tempValue = ((static_cast(tempValueRaw)) * 0.0625); -#if OBSW_ENHANCED_PRINTOUT == 1 +#if OBSW_VERBOSE_LEVEL >= 1 sif::info << "Tmp1075 with object id: 0x" << std::hex << getObjectId() << ": Temperature: " << tempValue<< " °C" << std::endl; diff --git a/test/testtasks/CMakeLists.txt b/test/testtasks/CMakeLists.txt index 7c2df391..8d8a17c1 100644 --- a/test/testtasks/CMakeLists.txt +++ b/test/testtasks/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - LibgpiodTest.cpp TestTask.cpp ) diff --git a/test/testtasks/MutextestTask.cpp b/test/testtasks/MutextestTask.cpp deleted file mode 100644 index 325d0029..00000000 --- a/test/testtasks/MutextestTask.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MutextestTask.cpp - * - * Created on: 19.07.2018 - * Author: mohr - */ - -#include - -#include - -MutexIF * MutextestTask::mutex = nullptr; - -MutextestTask::MutextestTask(const char *name, object_id_t setObjectId) : - SystemObject(setObjectId), name(name), locked(false) { - if (mutex == NULL) { - mutex = MutexFactory::instance()->createMutex(); - } -} - -ReturnValue_t MutextestTask::performOperation(uint8_t operationCode) { - if (!locked){ - sif::info << name << ": locking..." << std::endl; - ReturnValue_t result = mutex->lockMutex(MutexIF::BLOCKING); - sif::info << name << ": locked with " << (int) result << std::endl; - if (result == HasReturnvaluesIF::RETURN_OK){ - locked = true; - } - } else { - sif::info << name << ": releasing" << std::endl; - mutex->unlockMutex(); - locked = false; - } - - return HasReturnvaluesIF::RETURN_OK; -} - -MutextestTask::~MutextestTask() { -// TODO Auto-generated destructor stub -} - diff --git a/test/testtasks/MutextestTask.h b/test/testtasks/MutextestTask.h deleted file mode 100644 index 14b81028..00000000 --- a/test/testtasks/MutextestTask.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * MutextestTask.h - * - * Created on: 19.07.2018 - * Author: mohr - */ - -#ifndef MISSION_MUTEXTESTTASK_H_ -#define MISSION_MUTEXTESTTASK_H_ - -#include -#include -#include - -/** - * Start two of them with a little time difference and different periods to see mutex in action - */ - -class MutextestTask: public SystemObject, public ExecutableObjectIF { -public: - - virtual ReturnValue_t performOperation(uint8_t operationCode = 0); - - MutextestTask(const char *name, object_id_t setObjectId); - virtual ~MutextestTask(); -private: - static MutexIF *mutex; - const char * name; - bool locked; -}; - -#endif /* MISSION_MUTEXTESTTASK_H_ */ diff --git a/tmtc b/tmtc index 110ec964..2b85ece0 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 110ec9644a520af9c6f4cb7f2b5d47f3d34ba256 +Subproject commit 2b85ece07195ee905c35b35494bc7a86b94335f5