diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index a5cc3df9..d74581c7 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -211,13 +211,27 @@ void initmission::initTasks() { tcsTask->addComponent(rtd, DeviceHandlerIF::SEND_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 + 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 PeriodicTaskIF* strHelperTask = factory->createPeriodicTask( "STR_HELPER", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); @@ -319,6 +333,7 @@ void initmission::initTasks() { tcsPollingTask->startTask(); tcsTask->startTask(); #endif /* OBSW_ADD_RTD_DEVICES == 1 */ + tcsSystemTask->startTask(); #if OBSW_ADD_PLOC_SUPERVISOR == 1 supvHelperTask->startTask(); #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ @@ -378,18 +393,6 @@ void initmission::createPstTasks(TaskFactory& factory, 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 FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask( "I2C_PST", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 80dcb55e..db2779bd 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -539,7 +539,7 @@ void ObjectFactory::createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwi pcdu::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V); } -void ObjectFactory::createSolarArrayDeploymentComponents() { +void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher) { using namespace gpio; GpioCookie* solarArrayDeplCookie = new GpioCookie; GpiodRegularByLineName* gpio = nullptr; @@ -555,9 +555,9 @@ void ObjectFactory::createSolarArrayDeploymentComponents() { // TODO: Find out burn time. For now set to 1000 ms. new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF, - solarArrayDeplCookie, objects::PCDU_HANDLER, + solarArrayDeplCookie, pwrSwitcher, pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, - gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000); + gpioIds::DEPLSA1, gpioIds::DEPLSA2); } void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { diff --git a/bsp_q7s/core/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h index 0b81c235..37cdc70e 100644 --- a/bsp_q7s/core/ObjectFactory.h +++ b/bsp_q7s/core/ObjectFactory.h @@ -33,7 +33,7 @@ void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTa void createImtqComponents(PowerSwitchIF* pwrSwitcher); void createBpxBatteryComponent(); void createStrComponents(PowerSwitchIF* pwrSwitcher); -void createSolarArrayDeploymentComponents(); +void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher); void createSyrlinksComponents(PowerSwitchIF* pwrSwitcher); void createPayloadComponents(LinuxLibgpioIF* gpioComIF); void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher); diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index 1746c048..413223d8 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -35,7 +35,7 @@ void ObjectFactory::produce(void* args) { createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher); #endif createHeaterComponents(gpioComIF, pwrSwitcher, healthTable); - createSolarArrayDeploymentComponents(); + createSolarArrayDeploymentComponents(*pwrSwitcher); createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher); #if OBSW_ADD_SYRLINKS == 1 createSyrlinksComponents(pwrSwitcher); diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index e11632c8..0d75588f 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -15,22 +15,6 @@ #define RPI_TEST_GPS_HANDLER 0 #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) { uint32_t length = thisSequence->getPeriodMs(); static_cast(length); diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h index 960820b5..1b585d81 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.h @@ -31,9 +31,6 @@ class FixedTimeslotTaskIF; */ namespace pst { -/* 0.4 second period init*/ -ReturnValue_t pstGpio(FixedTimeslotTaskIF* thisSequence); - /** * @brief This function creates the PST for all gomspace devices. * @details diff --git a/mission/devices/SolarArrayDeploymentHandler.cpp b/mission/devices/SolarArrayDeploymentHandler.cpp index c4e9a43b..63425615 100644 --- a/mission/devices/SolarArrayDeploymentHandler.cpp +++ b/mission/devices/SolarArrayDeploymentHandler.cpp @@ -7,16 +7,15 @@ SolarArrayDeploymentHandler::SolarArrayDeploymentHandler( object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF* gpioCookie_, - object_id_t mainLineSwitcherObjectId_, pcdu::Switches mainLineSwitch_, gpioId_t deplSA1, - gpioId_t deplSA2, uint32_t burnTimeMs) + PowerSwitchIF& mainLineSwitcher_, pcdu::Switches mainLineSwitch_, gpioId_t deplSA1, + gpioId_t deplSA2) : SystemObject(setObjectId_), gpioDriverId(gpioDriverId_), gpioCookie(gpioCookie_), - mainLineSwitcherObjectId(mainLineSwitcherObjectId_), - mainLineSwitch(mainLineSwitch_), deplSA1(deplSA1), deplSA2(deplSA2), - burnTimeMs(burnTimeMs), + mainLineSwitcher(mainLineSwitcher_), + mainLineSwitch(mainLineSwitch_), actionHelper(this, nullptr) { auto mqArgs = MqArgs(setObjectId_, static_cast(this)); commandQueue = QueueFactory::instance()->createMessageQueue( @@ -52,16 +51,6 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - if (mainLineSwitcherObjectId != objects::NO_OBJECT) { - mainLineSwitcher = ObjectManager::instance()->get(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); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; @@ -71,102 +60,102 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() { } void SolarArrayDeploymentHandler::handleStateMachine() { - switch (stateMachine) { - case WAIT_ON_DELOYMENT_COMMAND: - readCommandQueue(); - break; - case SWITCH_8V_ON: - mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON); - mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs()); - stateMachine = WAIT_ON_8V_SWITCH; - break; - case WAIT_ON_8V_SWITCH: - performWaitOn8VActions(); - break; - case SWITCH_DEPL_GPIOS: - switchDeploymentTransistors(); - break; - case WAIT_ON_DEPLOYMENT_FINISH: - handleDeploymentFinish(); - break; - case WAIT_FOR_MAIN_SWITCH_OFF: - if (mainLineSwitcher->getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_OFF) { - stateMachine = WAIT_ON_DELOYMENT_COMMAND; - } else if (mainSwitchCountdown.hasTimedOut()) { - triggerEvent(MAIN_SWITCH_OFF_TIMEOUT); - sif::error << "SolarArrayDeploymentHandler::handleStateMachine: Failed to switch main" - << " switch off" << std::endl; - stateMachine = WAIT_ON_DELOYMENT_COMMAND; - } - break; - default: - sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Invalid state" << std::endl; - break; - } +// switch (stateMachine) { +// case WAIT_ON_DELOYMENT_COMMAND: +// readCommandQueue(); +// break; +// case SWITCH_8V_ON: +// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON); +// mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs()); +// stateMachine = WAIT_ON_8V_SWITCH; +// break; +// case WAIT_ON_8V_SWITCH: +// performWaitOn8VActions(); +// break; +// case SWITCH_DEPL_GPIOS: +// deploymentTransistorsOn(); +// break; +//// case WAIT_ON_DEPLOYMENT_FINISH: +//// handleDeploymentFinish(); +//// break; +// case WAIT_FOR_MAIN_SWITCH_OFF: +// if (mainLineSwitcher.getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_OFF) { +// stateMachine = WAIT_ON_DELOYMENT_COMMAND; +// } else if (mainSwitchCountdown.hasTimedOut()) { +// triggerEvent(MAIN_SWITCH_OFF_TIMEOUT); +// sif::error << "SolarArrayDeploymentHandler::handleStateMachine: Failed to switch main" +// << " switch off" << std::endl; +// stateMachine = WAIT_ON_DELOYMENT_COMMAND; +// } +// break; +// default: +// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Invalid state" << std::endl; +// break; +// } } void SolarArrayDeploymentHandler::performWaitOn8VActions() { - if (mainLineSwitcher->getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_ON) { - stateMachine = SWITCH_DEPL_GPIOS; - } else { - if (mainSwitchCountdown.hasTimedOut()) { - triggerEvent(MAIN_SWITCH_ON_TIMEOUT); - actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, - MAIN_SWITCH_TIMEOUT_FAILURE); - stateMachine = WAIT_ON_DELOYMENT_COMMAND; - } - } +// if (mainLineSwitcher.getSwitchState(mainLineSwitch) == PowerSwitchIF::SWITCH_ON) { +// stateMachine = SWITCH_DEPL_GPIOS; +// } else { +// if (mainSwitchCountdown.hasTimedOut()) { +// triggerEvent(MAIN_SWITCH_ON_TIMEOUT); +// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, +// MAIN_SWITCH_TIMEOUT_FAILURE); +// stateMachine = WAIT_ON_DELOYMENT_COMMAND; +// } +// } } -void SolarArrayDeploymentHandler::switchDeploymentTransistors() { - ReturnValue_t result = returnvalue::OK; - 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 reinitiating - * the deployment sequence. */ - stateMachine = WAIT_ON_DELOYMENT_COMMAND; - triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED); - actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); - mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); - } - result = gpioInterface->pullHigh(deplSA2); - if (result != returnvalue::OK) { - sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" - " array deployment switch 2 high " - << std::endl; - stateMachine = WAIT_ON_DELOYMENT_COMMAND; - triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED); - actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); - mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); - } - deploymentCountdown.setTimeout(burnTimeMs); - stateMachine = WAIT_ON_DEPLOYMENT_FINISH; +void SolarArrayDeploymentHandler::deploymentTransistorsOn() { +// ReturnValue_t result = returnvalue::OK; +// 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 reinitiating +// * the deployment sequence. */ +// stateMachine = WAIT_ON_DELOYMENT_COMMAND; +// triggerEvent(DEPL_SA1_GPIO_SWTICH_ON_FAILED); +// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); +// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); +// } +// result = gpioInterface->pullHigh(deplSA2); +// if (result != returnvalue::OK) { +// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" +// " array deployment switch 2 high " +// << std::endl; +// stateMachine = WAIT_ON_DELOYMENT_COMMAND; +// triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED); +// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); +// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); +// } + //deploymentCountdown.setTimeout(burnTimeMs); + //stateMachine = WAIT_ON_DEPLOYMENT_FINISH; } -void SolarArrayDeploymentHandler::handleDeploymentFinish() { - ReturnValue_t result = returnvalue::OK; - if (deploymentCountdown.hasTimedOut()) { - actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, returnvalue::OK); - result = gpioInterface->pullLow(deplSA1); - if (result != returnvalue::OK) { - sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" - " array deployment switch 1 low " - << std::endl; - } - result = gpioInterface->pullLow(deplSA2); - if (result != returnvalue::OK) { - sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" - " array deployment switch 2 low " - << std::endl; - } - mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); - mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs()); - stateMachine = WAIT_FOR_MAIN_SWITCH_OFF; - } -} +//void SolarArrayDeploymentHandler::handleDeploymentFinish() { +// ReturnValue_t result = returnvalue::OK; +//// if (deploymentCountdown.hasTimedOut()) { +//// actionHelper.finish(true, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, returnvalue::OK); +//// result = gpioInterface->pullLow(deplSA1); +//// if (result != returnvalue::OK) { +//// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" +//// " array deployment switch 1 low " +//// << std::endl; +//// } +//// result = gpioInterface->pullLow(deplSA2); +//// if (result != returnvalue::OK) { +//// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" +//// " array deployment switch 2 low " +//// << std::endl; +//// } +// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); +// mainSwitchCountdown.setTimeout(mainLineSwitcher.getSwitchDelayMs()); +// stateMachine = WAIT_FOR_MAIN_SWITCH_OFF; +// } +//} void SolarArrayDeploymentHandler::readCommandQueue() { CommandMessage command; @@ -185,20 +174,20 @@ ReturnValue_t SolarArrayDeploymentHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { ReturnValue_t result; - if (stateMachine != WAIT_ON_DELOYMENT_COMMAND) { - sif::error << "SolarArrayDeploymentHandler::executeAction: Received command while not in" - << "waiting-on-command-state" << std::endl; - return DEPLOYMENT_ALREADY_EXECUTING; - } - if (actionId != DEPLOY_SOLAR_ARRAYS) { - sif::error << "SolarArrayDeploymentHandler::executeAction: Received invalid command" - << std::endl; - result = COMMAND_NOT_SUPPORTED; - } else { - stateMachine = SWITCH_8V_ON; - rememberCommanderId = commandedBy; - result = returnvalue::OK; - } +// if (stateMachine != WAIT_ON_DELOYMENT_COMMAND) { +// sif::error << "SolarArrayDeploymentHandler::executeAction: Received command while not in" +// << "waiting-on-command-state" << std::endl; +// return DEPLOYMENT_ALREADY_EXECUTING; +// } +// if (actionId != DEPLOY_SOLAR_ARRAYS) { +// sif::error << "SolarArrayDeploymentHandler::executeAction: Received invalid command" +// << std::endl; +// result = COMMAND_NOT_SUPPORTED; +// } else { +// stateMachine = SWITCH_8V_ON; +// rememberCommanderId = commandedBy; +// result = returnvalue::OK; +// } return result; } diff --git a/mission/devices/SolarArrayDeploymentHandler.h b/mission/devices/SolarArrayDeploymentHandler.h index 89be12a6..05fb7fb4 100644 --- a/mission/devices/SolarArrayDeploymentHandler.h +++ b/mission/devices/SolarArrayDeploymentHandler.h @@ -26,7 +26,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF, public SystemObject, public HasActionsIF { public: - static const DeviceCommandId_t DEPLOY_SOLAR_ARRAYS = 0x5; + static constexpr DeviceCommandId_t DEPLOY_SOLAR_ARRAYS_MANUALLY = 0x5; /** * @brief constructor @@ -44,9 +44,8 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF, * @param burnTimeMs Time duration the power will be applied to the burn wires. */ SolarArrayDeploymentHandler(object_id_t setObjectId, object_id_t gpioDriverId, - CookieIF* gpioCookie, object_id_t mainLineSwitcherObjectId, - pcdu::Switches mainLineSwitch, gpioId_t deplSA1, gpioId_t deplSA2, - uint32_t burnTimeMs); + CookieIF* gpioCookie, PowerSwitchIF& mainLineSwitcher, + pcdu::Switches mainLineSwitch, gpioId_t deplSA1, gpioId_t deplSA2); 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_SA2_GPIO_SWTICH_ON_FAILED = MAKE_EVENT(4, severity::HIGH); - 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; +// 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; /** * 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. */ - Countdown deploymentCountdown; + //Countdown deploymentCountdown; /** * 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; - /** 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 deplSA2; GpioIF* gpioInterface = nullptr; - /** Time duration switches are active to cut the burn wire */ - uint32_t burnTimeMs; - /** Queue to receive messages from other objects. */ MessageQueueIF* commandQueue = nullptr; /** * 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; @@ -147,13 +140,13 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF, /** * @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 * are turned of after the burn time has expired. */ - void handleDeploymentFinish(); + //void handleDeploymentFinish(); }; #endif /* MISSION_DEVICES_SOLARARRAYDEPLOYMENT_H_ */