This commit is contained in:
parent
214428295b
commit
b6b258d82c
@ -211,13 +211,27 @@ void initmission::initTasks() {
|
|||||||
tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_READ);
|
tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_READ);
|
||||||
tcsTask->addComponent(rtd, DeviceHandlerIF::GET_READ);
|
tcsTask->addComponent(rtd, DeviceHandlerIF::GET_READ);
|
||||||
}
|
}
|
||||||
tcsTask->addComponent(objects::TCS_BOARD_ASS);
|
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES */
|
|
||||||
|
|
||||||
#if OBSW_ADD_TCS_CTRL == 1
|
|
||||||
tcsTask->addComponent(objects::THERMAL_CONTROLLER);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PeriodicTaskIF* tcsSystemTask = factory->createPeriodicTask(
|
||||||
|
"TCS_TASK", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.5, missedDeadlineFunc);
|
||||||
|
#if OBSW_ADD_RTD_DEVICES == 1
|
||||||
|
result = tcsSystemTask->addComponent(objects::TCS_BOARD_ASS);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
initmission::printAddObjectError("TCS_BOARD_ASS", objects::TCS_BOARD_ASS);
|
||||||
|
}
|
||||||
|
#endif /* OBSW_ADD_RTD_DEVICES */
|
||||||
|
#if OBSW_ADD_TCS_CTRL == 1
|
||||||
|
result = tcsSystemTask->addComponent(objects::THERMAL_CONTROLLER);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
initmission::printAddObjectError("THERMAL_CONTROLLER", objects::THERMAL_CONTROLLER);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
result = tcsSystemTask->addComponent(objects::HEATER_HANDLER);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
initmission::printAddObjectError("HEATER_HANDLER", objects::HEATER_HANDLER);
|
||||||
|
}
|
||||||
|
|
||||||
#if OBSW_ADD_STAR_TRACKER == 1
|
#if OBSW_ADD_STAR_TRACKER == 1
|
||||||
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
PeriodicTaskIF* strHelperTask = factory->createPeriodicTask(
|
||||||
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
"STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
|
||||||
@ -319,6 +333,7 @@ void initmission::initTasks() {
|
|||||||
tcsPollingTask->startTask();
|
tcsPollingTask->startTask();
|
||||||
tcsTask->startTask();
|
tcsTask->startTask();
|
||||||
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
|
#endif /* OBSW_ADD_RTD_DEVICES == 1 */
|
||||||
|
tcsSystemTask->startTask();
|
||||||
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
#if OBSW_ADD_PLOC_SUPERVISOR == 1
|
||||||
supvHelperTask->startTask();
|
supvHelperTask->startTask();
|
||||||
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
#endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */
|
||||||
@ -378,18 +393,6 @@ void initmission::createPstTasks(TaskFactory& factory,
|
|||||||
taskVec.push_back(uartPst);
|
taskVec.push_back(uartPst);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
|
|
||||||
"GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.2, missedDeadlineFunc);
|
|
||||||
result = pst::pstGpio(gpioPst);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
if (result == FixedTimeslotTaskIF::SLOT_LIST_EMPTY) {
|
|
||||||
sif::warning << "InitMission::initTasks: GPIO PST is empty" << std::endl;
|
|
||||||
} else {
|
|
||||||
sif::error << "InitMission::initTasks: Creating GPIO PST failed!" << std::endl;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
taskVec.push_back(gpioPst);
|
|
||||||
}
|
|
||||||
#if OBSW_ADD_I2C_TEST_CODE == 0
|
#if OBSW_ADD_I2C_TEST_CODE == 0
|
||||||
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
|
||||||
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
"I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
|
||||||
|
@ -539,7 +539,7 @@ void ObjectFactory::createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwi
|
|||||||
pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
|
pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher) {
|
||||||
using namespace gpio;
|
using namespace gpio;
|
||||||
GpioCookie* solarArrayDeplCookie = new GpioCookie;
|
GpioCookie* solarArrayDeplCookie = new GpioCookie;
|
||||||
GpiodRegularByLineName* gpio = nullptr;
|
GpiodRegularByLineName* gpio = nullptr;
|
||||||
@ -555,9 +555,9 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
|
|||||||
|
|
||||||
// TODO: Find out burn time. For now set to 1000 ms.
|
// TODO: Find out burn time. For now set to 1000 ms.
|
||||||
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
|
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
|
||||||
solarArrayDeplCookie, objects::PCDU_HANDLER,
|
solarArrayDeplCookie, pwrSwitcher,
|
||||||
pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
|
pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
|
||||||
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
|
gpioIds::DEPLSA1, gpioIds::DEPLSA2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
|
void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
|
||||||
|
@ -33,7 +33,7 @@ void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTa
|
|||||||
void createImtqComponents(PowerSwitchIF* pwrSwitcher);
|
void createImtqComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
void createBpxBatteryComponent();
|
void createBpxBatteryComponent();
|
||||||
void createStrComponents(PowerSwitchIF* pwrSwitcher);
|
void createStrComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
void createSolarArrayDeploymentComponents();
|
void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher);
|
||||||
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher);
|
||||||
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
void createPayloadComponents(LinuxLibgpioIF* gpioComIF);
|
||||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
|
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
|
||||||
|
@ -35,7 +35,7 @@ void ObjectFactory::produce(void* args) {
|
|||||||
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
||||||
#endif
|
#endif
|
||||||
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
|
createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
|
||||||
createSolarArrayDeploymentComponents();
|
createSolarArrayDeploymentComponents(*pwrSwitcher);
|
||||||
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
|
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
|
||||||
#if OBSW_ADD_SYRLINKS == 1
|
#if OBSW_ADD_SYRLINKS == 1
|
||||||
createSyrlinksComponents(pwrSwitcher);
|
createSyrlinksComponents(pwrSwitcher);
|
||||||
|
@ -15,22 +15,6 @@
|
|||||||
#define RPI_TEST_GPS_HANDLER 0
|
#define RPI_TEST_GPS_HANDLER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
|
|
||||||
// Length of a communication cycle
|
|
||||||
uint32_t length = thisSequence->getPeriodMs();
|
|
||||||
|
|
||||||
thisSequence->addSlot(objects::HEATER_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
thisSequence->addSlot(objects::SOLAR_ARRAY_DEPL_HANDLER, length * 0,
|
|
||||||
DeviceHandlerIF::PERFORM_OPERATION);
|
|
||||||
|
|
||||||
if (thisSequence->checkSequence() == returnvalue::OK) {
|
|
||||||
return returnvalue::OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
sif::error << "PollingSequence::initialize has errors!" << std::endl;
|
|
||||||
return returnvalue::FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
|
ReturnValue_t pst::pstSpiRw(FixedTimeslotTaskIF *thisSequence) {
|
||||||
uint32_t length = thisSequence->getPeriodMs();
|
uint32_t length = thisSequence->getPeriodMs();
|
||||||
static_cast<void>(length);
|
static_cast<void>(length);
|
||||||
|
@ -31,9 +31,6 @@ class FixedTimeslotTaskIF;
|
|||||||
*/
|
*/
|
||||||
namespace pst {
|
namespace pst {
|
||||||
|
|
||||||
/* 0.4 second period init*/
|
|
||||||
ReturnValue_t pstGpio(FixedTimeslotTaskIF* thisSequence);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function creates the PST for all gomspace devices.
|
* @brief This function creates the PST for all gomspace devices.
|
||||||
* @details
|
* @details
|
||||||
|
@ -7,16 +7,15 @@
|
|||||||
|
|
||||||
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(
|
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(
|
||||||
object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF* gpioCookie_,
|
object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF* gpioCookie_,
|
||||||
object_id_t mainLineSwitcherObjectId_, pcdu::Switches mainLineSwitch_, gpioId_t deplSA1,
|
PowerSwitchIF& mainLineSwitcher_, pcdu::Switches mainLineSwitch_, gpioId_t deplSA1,
|
||||||
gpioId_t deplSA2, uint32_t burnTimeMs)
|
gpioId_t deplSA2)
|
||||||
: SystemObject(setObjectId_),
|
: SystemObject(setObjectId_),
|
||||||
gpioDriverId(gpioDriverId_),
|
gpioDriverId(gpioDriverId_),
|
||||||
gpioCookie(gpioCookie_),
|
gpioCookie(gpioCookie_),
|
||||||
mainLineSwitcherObjectId(mainLineSwitcherObjectId_),
|
|
||||||
mainLineSwitch(mainLineSwitch_),
|
|
||||||
deplSA1(deplSA1),
|
deplSA1(deplSA1),
|
||||||
deplSA2(deplSA2),
|
deplSA2(deplSA2),
|
||||||
burnTimeMs(burnTimeMs),
|
mainLineSwitcher(mainLineSwitcher_),
|
||||||
|
mainLineSwitch(mainLineSwitch_),
|
||||||
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(
|
||||||
@ -52,16 +51,6 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainLineSwitcherObjectId != objects::NO_OBJECT) {
|
|
||||||
mainLineSwitcher = ObjectManager::instance()->get<PowerSwitchIF>(mainLineSwitcherObjectId);
|
|
||||||
if (mainLineSwitcher == nullptr) {
|
|
||||||
sif::error
|
|
||||||
<< "SolarArrayDeploymentHandler::initialize: Main line switcher failed to fetch object"
|
|
||||||
<< "from object ID." << std::endl;
|
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = actionHelper.initialize(commandQueue);
|
result = actionHelper.initialize(commandQueue);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
@ -71,102 +60,102 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SolarArrayDeploymentHandler::handleStateMachine() {
|
void SolarArrayDeploymentHandler::handleStateMachine() {
|
||||||
switch (stateMachine) {
|
// switch (stateMachine) {
|
||||||
case WAIT_ON_DELOYMENT_COMMAND:
|
// case WAIT_ON_DELOYMENT_COMMAND:
|
||||||
readCommandQueue();
|
// readCommandQueue();
|
||||||
break;
|
// break;
|
||||||
case SWITCH_8V_ON:
|
// case SWITCH_8V_ON:
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
|
// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
|
||||||
mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
// mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs());
|
||||||
stateMachine = WAIT_ON_8V_SWITCH;
|
// stateMachine = WAIT_ON_8V_SWITCH;
|
||||||
break;
|
// break;
|
||||||
case WAIT_ON_8V_SWITCH:
|
// case WAIT_ON_8V_SWITCH:
|
||||||
performWaitOn8VActions();
|
// performWaitOn8VActions();
|
||||||
break;
|
// break;
|
||||||
case SWITCH_DEPL_GPIOS:
|
// case SWITCH_DEPL_GPIOS:
|
||||||
switchDeploymentTransistors();
|
// deploymentTransistorsOn();
|
||||||
break;
|
// break;
|
||||||
case WAIT_ON_DEPLOYMENT_FINISH:
|
//// case WAIT_ON_DEPLOYMENT_FINISH:
|
||||||
handleDeploymentFinish();
|
//// handleDeploymentFinish();
|
||||||
break;
|
//// break;
|
||||||
case WAIT_FOR_MAIN_SWITCH_OFF:
|
// case WAIT_FOR_MAIN_SWITCH_OFF:
|
||||||
if (mainLineSwitcher->getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_OFF) {
|
// if (mainLineSwitcher.getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_OFF) {
|
||||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
// stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
} else if (mainSwitchCountdown.hasTimedOut()) {
|
// } else if (mainSwitchCountdown.hasTimedOut()) {
|
||||||
triggerEvent(MAIN_SWITCH_OFF_TIMEOUT);
|
// triggerEvent(MAIN_SWITCH_OFF_TIMEOUT);
|
||||||
sif::error << "SolarArrayDeploymentHandler::handleStateMachine: Failed to switch main"
|
// sif::error << "SolarArrayDeploymentHandler::handleStateMachine: Failed to switch main"
|
||||||
<< " switch off" << std::endl;
|
// << " switch off" << std::endl;
|
||||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
// stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Invalid state" << std::endl;
|
// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Invalid state" << std::endl;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolarArrayDeploymentHandler::performWaitOn8VActions() {
|
void SolarArrayDeploymentHandler::performWaitOn8VActions() {
|
||||||
if (mainLineSwitcher->getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_ON) {
|
// if (mainLineSwitcher.getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_ON) {
|
||||||
stateMachine = SWITCH_DEPL_GPIOS;
|
// stateMachine = SWITCH_DEPL_GPIOS;
|
||||||
} else {
|
// } else {
|
||||||
if (mainSwitchCountdown.hasTimedOut()) {
|
// if (mainSwitchCountdown.hasTimedOut()) {
|
||||||
triggerEvent(MAIN_SWITCH_ON_TIMEOUT);
|
// triggerEvent(MAIN_SWITCH_ON_TIMEOUT);
|
||||||
actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
|
// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
|
||||||
MAIN_SWITCH_TIMEOUT_FAILURE);
|
// MAIN_SWITCH_TIMEOUT_FAILURE);
|
||||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
// stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
|
void SolarArrayDeploymentHandler::deploymentTransistorsOn() {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
// ReturnValue_t result = returnvalue::OK;
|
||||||
result = gpioInterface->pullHigh(deplSA1);
|
// result = gpioInterface->pullHigh(deplSA1);
|
||||||
if (result != returnvalue::OK) {
|
// if (result != returnvalue::OK) {
|
||||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||||
" array deployment switch 1 high "
|
// " array deployment switch 1 high "
|
||||||
<< std::endl;
|
// << std::endl;
|
||||||
/* If gpio switch high failed, state machine is reset to wait for a command reinitiating
|
// /* If gpio switch high failed, state machine is reset to wait for a command reinitiating
|
||||||
* the deployment sequence. */
|
// * the deployment sequence. */
|
||||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
// stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
|
// triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED);
|
||||||
actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED);
|
// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED);
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||||
}
|
// }
|
||||||
result = gpioInterface->pullHigh(deplSA2);
|
// result = gpioInterface->pullHigh(deplSA2);
|
||||||
if (result != returnvalue::OK) {
|
// if (result != returnvalue::OK) {
|
||||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||||
" array deployment switch 2 high "
|
// " array deployment switch 2 high "
|
||||||
<< std::endl;
|
// << std::endl;
|
||||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
// stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
|
// triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
|
||||||
actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED);
|
// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED);
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||||
}
|
// }
|
||||||
deploymentCountdown.setTimeout(burnTimeMs);
|
//deploymentCountdown.setTimeout(burnTimeMs);
|
||||||
stateMachine = WAIT_ON_DEPLOYMENT_FINISH;
|
//stateMachine = WAIT_ON_DEPLOYMENT_FINISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolarArrayDeploymentHandler::handleDeploymentFinish() {
|
//void SolarArrayDeploymentHandler::handleDeploymentFinish() {
|
||||||
ReturnValue_t result = returnvalue::OK;
|
// ReturnValue_t result = returnvalue::OK;
|
||||||
if (deploymentCountdown.hasTimedOut()) {
|
//// if (deploymentCountdown.hasTimedOut()) {
|
||||||
actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, returnvalue::OK);
|
//// actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, returnvalue::OK);
|
||||||
result = gpioInterface->pullLow(deplSA1);
|
//// result = gpioInterface->pullLow(deplSA1);
|
||||||
if (result != returnvalue::OK) {
|
//// if (result != returnvalue::OK) {
|
||||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
//// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||||
" array deployment switch 1 low "
|
//// " array deployment switch 1 low "
|
||||||
<< std::endl;
|
//// << std::endl;
|
||||||
}
|
//// }
|
||||||
result = gpioInterface->pullLow(deplSA2);
|
//// result = gpioInterface->pullLow(deplSA2);
|
||||||
if (result != returnvalue::OK) {
|
//// if (result != returnvalue::OK) {
|
||||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
//// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||||
" array deployment switch 2 low "
|
//// " array deployment switch 2 low "
|
||||||
<< std::endl;
|
//// << std::endl;
|
||||||
}
|
//// }
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||||
mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
// mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs());
|
||||||
stateMachine = WAIT_FOR_MAIN_SWITCH_OFF;
|
// stateMachine = WAIT_FOR_MAIN_SWITCH_OFF;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void SolarArrayDeploymentHandler::readCommandQueue() {
|
void SolarArrayDeploymentHandler::readCommandQueue() {
|
||||||
CommandMessage command;
|
CommandMessage command;
|
||||||
@ -185,20 +174,20 @@ ReturnValue_t SolarArrayDeploymentHandler::executeAction(ActionId_t actionId,
|
|||||||
MessageQueueId_t commandedBy,
|
MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size) {
|
const uint8_t* data, size_t size) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
if (stateMachine != WAIT_ON_DELOYMENT_COMMAND) {
|
// if (stateMachine != WAIT_ON_DELOYMENT_COMMAND) {
|
||||||
sif::error << "SolarArrayDeploymentHandler::executeAction: Received command while not in"
|
// sif::error << "SolarArrayDeploymentHandler::executeAction: Received command while not in"
|
||||||
<< "waiting-on-command-state" << std::endl;
|
// << "waiting-on-command-state" << std::endl;
|
||||||
return DEPLOYMENT_ALREADY_EXECUTING;
|
// return DEPLOYMENT_ALREADY_EXECUTING;
|
||||||
}
|
// }
|
||||||
if (actionId != DEPLOY_SOLAR_ARRAYS) {
|
// if (actionId != DEPLOY_SOLAR_ARRAYS) {
|
||||||
sif::error << "SolarArrayDeploymentHandler::executeAction: Received invalid command"
|
// sif::error << "SolarArrayDeploymentHandler::executeAction: Received invalid command"
|
||||||
<< std::endl;
|
// << std::endl;
|
||||||
result = COMMAND_NOT_SUPPORTED;
|
// result = COMMAND_NOT_SUPPORTED;
|
||||||
} else {
|
// } else {
|
||||||
stateMachine = SWITCH_8V_ON;
|
// stateMachine = SWITCH_8V_ON;
|
||||||
rememberCommanderId = commandedBy;
|
// rememberCommanderId = commandedBy;
|
||||||
result = returnvalue::OK;
|
// result = returnvalue::OK;
|
||||||
}
|
// }
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
public SystemObject,
|
public SystemObject,
|
||||||
public HasActionsIF {
|
public HasActionsIF {
|
||||||
public:
|
public:
|
||||||
static const DeviceCommandId_t DEPLOY_SOLAR_ARRAYS = 0x5;
|
static constexpr DeviceCommandId_t DEPLOY_SOLAR_ARRAYS_MANUALLY = 0x5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief constructor
|
* @brief constructor
|
||||||
@ -44,9 +44,8 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
* @param burnTimeMs Time duration the power will be applied to the burn wires.
|
* @param burnTimeMs Time duration the power will be applied to the burn wires.
|
||||||
*/
|
*/
|
||||||
SolarArrayDeploymentHandler(object_id_t setObjectId, object_id_t gpioDriverId,
|
SolarArrayDeploymentHandler(object_id_t setObjectId, object_id_t gpioDriverId,
|
||||||
CookieIF* gpioCookie, object_id_t mainLineSwitcherObjectId,
|
CookieIF* gpioCookie, PowerSwitchIF& mainLineSwitcher,
|
||||||
pcdu::Switches mainLineSwitch, gpioId_t deplSA1, gpioId_t deplSA2,
|
pcdu::Switches mainLineSwitch, gpioId_t deplSA1, gpioId_t deplSA2);
|
||||||
uint32_t burnTimeMs);
|
|
||||||
|
|
||||||
virtual ~SolarArrayDeploymentHandler();
|
virtual ~SolarArrayDeploymentHandler();
|
||||||
|
|
||||||
@ -72,16 +71,16 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
static const Event DEPL_SA1_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(3, severity::HIGH);
|
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);
|
static const Event DEPL_SA2_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(4, severity::HIGH);
|
||||||
|
|
||||||
enum StateMachine {
|
// enum StateMachine {
|
||||||
WAIT_ON_DELOYMENT_COMMAND,
|
// WAIT_ON_DELOYMENT_COMMAND,
|
||||||
SWITCH_8V_ON,
|
// SWITCH_8V_ON,
|
||||||
WAIT_ON_8V_SWITCH,
|
// WAIT_ON_8V_SWITCH,
|
||||||
SWITCH_DEPL_GPIOS,
|
// SWITCH_DEPL_GPIOS,
|
||||||
WAIT_ON_DEPLOYMENT_FINISH,
|
// WAIT_ON_DEPLOYMENT_FINISH,
|
||||||
WAIT_FOR_MAIN_SWITCH_OFF
|
// WAIT_FOR_MAIN_SWITCH_OFF
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
StateMachine stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
// StateMachine stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
@ -91,7 +90,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
/**
|
/**
|
||||||
* This countdown is used to wait for the burn wire being successful cut.
|
* 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.
|
* The message queue id of the component commanding an action will be stored in this variable.
|
||||||
@ -107,27 +106,21 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
|
|
||||||
CookieIF* gpioCookie;
|
CookieIF* gpioCookie;
|
||||||
|
|
||||||
/** Object id of the object responsible to switch the 8V power input. Typically the PCDU. */
|
|
||||||
object_id_t mainLineSwitcherObjectId;
|
|
||||||
|
|
||||||
/** Switch number of the 8V power switch */
|
|
||||||
uint8_t mainLineSwitch;
|
|
||||||
|
|
||||||
gpioId_t deplSA1;
|
gpioId_t deplSA1;
|
||||||
gpioId_t deplSA2;
|
gpioId_t deplSA2;
|
||||||
|
|
||||||
GpioIF* gpioInterface = nullptr;
|
GpioIF* gpioInterface = nullptr;
|
||||||
|
|
||||||
/** Time duration switches are active to cut the burn wire */
|
|
||||||
uint32_t burnTimeMs;
|
|
||||||
|
|
||||||
/** Queue to receive messages from other objects. */
|
/** Queue to receive messages from other objects. */
|
||||||
MessageQueueIF* commandQueue = nullptr;
|
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.
|
||||||
*/
|
*/
|
||||||
PowerSwitchIF* mainLineSwitcher = nullptr;
|
PowerSwitchIF& mainLineSwitcher;
|
||||||
|
|
||||||
|
/** Switch number of the 8V power switch */
|
||||||
|
uint8_t mainLineSwitch;
|
||||||
|
|
||||||
ActionHelper actionHelper;
|
ActionHelper actionHelper;
|
||||||
|
|
||||||
@ -147,13 +140,13 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
/**
|
/**
|
||||||
* @brief This functions handles the switching of the solar array deployment transistors.
|
* @brief This functions handles the switching of the solar array deployment transistors.
|
||||||
*/
|
*/
|
||||||
void switchDeploymentTransistors();
|
void deploymentTransistorsOn();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function performs actions to finish the deployment. Essentially switches
|
* @brief This function performs actions to finish the deployment. Essentially switches
|
||||||
* are turned of after the burn time has expired.
|
* are turned of after the burn time has expired.
|
||||||
*/
|
*/
|
||||||
void handleDeploymentFinish();
|
//void handleDeploymentFinish();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ */
|
#endif /* MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user