v1.15.0 #311

Merged
muellerr merged 107 commits from develop into main 2022-10-27 11:28:49 +02:00
2 changed files with 42 additions and 15 deletions
Showing only changes of commit 6a900693f3 - Show all commits

View File

@ -1,9 +1,11 @@
#include "SolarArrayDeploymentHandler.h" #include "SolarArrayDeploymentHandler.h"
#include <devices/gpioIds.h> #include "devices/gpioIds.h"
#include <fsfw/ipc/QueueFactory.h> #include "fsfw/ipc/QueueFactory.h"
#include <fsfw/objectmanager/ObjectManager.h> #include "fsfw/objectmanager/ObjectManager.h"
#include <fsfw_hal/common/gpio/GpioCookie.h> #include "fsfw_hal/common/gpio/GpioCookie.h"
#include <filesystem>
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_, SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_,
GpioIF& gpioInterface, GpioIF& gpioInterface,
@ -17,16 +19,36 @@ SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId
deplSA2(deplSA2), deplSA2(deplSA2),
mainLineSwitcher(mainLineSwitcher_), mainLineSwitcher(mainLineSwitcher_),
mainLineSwitch(mainLineSwitch_), mainLineSwitch(mainLineSwitch_),
sdcMan(sdcMountedIF),
actionHelper(this, nullptr) { actionHelper(this, nullptr) {
auto mqArgs = MqArgs(setObjectId_, static_cast<void*>(this)); auto mqArgs = MqArgs(setObjectId_, static_cast<void*>(this));
commandQueue = QueueFactory::instance()->createMessageQueue( commandQueue = QueueFactory::instance()->createMessageQueue(
cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); cmdQueueSize, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs);
} }
SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() {} SolarArrayDeploymentHandler::~SolarArrayDeploymentHandler() = default;
ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) { ReturnValue_t SolarArrayDeploymentHandler::performOperation(uint8_t operationCode) {
using namespace std::filesystem;
handleStateMachine(); handleStateMachine();
auto activeSdc = sdcMan.getActiveSdCard();
if (activeSdc and activeSdc.value() == sd::SdCard::SLOT_0 and
sdcMan.isSdCardUsable(activeSdc.value())) {
if (exists(SD_0_DEPL_FILE)) {
// perform autonomous deployment handling
performAutonomousDepl(sd::SdCard::SLOT_0);
}
} else if (activeSdc and activeSdc.value() == sd::SdCard::SLOT_1 and
sdcMan.isSdCardUsable(activeSdc.value())) {
if (exists(SD_1_DEPL_FILE)) {
// perform autonomous deployment handling
performAutonomousDepl(sd::SdCard::SLOT_1);
}
}
return returnvalue::OK;
}
ReturnValue_t SolarArrayDeploymentHandler::performAutonomousDepl(sd::SdCard sdCard) {
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -1,7 +1,10 @@
#ifndef MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ #ifndef MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_
#define MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ #define MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_
#include <unordered_map>
#include "devices/powerSwitcherList.h" #include "devices/powerSwitcherList.h"
#include "events/subsystemIdRanges.h"
#include "fsfw/action/HasActionsIF.h" #include "fsfw/action/HasActionsIF.h"
#include "fsfw/devicehandlers/CookieIF.h" #include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/devicehandlers/DeviceHandlerIF.h" #include "fsfw/devicehandlers/DeviceHandlerIF.h"
@ -12,10 +15,6 @@
#include "fsfw/timemanager/Countdown.h" #include "fsfw/timemanager/Countdown.h"
#include "fsfw_hal/common/gpio/GpioIF.h" #include "fsfw_hal/common/gpio/GpioIF.h"
#include "mission/memory/SdCardMountedIF.h" #include "mission/memory/SdCardMountedIF.h"
#include <unordered_map>
#include "events/subsystemIdRanges.h"
#include "returnvalues/classIds.h" #include "returnvalues/classIds.h"
/** /**
@ -28,7 +27,10 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
public HasActionsIF { public HasActionsIF {
public: public:
static constexpr DeviceCommandId_t DEPLOY_SOLAR_ARRAYS_MANUALLY = 0x5; static constexpr DeviceCommandId_t DEPLOY_SOLAR_ARRAYS_MANUALLY = 0x5;
static const char SD_0_DEPL_FILE[] = "/mnt/sd0/conf/deployment";
static const char SD_1_DEPL_FILE[] = "/mnt/sd1/conf/deployment";
static const char SD_0_DEPLY_INFO[] = "/mnt/sd0/conf/deployment_info.txt";
static const char SD_1_DEPLY_INFO[] = "/mnt/sd1/conf/deployment_info.txt";
/** /**
* @brief constructor * @brief constructor
* *
@ -46,8 +48,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
*/ */
SolarArrayDeploymentHandler(object_id_t setObjectId, GpioIF& gpio, SolarArrayDeploymentHandler(object_id_t setObjectId, GpioIF& gpio,
PowerSwitchIF& mainLineSwitcher, pcdu::Switches mainLineSwitch, PowerSwitchIF& mainLineSwitcher, pcdu::Switches mainLineSwitch,
gpioId_t deplSA1, gpioId_t deplSA2, gpioId_t deplSA1, gpioId_t deplSA2, SdCardMountedIF& sdcMountedIF);
SdCardMountedIF& sdcMountedIF);
virtual ~SolarArrayDeploymentHandler(); virtual ~SolarArrayDeploymentHandler();
@ -84,6 +85,8 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
// //
// StateMachine stateMachine = WAIT_ON_DELOYMENT_COMMAND; // StateMachine stateMachine = WAIT_ON_DELOYMENT_COMMAND;
ReturnValue_t performAutonomousDepl(sd::SdCard sdCard);
/** /**
* This countdown is used to check if the PCDU sets the 8V line on in the intended time. * This countdown is used to check if the PCDU sets the 8V line on in the intended time.
*/ */
@ -106,9 +109,6 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
gpioId_t deplSA1; gpioId_t deplSA1;
gpioId_t deplSA2; gpioId_t deplSA2;
/** Queue to receive messages from other objects. */
MessageQueueIF* commandQueue = nullptr;
/** /**
* After initialization this pointer will hold the reference to the main line switcher object. * After initialization this pointer will hold the reference to the main line switcher object.
*/ */
@ -117,8 +117,13 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
/** Switch number of the 8V power switch */ /** Switch number of the 8V power switch */
uint8_t mainLineSwitch; uint8_t mainLineSwitch;
SdCardMountedIF& sdcMan;
ActionHelper actionHelper; ActionHelper actionHelper;
/** Queue to receive messages from other objects. */
MessageQueueIF* commandQueue = nullptr;
void readCommandQueue(); void readCommandQueue();
/** /**