update depl handler
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -155,10 +155,10 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) {
|
|||||||
deplState == AutonomousDeplState::SECOND_BURN) {
|
deplState == AutonomousDeplState::SECOND_BURN) {
|
||||||
// TODO: Update to be channel specific
|
// TODO: Update to be channel specific
|
||||||
// startFsmOn(channel, config::SA_DEPL_BURN_TIME_SECS);
|
// startFsmOn(channel, config::SA_DEPL_BURN_TIME_SECS);
|
||||||
//startFsm(true, true);
|
// startFsm(true, true);
|
||||||
} else if (deplState == AutonomousDeplState::WAIT or deplState == AutonomousDeplState::DONE) {
|
} else if (deplState == AutonomousDeplState::WAIT or deplState == AutonomousDeplState::DONE) {
|
||||||
startFsmOff();
|
startFsmOff();
|
||||||
//startFsm(false, false);
|
// startFsm(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stateSwitch or updateUptime) {
|
if (stateSwitch or updateUptime) {
|
||||||
@ -215,8 +215,8 @@ void SolarArrayDeploymentHandler::handleStateMachine() {
|
|||||||
burnCountdown.setTimeout(fsmInfo.burnCountdown);
|
burnCountdown.setTimeout(fsmInfo.burnCountdown);
|
||||||
stateMachine = CHANNEL_ON;
|
stateMachine = CHANNEL_ON;
|
||||||
}
|
}
|
||||||
if(stateMachine == CHANNEL_ON) {
|
if (stateMachine == CHANNEL_ON) {
|
||||||
if(burnCountdown.hasTimedOut()) {
|
if (burnCountdown.hasTimedOut()) {
|
||||||
allOff();
|
allOff();
|
||||||
stateMachine = WAIT_MAIN_POWER_OFF;
|
stateMachine = WAIT_MAIN_POWER_OFF;
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ bool SolarArrayDeploymentHandler::startFsmOn(DeploymentChannels channel, uint32_
|
|||||||
if (stateMachine != StateMachine::IDLE) {
|
if (stateMachine != StateMachine::IDLE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(burnCountdown_ > config::SA_DEPL_MAX_BURN_TIME) {
|
if (burnCountdown_ > config::SA_DEPL_MAX_BURN_TIME) {
|
||||||
burnCountdown_ = config::SA_DEPL_MAX_BURN_TIME;
|
burnCountdown_ = config::SA_DEPL_MAX_BURN_TIME;
|
||||||
}
|
}
|
||||||
fsmInfo.onOff = true;
|
fsmInfo.onOff = true;
|
||||||
@ -268,7 +268,7 @@ bool SolarArrayDeploymentHandler::startFsmOn(DeploymentChannels channel, uint32_
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SolarArrayDeploymentHandler::startFsmOff() {
|
void SolarArrayDeploymentHandler::startFsmOff() {
|
||||||
if(stateMachine != StateMachine::IDLE) {
|
if (stateMachine != StateMachine::IDLE) {
|
||||||
// off commands override the state machine. Cancel any active action commands.
|
// off commands override the state machine. Cancel any active action commands.
|
||||||
finishFsm(returnvalue::FAILED);
|
finishFsm(returnvalue::FAILED);
|
||||||
}
|
}
|
||||||
@ -282,7 +282,8 @@ void SolarArrayDeploymentHandler::finishFsm(ReturnValue_t resultForActionHelper)
|
|||||||
stateMachine = StateMachine::IDLE;
|
stateMachine = StateMachine::IDLE;
|
||||||
if (actionActive) {
|
if (actionActive) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if(resultForActionHelper == returnvalue::OK or resultForActionHelper == HasActionsIF::EXECUTION_FINISHED) {
|
if (resultForActionHelper == returnvalue::OK or
|
||||||
|
resultForActionHelper == HasActionsIF::EXECUTION_FINISHED) {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
actionHelper.finish(success, rememberCommanderId, activeCmd, resultForActionHelper);
|
actionHelper.finish(success, rememberCommanderId, activeCmd, resultForActionHelper);
|
||||||
@ -373,16 +374,16 @@ ReturnValue_t SolarArrayDeploymentHandler::executeAction(ActionId_t actionId,
|
|||||||
uint32_t burnCountdown = cmd.getBurnTime();
|
uint32_t burnCountdown = cmd.getBurnTime();
|
||||||
DeploymentChannels channel;
|
DeploymentChannels channel;
|
||||||
result = cmd.getChannel(channel);
|
result = cmd.getChannel(channel);
|
||||||
if(result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (not startFsmOn(channel, burnCountdown)) {
|
if (not startFsmOn(channel, burnCountdown)) {
|
||||||
return HasActionsIF::IS_BUSY;
|
return HasActionsIF::IS_BUSY;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} else if(actionId == SWITCH_OFF_DEPLOYMENT) {
|
} else if (actionId == SWITCH_OFF_DEPLOYMENT) {
|
||||||
startFsmOff();
|
startFsmOff();
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
return HasActionsIF::INVALID_ACTION_ID;
|
return HasActionsIF::INVALID_ACTION_ID;
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,7 @@ class ManualDeploymentCommand : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
burnTime.setNext(&channel);
|
burnTime.setNext(&channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getBurnTime() const {
|
uint32_t getBurnTime() const { return burnTime.entry; }
|
||||||
return burnTime.entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t getChannel(DeploymentChannels& channel_) const {
|
ReturnValue_t getChannel(DeploymentChannels& channel_) const {
|
||||||
if (channel.entry == 1 or channel.entry == 2) {
|
if (channel.entry == 1 or channel.entry == 2) {
|
||||||
@ -111,6 +109,26 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
|
|
||||||
private:
|
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 uint8_t INTERFACE_ID = CLASS_ID::SA_DEPL_HANDLER;
|
||||||
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA0);
|
static const ReturnValue_t COMMAND_NOT_SUPPORTED = MAKE_RETURN_CODE(0xA0);
|
||||||
static const ReturnValue_t DEPLOYMENT_ALREADY_EXECUTING = MAKE_RETURN_CODE(0xA1);
|
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_SA1_GPIO_SWTICH_OFF_FAILED = MAKE_EVENT(5, severity::HIGH);
|
||||||
static const Event DEPL_SA2_GPIO_SWTICH_OFF_FAILED = MAKE_EVENT(6, 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 };
|
FsmInfo fsmInfo;
|
||||||
enum StateMachine {
|
|
||||||
IDLE,
|
|
||||||
MAIN_POWER_ON,
|
|
||||||
MAIN_POWER_OFF,
|
|
||||||
WAIT_MAIN_POWER_ON,
|
|
||||||
WAIT_MAIN_POWER_OFF,
|
|
||||||
SWITCH_DEPL_GPIOS,
|
|
||||||
CHANNEL_ON
|
|
||||||
};
|
|
||||||
|
|
||||||
StateMachine stateMachine = IDLE;
|
StateMachine stateMachine = IDLE;
|
||||||
bool actionActive = false;
|
bool actionActive = false;
|
||||||
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
|
ActionId_t activeCmd = HasActionsIF::INVALID_ACTION_ID;
|
||||||
@ -148,14 +156,6 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
bool startFsmOn(DeploymentChannels channel, uint32_t burnCountdown);
|
bool startFsmOn(DeploymentChannels channel, uint32_t burnCountdown);
|
||||||
void startFsmOff();
|
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);
|
void finishFsm(ReturnValue_t resultForActionHelper);
|
||||||
|
|
||||||
ReturnValue_t performAutonomousDepl(sd::SdCard sdCard);
|
ReturnValue_t performAutonomousDepl(sd::SdCard sdCard);
|
||||||
|
Reference in New Issue
Block a user