From a6504e941dad13d325dda310f890bab45d28f616 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 5 Mar 2021 19:31:45 +0100 Subject: [PATCH] adaptions for fsfw api changes --- bsp_q7s/devices/HeaterHandler.cpp | 28 ++++++++++++++----- .../devices/SolarArrayDeploymentHandler.cpp | 8 +++--- fsfw | 2 +- mission/devices/GyroL3GD20Handler.cpp | 4 +-- mission/devices/MGMHandlerLIS3MDL.cpp | 4 +-- mission/devices/PCDUHandler.cpp | 4 +-- 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/bsp_q7s/devices/HeaterHandler.cpp b/bsp_q7s/devices/HeaterHandler.cpp index ccf5b65c..9a44c57b 100644 --- a/bsp_q7s/devices/HeaterHandler.cpp +++ b/bsp_q7s/devices/HeaterHandler.cpp @@ -201,8 +201,8 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) { heaterMapIter->second.active = false; heaterMapIter->second.waitMainSwitchOn = false; if (heaterMapIter->second.replyQueue != commandQueue->getId()) { - actionHelper.finish(heaterMapIter->second.replyQueue, heaterMapIter->second.action, - MAIN_SWITCH_SET_TIMEOUT ); + actionHelper.finish(false, heaterMapIter->second.replyQueue, + heaterMapIter->second.action, MAIN_SWITCH_SET_TIMEOUT ); } return; } @@ -229,8 +229,15 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) { /* There is no need to send action finish replies if the sender was the * HeaterHandler itself. */ if (heaterMapIter->second.replyQueue != commandQueue->getId()) { - actionHelper.finish(heaterMapIter->second.replyQueue, - heaterMapIter->second.action, result); + if(result == RETURN_OK) { + actionHelper.finish(true, heaterMapIter->second.replyQueue, + heaterMapIter->second.action, result); + } + else { + actionHelper.finish(false, heaterMapIter->second.replyQueue, + heaterMapIter->second.action, result); + } + } heaterMapIter->second.active = false; heaterMapIter->second.waitMainSwitchOn = false; @@ -250,7 +257,7 @@ void HeaterHandler::handleSwitchOnCommand(HeaterMapIter heaterMapIter) { sif::debug << "HeaterHandler::handleActiveCommands: Failed to get state of" << " main line switch" << std::endl; if (heaterMapIter->second.replyQueue != commandQueue->getId()) { - actionHelper.finish(heaterMapIter->second.replyQueue, + actionHelper.finish(false, heaterMapIter->second.replyQueue, heaterMapIter->second.action, mainSwitchState); } heaterMapIter->second.active = false; @@ -282,8 +289,15 @@ void HeaterHandler::handleSwitchOffCommand(HeaterMapIter heaterMapIter) { triggerEvent(SWITCH_ALREADY_OFF, switchNr); } if (heaterMapIter->second.replyQueue != NO_COMMANDER) { - actionHelper.finish(heaterMapIter->second.replyQueue, - heaterMapIter->second.action, result); + /* Report back switch command reply if necessary */ + if(result == HasReturnvaluesIF::RETURN_OK) { + actionHelper.finish(true, heaterMapIter->second.replyQueue, + heaterMapIter->second.action, result); + } + else { + actionHelper.finish(false, heaterMapIter->second.replyQueue, + heaterMapIter->second.action, result); + } } heaterMapIter->second.active = false; } diff --git a/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp b/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp index 80d941bf..d307ef15 100644 --- a/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp +++ b/bsp_q7s/devices/SolarArrayDeploymentHandler.cpp @@ -108,7 +108,7 @@ void SolarArrayDeploymentHandler::performWaitOn8VActions() { } else { if (mainSwitchCountdown.hasTimedOut()) { triggerEvent(MAIN_SWITCH_ON_TIMEOUT); - actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, + actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, MAIN_SWITCH_TIMEOUT_FAILURE); stateMachine = WAIT_ON_DELOYMENT_COMMAND; } @@ -125,7 +125,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() { * the deployment sequence. */ stateMachine = WAIT_ON_DELOYMENT_COMMAND; triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED); - actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, + actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); } @@ -135,7 +135,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() { " array deployment switch 2 high " << std::endl; stateMachine = WAIT_ON_DELOYMENT_COMMAND; triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED); - actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, + actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); } @@ -146,7 +146,7 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() { void SolarArrayDeploymentHandler::handleDeploymentFinish() { ReturnValue_t result = RETURN_OK; if (deploymentCountdown.hasTimedOut()) { - actionHelper.finish(rememberCommanderId, DEPLOY_SOLAR_ARRAYS, RETURN_OK); + actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, RETURN_OK); result = gpioInterface->pullLow(deplSA1); if (result != RETURN_OK) { sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" diff --git a/fsfw b/fsfw index 91f69aa3..18e40d62 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 91f69aa34fcdde9d3f6ae1a71e72a084bf3bc49d +Subproject commit 18e40d62481e6c2547eb108114f1f124a25ccb9b diff --git a/mission/devices/GyroL3GD20Handler.cpp b/mission/devices/GyroL3GD20Handler.cpp index 28cbdbed..997ec129 100644 --- a/mission/devices/GyroL3GD20Handler.cpp +++ b/mission/devices/GyroL3GD20Handler.cpp @@ -1,5 +1,5 @@ #include -#include +#include GyroHandler::GyroHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie): @@ -172,7 +172,7 @@ ReturnValue_t GyroHandler::interpretDeviceReply(DeviceCommandId_t id, int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; float temperature = 25.0 + temperaturOffset; - PoolReadHelper readSet(&dataset); + PoolReadGuard readSet(&dataset); if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { dataset.angVelocX = angVelocX; dataset.angVelocY = angVelocY; diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 6eb7f5d4..d2573f73 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -1,6 +1,6 @@ -#include #include "MGMHandlerLIS3MDL.h" +#include MGMHandlerLIS3MDL::MGMHandlerLIS3MDL(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie): @@ -299,7 +299,7 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, #endif } #endif - PoolReadHelper readHelper(&dataset); + PoolReadGuard readHelper(&dataset); if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { dataset.fieldStrengthX = mgmX; dataset.fieldStrengthY = mgmY; diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index 8e2c1a39..5812c8bf 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -49,7 +49,7 @@ ReturnValue_t PCDUHandler::initialize() { sif::error << "PCDUHandler::initialize: Invalid pdu2Handler" << std::endl; return RETURN_FAILED; } - result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessages( + result = pdu2Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( PDU2::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); if (result != RETURN_OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from " @@ -63,7 +63,7 @@ ReturnValue_t PCDUHandler::initialize() { sif::error << "PCDUHandler::initialize: Invalid pdu1Handler" << std::endl; return RETURN_FAILED; } - result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessages( + result = pdu1Handler->getSubscriptionInterface()->subscribeForSetUpdateMessage( PDU1::HK_TABLE_DATA_SET_ID, this->getObjectId(), commandQueue->getId(), true); if (result != RETURN_OK) { sif::error << "PCDUHandler::initialize: Failed to subscribe for set update messages from "