v1.15.0 #311

Merged
muellerr merged 107 commits from develop into main 2022-10-27 11:28:49 +02:00
5 changed files with 116 additions and 131 deletions
Showing only changes of commit 09c0afbe7f - Show all commits

View File

@ -539,7 +539,8 @@ 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(PowerSwitchIF& pwrSwitcher) { void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher,
GpioIF& gpioIF) {
using namespace gpio; using namespace gpio;
GpioCookie* solarArrayDeplCookie = new GpioCookie; GpioCookie* solarArrayDeplCookie = new GpioCookie;
GpiodRegularByLineName* gpio = nullptr; GpiodRegularByLineName* gpio = nullptr;
@ -552,10 +553,12 @@ void ObjectFactory::createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitc
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), Direction::OUT, gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), Direction::OUT,
Levels::LOW); Levels::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio);
ReturnValue_t result = gpioIF.addGpios(solarArrayDeplCookie);
if (result != returnvalue::OK) {
sif::error << "Adding Solar Array Deployment GPIO cookie failed" << std::endl;
}
// TODO: Find out burn time. For now set to 1000 ms. new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, gpioIF, pwrSwitcher,
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
solarArrayDeplCookie, pwrSwitcher,
pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V, pcdu::Switches::PDU2_CH5_DEPLOYMENT_MECHANISM_8V,
gpioIds::DEPLSA1, gpioIds::DEPLSA2); gpioIds::DEPLSA1, gpioIds::DEPLSA2);
} }

View File

@ -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(PowerSwitchIF& pwrSwitcher); void createSolarArrayDeploymentComponents(PowerSwitchIF& pwrSwitcher, GpioIF& gpioIF);
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);

View File

@ -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(*pwrSwitcher); createSolarArrayDeploymentComponents(*pwrSwitcher, *gpioComIF);
createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher); createPlPcduComponents(gpioComIF, spiMainComIF, pwrSwitcher);
#if OBSW_ADD_SYRLINKS == 1 #if OBSW_ADD_SYRLINKS == 1
createSyrlinksComponents(pwrSwitcher); createSyrlinksComponents(pwrSwitcher);

View File

@ -5,13 +5,13 @@
#include <fsfw/objectmanager/ObjectManager.h> #include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw_hal/common/gpio/GpioCookie.h> #include <fsfw_hal/common/gpio/GpioCookie.h>
SolarArrayDeploymentHandler::SolarArrayDeploymentHandler( SolarArrayDeploymentHandler::SolarArrayDeploymentHandler(object_id_t setObjectId_,
object_id_t setObjectId_, object_id_t gpioDriverId_, CookieIF* gpioCookie_, GpioIF& gpioInterface,
PowerSwitchIF& mainLineSwitcher_, pcdu::Switches mainLineSwitch_, gpioId_t deplSA1, PowerSwitchIF& mainLineSwitcher_,
gpioId_t deplSA2) pcdu::Switches mainLineSwitch_,
gpioId_t deplSA1, gpioId_t deplSA2)
: SystemObject(setObjectId_), : SystemObject(setObjectId_),
gpioDriverId(gpioDriverId_), gpioInterface(gpioInterface),
gpioCookie(gpioCookie_),
deplSA1(deplSA1), deplSA1(deplSA1),
deplSA2(deplSA2), deplSA2(deplSA2),
mainLineSwitcher(mainLineSwitcher_), mainLineSwitcher(mainLineSwitcher_),
@ -38,19 +38,6 @@ ReturnValue_t SolarArrayDeploymentHandler::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
gpioInterface = ObjectManager::instance()->get<GpioIF>(gpioDriverId);
if (gpioInterface == nullptr) {
sif::error << "SolarArrayDeploymentHandler::initialize: Invalid Gpio interface." << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
result = gpioInterface->addGpios(dynamic_cast<GpioCookie*>(gpioCookie));
if (result != returnvalue::OK) {
sif::error << "SolarArrayDeploymentHandler::initialize: Failed to initialize Gpio interface"
<< 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;
@ -60,83 +47,85 @@ 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:
// deploymentTransistorsOn(); // 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" <<
// break; // std::endl; 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::deploymentTransistorsOn() { 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,
// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); // SWITCHING_DEPL_SA2_FAILED); mainLineSwitcher.sendSwitchCommand(mainLineSwitch,
// } // PowerSwitchIF::SWITCH_OFF);
// result = gpioInterface->pullHigh(deplSA2); // }
// if (result != returnvalue::OK) { // result = gpioInterface->pullHigh(deplSA2);
// sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar" // if (result != returnvalue::OK) {
// " array deployment switch 2 high " // sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
// << std::endl; // " array deployment switch 2 high "
// stateMachine = WAIT_ON_DELOYMENT_COMMAND; // << std::endl;
// triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED); // stateMachine = WAIT_ON_DELOYMENT_COMMAND;
// actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS, SWITCHING_DEPL_SA2_FAILED); // triggerEvent(DEPL_SA2_GPIO_SWTICH_ON_FAILED);
// mainLineSwitcher.sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF); // actionHelper.finish(false, rememberCommanderId, DEPLOY_SOLAR_ARRAYS,
// } // SWITCHING_DEPL_SA2_FAILED); mainLineSwitcher.sendSwitchCommand(mainLineSwitch,
//deploymentCountdown.setTimeout(burnTimeMs); // PowerSwitchIF::SWITCH_OFF);
//stateMachine = WAIT_ON_DEPLOYMENT_FINISH; // }
// deploymentCountdown.setTimeout(burnTimeMs);
// 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);
@ -174,20 +163,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;
} }

View File

@ -43,9 +43,9 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
* @param deplSA2 gpioId of the GPIO controlling the deployment 2 transistor. * @param deplSA2 gpioId of the GPIO controlling the deployment 2 transistor.
* @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, GpioIF& gpio,
CookieIF* gpioCookie, PowerSwitchIF& mainLineSwitcher, PowerSwitchIF& mainLineSwitcher, pcdu::Switches mainLineSwitch,
pcdu::Switches mainLineSwitch, gpioId_t deplSA1, gpioId_t deplSA2); gpioId_t deplSA1, gpioId_t deplSA2);
virtual ~SolarArrayDeploymentHandler(); virtual ~SolarArrayDeploymentHandler();
@ -71,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.
@ -90,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.
@ -100,17 +100,10 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
/** Size of command queue */ /** Size of command queue */
size_t cmdQueueSize = 20; size_t cmdQueueSize = 20;
GpioIF& gpioInterface;
/** The object ID of the GPIO driver which switches the deployment transistors */
object_id_t gpioDriverId;
CookieIF* gpioCookie;
gpioId_t deplSA1; gpioId_t deplSA1;
gpioId_t deplSA2; gpioId_t deplSA2;
GpioIF* gpioInterface = nullptr;
/** Queue to receive messages from other objects. */ /** Queue to receive messages from other objects. */
MessageQueueIF* commandQueue = nullptr; MessageQueueIF* commandQueue = nullptr;
@ -146,7 +139,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
* @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_ */