From 51dbc957504a7fd626f914d8a6b242f60be181a6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 8 Aug 2021 12:39:53 +0200 Subject: [PATCH 1/2] fixes for NO_INIT code --- bsp_q7s/core/CoreController.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index b484c4cb..5f6c1ecc 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -146,8 +146,9 @@ ReturnValue_t CoreController::sdStateMachine() { if(sdInfo.state == SdStates::START) { #if Q7S_SD_CARD_CONFIG == Q7S_SD_NONE sif::info << "No SD card initialization will be performed" << std::endl; - sdInfo.state == SdStates::IDLE; + sdInfo.state = SdStates::IDLE; sdInfo.initFinished = true; + return result; #else sdInfo.cycleCount = 0; sdInfo.commandExecuted = false; From 365fa0adc415970e56203603fa6259a139da0321 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 8 Aug 2021 12:43:02 +0200 Subject: [PATCH 2/2] tweaks and fixes for state machine --- bsp_q7s/core/CoreController.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 5f6c1ecc..f92e6d60 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -38,10 +38,11 @@ CoreController::CoreController(object_id_t objectId): if(sdcMan == nullptr) { sif::error << "CoreController::CoreController: SD card manager invalid!" << std::endl; } + if(not BLOCKING_SD_INIT) { - sdStateMachine(); sdcMan->setBlocking(false); } + sdStateMachine(); result = initBootCopy(); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -59,7 +60,7 @@ ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) { } void CoreController::performControlOperation() { - if(not BLOCKING_SD_INIT and not sdInfo.initFinished) { + if(not BLOCKING_SD_INIT) { sdStateMachine(); } performWatchdogControlOperation(); @@ -83,9 +84,8 @@ ReturnValue_t CoreController::initialize() { "count failed" << std::endl; } - if(not BLOCKING_SD_INIT) { - sdStateMachine(); - } + sdStateMachine(); + return ExtendedControllerBase::initialize(); } @@ -150,6 +150,13 @@ ReturnValue_t CoreController::sdStateMachine() { sdInfo.initFinished = true; return result; #else + // Init will be performed by separate function + if(not BLOCKING_SD_INIT) { + sdInfo.state = SdStates::IDLE; + sdInfo.initFinished = true; + return result; + } +#endif sdInfo.cycleCount = 0; sdInfo.commandExecuted = false; sdInfo.state = SdStates::GET_INFO;