continue SA DEPL handler
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
@ -3,8 +3,8 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "eive/definitions.h"
|
||||
#include "devices/powerSwitcherList.h"
|
||||
#include "eive/definitions.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
#include "fsfw/action/HasActionsIF.h"
|
||||
#include "fsfw/devicehandlers/CookieIF.h"
|
||||
@ -34,11 +34,13 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
||||
static constexpr DeviceCommandId_t FORCE_DEPLY_OFF = 0x07;
|
||||
|
||||
static constexpr uint32_t FIRST_BURN_START_TIME = config::SA_DEPL_BURN_TIME_SECS;
|
||||
static constexpr uint32_t FIRST_BURN_END_TIME = FIRST_BURN_START_TIME + config::SA_DEPL_BURN_TIME_SECS;
|
||||
static constexpr uint32_t FIRST_WAIT_START_TIME = FIRST_BURN_END_TIME;
|
||||
static constexpr uint32_t FIRST_WAIT_END_TIME = FIRST_BURN_END_TIME + config::SA_DEPL_WAIT_TIME_SECS;
|
||||
static constexpr uint32_t SECOND_BURN_START_TIME = FIRST_WAIT_END_TIME;
|
||||
static constexpr uint32_t SECOND_BURN_END_TIME = SECOND_BURN_START_TIME + config::SA_DEPL_WAIT_TIME_SECS;
|
||||
static constexpr uint32_t FIRST_BURN_END_TIME =
|
||||
FIRST_BURN_START_TIME + config::SA_DEPL_BURN_TIME_SECS;
|
||||
static constexpr uint32_t WAIT_START_TIME = FIRST_BURN_END_TIME;
|
||||
static constexpr uint32_t WAIT_END_TIME = WAIT_START_TIME + config::SA_DEPL_WAIT_TIME_SECS;
|
||||
static constexpr uint32_t SECOND_BURN_START_TIME = WAIT_END_TIME;
|
||||
static constexpr uint32_t SECOND_BURN_END_TIME =
|
||||
SECOND_BURN_START_TIME + config::SA_DEPL_WAIT_TIME_SECS;
|
||||
|
||||
static constexpr char SD_0_DEPL_FILE[] = "/mnt/sd0/conf/deployment";
|
||||
static constexpr char SD_1_DEPL_FILE[] = "/mnt/sd1/conf/deployment";
|
||||
@ -93,26 +95,32 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
||||
static const Event DEPL_SA1_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(3, severity::HIGH);
|
||||
static const Event DEPL_SA2_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(4, severity::HIGH);
|
||||
|
||||
enum AutonomousDeplState {
|
||||
INIT,
|
||||
FIRST_BURN,
|
||||
WAIT,
|
||||
SECOND_BURN,
|
||||
DONE
|
||||
enum AutonomousDeplState { INIT, FIRST_BURN, WAIT, SECOND_BURN, DONE };
|
||||
enum StateMachine {
|
||||
IDLE,
|
||||
MAIN_POWER_ON,
|
||||
MAIN_POWER_OFF,
|
||||
WAIT_MAIN_POWER_ON,
|
||||
WAIT_MAIN_POWER_OFF,
|
||||
SWITCH_DEPL_GPIOS,
|
||||
};
|
||||
// enum StateMachine {
|
||||
// WAIT_ON_DELOYMENT_COMMAND,
|
||||
// SWITCH_8V_ON,
|
||||
// WAIT_ON_8V_SWITCH,
|
||||
// SWITCH_DEPL_GPIOS,
|
||||
// WAIT_ON_DEPLOYMENT_FINISH,
|
||||
// WAIT_FOR_MAIN_SWITCH_OFF
|
||||
// };
|
||||
//
|
||||
// StateMachine stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||
|
||||
StateMachine stateMachine = IDLE;
|
||||
bool actionActive = false;
|
||||
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
|
||||
std::optional<uint64_t> initUptime;
|
||||
uint8_t retryCounter = 3;
|
||||
struct FsmInfo {
|
||||
// false if OFF, true is ON
|
||||
bool sa1OnOff = false;
|
||||
bool sa2OnOff = false;
|
||||
} fsmInfo;
|
||||
|
||||
bool startFsm(std::optional<bool> sa1OnOff, std::optional<bool> sa2OnOff);
|
||||
void finishFsm(ReturnValue_t resultForActionHelper);
|
||||
|
||||
ReturnValue_t performAutonomousDepl(sd::SdCard sdCard);
|
||||
|
||||
bool autonomousDeplForFile(const char* filename);
|
||||
/**
|
||||
* This countdown is used to check if the PCDU sets the 8V line on in the intended time.
|
||||
*/
|
||||
@ -121,7 +129,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
||||
/**
|
||||
* This countdown is used to wait for the burn wire being successful cut.
|
||||
*/
|
||||
// Countdown deploymentCountdown;
|
||||
Countdown deploymentCountdown;
|
||||
|
||||
/**
|
||||
* The message queue id of the component commanding an action will be stored in this variable.
|
||||
@ -161,18 +169,15 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
||||
* @brief This function polls the 8V switch state and changes the state machine when the
|
||||
* switch has been enabled.
|
||||
*/
|
||||
void performWaitOn8VActions();
|
||||
bool checkMainPowerOn();
|
||||
bool checkMainPowerOff();
|
||||
bool checkMainPower(bool onOff);
|
||||
|
||||
/**
|
||||
* @brief This functions handles the switching of the solar array deployment transistors.
|
||||
*/
|
||||
void deploymentTransistorsOn();
|
||||
|
||||
/**
|
||||
* @brief This function performs actions to finish the deployment. Essentially switches
|
||||
* are turned of after the burn time has expired.
|
||||
*/
|
||||
// void handleDeploymentFinish();
|
||||
ReturnValue_t deploymentTransistorsOn();
|
||||
ReturnValue_t deploymentTransistorsOff();
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ */
|
||||
|
Reference in New Issue
Block a user