From 46e2e40cb175ba3b4537e2a231806d004d4816b0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jul 2021 17:06:10 +0200 Subject: [PATCH 1/7] various bugfixes --- bsp_q7s/core/CoreController.cpp | 27 +++++++++++++++++++++------ bsp_q7s/memory/SdCardManager.cpp | 5 +++++ linux/utility/utility.cpp | 4 +++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 2f48fe2d..55cd0252 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -6,6 +6,8 @@ #include "../memory/scratchApi.h" #include "../memory/SdCardManager.h" +#include + CoreController::CoreController(object_id_t objectId): ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) { } @@ -27,10 +29,18 @@ LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) { } ReturnValue_t CoreController::initialize() { - ReturnValue_t result = sdCardInit(); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "CoreController::initialize: SD card init failed" << std::endl; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + try { + result = sdCardInit(); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "CoreController::initialize: SD card init failed" << std::endl; + } } + catch(const std::filesystem::filesystem_error& e) { + sif::error << "CoreController::initialize: sdCardInit failed with exception " << e.what() + << std::endl; + } + result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0); if(result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "CoreController::initialize: Setting up alloc failure " @@ -103,9 +113,14 @@ ReturnValue_t CoreController::sdCardSetup(SdCardManager& sdcMan, return sdcMan.mountSdCard(sdCard); } else { - sif::info << "SD card " << sdString << " already on and mounted at " << - mountString << std::endl; - return SdCardManager::ALREADY_MOUNTED; + if(std::filesystem::exists(mountString)) { + sif::info << "SD card " << sdString << " already on and mounted at " << + mountString << std::endl; + return SdCardManager::ALREADY_MOUNTED; + } + sif::error << "SD card mounted but expected mount point " << mountString << " not found!" + << std::endl; + return SdCardManager::MOUNT_ERROR; } } diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index d24f540d..3dfa0b10 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -218,6 +218,11 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) { else if(sdCard == sd::SdCard::SLOT_1) { mountPoint = SD_1_MOUNT_POINT; } + if(not filesystem::exists(mountPoint)) { + sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint << + "does not exist" << std::endl; + return UNMOUNT_ERROR; + } if(filesystem::is_empty(mountPoint)) { // The mount point will always exist, but if it is empty, that is strong hint that // the SD card was not mounted properly. Still proceed with operation. diff --git a/linux/utility/utility.cpp b/linux/utility/utility.cpp index 69a3d08f..1d6ec5c0 100644 --- a/linux/utility/utility.cpp +++ b/linux/utility/utility.cpp @@ -3,9 +3,11 @@ #include "utility.h" #include "fsfw/serviceinterface/ServiceInterface.h" +#include void utility::handleSystemError(int retcode, std::string function) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::warning << function << ": System call failed with code " << retcode; + sif::warning << function << ": System call failed with code " << retcode << ": " << + strerror(retcode) << std::endl; #endif } -- 2.43.0 From cb006c84d3e21c76848579d7688058f68921afce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 24 Jul 2021 13:36:45 +0200 Subject: [PATCH 2/7] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index a7a4e0f2..b8325959 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit a7a4e0f219eb3f23e644f519605a79772a3c951a +Subproject commit b83259592a1f0ae5af20b00d1aef813fa26cd350 -- 2.43.0 From 9caa9451e1df7b52d5ad58e776c8c8b03b472fb5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 24 Jul 2021 13:47:09 +0200 Subject: [PATCH 3/7] printing FSFW version now --- bsp_q7s/core/obsw.cpp | 8 ++++++-- fsfw | 2 +- misc/eclipse/.cproject | 8 ++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bsp_q7s/core/obsw.cpp b/bsp_q7s/core/obsw.cpp index 2b55429b..41c6c5b9 100644 --- a/bsp_q7s/core/obsw.cpp +++ b/bsp_q7s/core/obsw.cpp @@ -2,6 +2,9 @@ #include "OBSWVersion.h" #include "InitMission.h" #include "fsfw/tasks/TaskFactory.h" + +#include "fsfw/FSFWVersion.h" + #include int obsw::obsw() { @@ -11,8 +14,9 @@ int obsw::obsw() { #else std::cout << "-- Compiled for Linux (TE0720) --" << std::endl; #endif - std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "." - << SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl; + std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << + "." << SW_SUBSUBVERSION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << + FSFW_REVISION << "--" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; initmission::initMission(); diff --git a/fsfw b/fsfw index b8325959..3e422f51 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit b83259592a1f0ae5af20b00d1aef813fa26cd350 +Subproject commit 3e422f51bd1b5f934a138f5e496675b398e27827 diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 155e08b2..84814acc 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -566,7 +566,7 @@ - + @@ -658,7 +658,7 @@ - +