continue SA DEPL impl
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
@ -142,7 +142,7 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) {
|
||||
lineNum++;
|
||||
}
|
||||
bool updateUptime = false;
|
||||
if(opDivider.checkAndIncrement()) {
|
||||
if (opDivider.checkAndIncrement()) {
|
||||
if (initUptime) {
|
||||
secsSinceBoot = initUptime.value();
|
||||
}
|
||||
@ -158,21 +158,21 @@ bool SolarArrayDeploymentHandler::autonomousDeplForFile(const char* filename) {
|
||||
startFsm(false, false);
|
||||
}
|
||||
}
|
||||
if(stateSwitch or updateUptime) {
|
||||
std::ofstream of(filename);
|
||||
of << "phase: " ;
|
||||
if(deplState == AutonomousDeplState::INIT) {
|
||||
of << PHASE_INIT_STR << "\n";
|
||||
} else if(deplState == AutonomousDeplState::FIRST_BURN) {
|
||||
of << PHASE_FIRST_BURN_STR << "\n";
|
||||
} else if(deplState == AutonomousDeplState::WAIT) {
|
||||
of << PHASE_WAIT_STR << "\n";
|
||||
} else if(deplState == AutonomousDeplState::SECOND_BURN) {
|
||||
of << PHASE_SECOND_BURN_STR << "\n";
|
||||
} else if(deplState == AutonomousDeplState::DONE) {
|
||||
of << PHASE_DONE<< "\n";
|
||||
}
|
||||
of << "secs_since_start: " << std::to_string(secsSinceBoot) << "\n";
|
||||
if (stateSwitch or updateUptime) {
|
||||
std::ofstream of(filename);
|
||||
of << "phase: ";
|
||||
if (deplState == AutonomousDeplState::INIT) {
|
||||
of << PHASE_INIT_STR << "\n";
|
||||
} else if (deplState == AutonomousDeplState::FIRST_BURN) {
|
||||
of << PHASE_FIRST_BURN_STR << "\n";
|
||||
} else if (deplState == AutonomousDeplState::WAIT) {
|
||||
of << PHASE_WAIT_STR << "\n";
|
||||
} else if (deplState == AutonomousDeplState::SECOND_BURN) {
|
||||
of << PHASE_SECOND_BURN_STR << "\n";
|
||||
} else if (deplState == AutonomousDeplState::DONE) {
|
||||
of << PHASE_DONE << "\n";
|
||||
}
|
||||
of << "secs_since_start: " << std::to_string(secsSinceBoot) << "\n";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -192,8 +192,9 @@ void SolarArrayDeploymentHandler::handleStateMachine() {
|
||||
stateMachine = WAIT_MAIN_POWER_ON;
|
||||
}
|
||||
if (stateMachine == MAIN_POWER_OFF) {
|
||||
// This should never fail
|
||||
deploymentTransistorsOff();
|
||||
// These should never fail
|
||||
deploymentTransistorsOff(DeploymentChannels::SA_1);
|
||||
deploymentTransistorsOff(DeploymentChannels::SA_2);
|
||||
mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
|
||||
mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs());
|
||||
stateMachine = WAIT_MAIN_POWER_OFF;
|
||||
@ -210,7 +211,7 @@ void SolarArrayDeploymentHandler::handleStateMachine() {
|
||||
}
|
||||
if (stateMachine == SWITCH_DEPL_GPIOS) {
|
||||
// This should never fail
|
||||
deploymentTransistorsOn();
|
||||
// deploymentTransistorsOn();
|
||||
finishFsm(returnvalue::OK);
|
||||
}
|
||||
}
|
||||
@ -262,42 +263,50 @@ void SolarArrayDeploymentHandler::finishFsm(ReturnValue_t resultForActionHelper)
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t SolarArrayDeploymentHandler::deploymentTransistorsOn() {
|
||||
ReturnValue_t result = gpioInterface.pullHigh(deplSA1);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 1 high "
|
||||
<< std::endl;
|
||||
// If gpio switch high failed, state machine is reset to wait for a command re-initiating
|
||||
// the deployment sequence.
|
||||
triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
|
||||
}
|
||||
result = gpioInterface.pullHigh(deplSA2);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 2 high "
|
||||
<< std::endl;
|
||||
triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
|
||||
ReturnValue_t SolarArrayDeploymentHandler::deploymentTransistorsOn(DeploymentChannels channel) {
|
||||
ReturnValue_t result = returnvalue::FAILED;
|
||||
if (channel == DeploymentChannels::SA_1) {
|
||||
result = gpioInterface.pullHigh(deplSA1);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 1 high "
|
||||
<< std::endl;
|
||||
// If gpio switch high failed, state machine is reset to wait for a command re-initiating
|
||||
// the deployment sequence.
|
||||
triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
|
||||
}
|
||||
} else if (channel == DeploymentChannels::SA_2) {
|
||||
result = gpioInterface.pullHigh(deplSA2);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 2 high "
|
||||
<< std::endl;
|
||||
triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t SolarArrayDeploymentHandler::deploymentTransistorsOff() {
|
||||
ReturnValue_t result = gpioInterface.pullLow(deplSA1);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 1 low"
|
||||
<< std::endl;
|
||||
// If gpio switch high failed, state machine is reset to wait for a command re-initiating
|
||||
// the deployment sequence.
|
||||
triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
|
||||
}
|
||||
result = gpioInterface.pullLow(deplSA2);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 2 low"
|
||||
<< std::endl;
|
||||
triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
|
||||
ReturnValue_t SolarArrayDeploymentHandler::deploymentTransistorsOff(DeploymentChannels channel) {
|
||||
ReturnValue_t result = returnvalue::FAILED;
|
||||
if (channel == DeploymentChannels::SA_1) {
|
||||
result = gpioInterface.pullLow(deplSA1);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 1 high "
|
||||
<< std::endl;
|
||||
// If gpio switch high failed, state machine is reset to wait for a command re-initiating
|
||||
// the deployment sequence.
|
||||
triggerEvent(DEPL_SA1_GPIO_SWTICH_OFF_FAILED);
|
||||
}
|
||||
} else if (channel == DeploymentChannels::SA_2) {
|
||||
result = gpioInterface.pullLow(deplSA2);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||
" array deployment switch 2 high "
|
||||
<< std::endl;
|
||||
triggerEvent(DEPL_SA2_GPIO_SWTICH_OFF_FAILED);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -318,13 +327,18 @@ void SolarArrayDeploymentHandler::readCommandQueue() {
|
||||
ReturnValue_t SolarArrayDeploymentHandler::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size) {
|
||||
// TODO: Finish command handling
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
if (actionId == FORCE_DEPLY_ON) {
|
||||
}
|
||||
if (actionId == FORCE_DEPLY_OFF) {
|
||||
}
|
||||
if (actionId == DEPLOY_SOLAR_ARRAYS_MANUALLY) {
|
||||
ManualDeploymentCommand cmd;
|
||||
if (size < cmd.getSerializedSize()) {
|
||||
return HasActionsIF::INVALID_PARAMETERS;
|
||||
}
|
||||
result = cmd.deSerialize(&data, &size, SerializeIF::Endianness::NETWORK);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
return HasActionsIF::INVALID_ACTION_ID;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user