update depl handler
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-10-13 16:04:34 +02:00
parent 0ebd0a0c0b
commit d97e0a1a6a
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 34 additions and 33 deletions

View File

@ -282,7 +282,8 @@ void SolarArrayDeploymentHandler::finishFsm(ReturnValue_t resultForActionHelper)
stateMachine = StateMachine::IDLE;
if (actionActive) {
bool success = false;
if(resultForActionHelper == returnvalue::OK or resultForActionHelper == HasActionsIF::EXECUTION_FINISHED) {
if (resultForActionHelper == returnvalue::OK or
resultForActionHelper == HasActionsIF::EXECUTION_FINISHED) {
success = true;
}
actionHelper.finish(success, rememberCommanderId, activeCmd, resultForActionHelper);

View File

@ -32,9 +32,7 @@ class ManualDeploymentCommand : public SerialLinkedListAdapter<SerializeIF> {
burnTime.setNext(&channel);
}
uint32_t getBurnTime() const {
return burnTime.entry;
}
uint32_t getBurnTime() const { return burnTime.entry; }
ReturnValue_t getChannel(DeploymentChannels& channel_) const {
if (channel.entry == 1 or channel.entry == 2) {
@ -111,6 +109,26 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
virtual ReturnValue_t initialize() override;
private:
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,
CHANNEL_ON
};
struct FsmInfo {
DeploymentChannels channel;
// false if OFF, true is ON
bool onOff;
bool dryRun;
uint32_t burnCountdown = config::SA_DEPL_MAX_BURN_TIME;
};
static const uint8_t INTERFACE_ID = CLASS_ID::SA_DEPL_HANDLER;
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA0);
static const ReturnValue_t DEPLOYMENT_ALREADY_EXECUTING = MAKE_RETURN_CODE(0xA1);
@ -127,17 +145,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
static const Event DEPL_SA1_GPIO_SWTICH_OFF_FAILED = MAKE_EVENT(5, severity::HIGH);
static const Event DEPL_SA2_GPIO_SWTICH_OFF_FAILED = MAKE_EVENT(6, severity::HIGH);
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,
CHANNEL_ON
};
FsmInfo fsmInfo;
StateMachine stateMachine = IDLE;
bool actionActive = false;
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
@ -148,14 +156,6 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
bool startFsmOn(DeploymentChannels channel, uint32_t burnCountdown);
void startFsmOff();
struct FsmInfo {
DeploymentChannels channel;
// false if OFF, true is ON
bool onOff;
uint32_t burnCountdown = config::SA_DEPL_MAX_BURN_TIME;
} fsmInfo;
void finishFsm(ReturnValue_t resultForActionHelper);
ReturnValue_t performAutonomousDepl(sd::SdCard sdCard);