Small fixes
This commit is contained in:
parent
ef40db7fe4
commit
a91393b4b4
@ -104,13 +104,11 @@ void HeaterHandler::readCommandQueue() {
|
|||||||
} while (result == RETURN_OK);
|
} while (result == RETURN_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t HeaterHandler::executeAction(Action* action) {
|
ReturnValue_t HeaterHandler::executeAction(Action* action) { return action->handle(); }
|
||||||
return action->handle();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t HeaterHandler::handleAction(SetHeaterAction *heaterAction){
|
ReturnValue_t HeaterHandler::handleAction(SetHeaterAction* heaterAction) {
|
||||||
auto& heater = heaterVec.at(heaterAction->switchNr);
|
auto& heater = heaterVec.at(heaterAction->switchNr);
|
||||||
auto action = heaterAction->switchAction;
|
auto action = heaterAction->switchAction;
|
||||||
// Always accepts OFF commands
|
// Always accepts OFF commands
|
||||||
if (action == SetHeaterAction::SwitchAction::SET_SWITCH_ON) {
|
if (action == SetHeaterAction::SwitchAction::SET_SWITCH_ON) {
|
||||||
HasHealthIF::HealthState health = heater.healthDevice->getHealth();
|
HasHealthIF::HealthState health = heater.healthDevice->getHealth();
|
||||||
@ -119,7 +117,8 @@ ReturnValue_t HeaterHandler::executeAction(Action* action) {
|
|||||||
return HasHealthIF::OBJECT_NOT_HEALTHY;
|
return HasHealthIF::OBJECT_NOT_HEALTHY;
|
||||||
}
|
}
|
||||||
auto cmdSource = heaterAction->cmdSource;
|
auto cmdSource = heaterAction->cmdSource;
|
||||||
if (health == HasHealthIF::EXTERNAL_CONTROL and cmdSource == SetHeaterAction::CmdSourceParam::INTERNAL) {
|
if (health == HasHealthIF::EXTERNAL_CONTROL and
|
||||||
|
cmdSource == SetHeaterAction::CmdSourceParam::INTERNAL) {
|
||||||
return HasHealthIF::IS_EXTERNALLY_CONTROLLED;
|
return HasHealthIF::IS_EXTERNALLY_CONTROLLED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +130,7 @@ ReturnValue_t HeaterHandler::executeAction(Action* action) {
|
|||||||
heater.cmdActive = true;
|
heater.cmdActive = true;
|
||||||
heater.replyQueue = heaterAction->commandedBy;
|
heater.replyQueue = heaterAction->commandedBy;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
|
ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
@ -157,7 +156,8 @@ ReturnValue_t HeaterHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t o
|
|||||||
result = ipcStore->addData(&storeAddress, commandData, sizeof(commandData));
|
result = ipcStore->addData(&storeAddress, commandData, sizeof(commandData));
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
ActionMessage::setCommand(&message, static_cast<ActionId_t>(HeaterCommands::SWITCH_HEATER), storeAddress);
|
ActionMessage::setCommand(&message, static_cast<ActionId_t>(HeaterCommands::SWITCH_HEATER),
|
||||||
|
storeAddress);
|
||||||
/* Send heater command to own command queue */
|
/* Send heater command to own command queue */
|
||||||
result = commandQueue->sendMessage(commandQueue->getId(), &message, 0);
|
result = commandQueue->sendMessage(commandQueue->getId(), &message, 0);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
@ -211,7 +211,8 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
|||||||
heater.cmdActive = false;
|
heater.cmdActive = false;
|
||||||
heater.waitMainSwitchOn = false;
|
heater.waitMainSwitchOn = false;
|
||||||
if (heater.replyQueue != commandQueue->getId()) {
|
if (heater.replyQueue != commandQueue->getId()) {
|
||||||
actionHelper.finish(false, heater.replyQueue, static_cast<ActionId_t>(heater.action), MAIN_SWITCH_SET_TIMEOUT);
|
actionHelper.finish(false, heater.replyQueue, static_cast<ActionId_t>(heater.action),
|
||||||
|
MAIN_SWITCH_SET_TIMEOUT);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -237,9 +238,11 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
|||||||
// HeaterHandler itself
|
// HeaterHandler itself
|
||||||
if (heater.replyQueue != commandQueue->getId()) {
|
if (heater.replyQueue != commandQueue->getId()) {
|
||||||
if (result == RETURN_OK) {
|
if (result == RETURN_OK) {
|
||||||
actionHelper.finish(true, heater.replyQueue, static_cast<ActionId_t>(heater.action), result);
|
actionHelper.finish(true, heater.replyQueue, static_cast<ActionId_t>(heater.action),
|
||||||
|
result);
|
||||||
} else {
|
} else {
|
||||||
actionHelper.finish(false, heater.replyQueue, static_cast<ActionId_t>(heater.action), result);
|
actionHelper.finish(false, heater.replyQueue, static_cast<ActionId_t>(heater.action),
|
||||||
|
result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
heater.cmdActive = false;
|
heater.cmdActive = false;
|
||||||
@ -255,7 +258,8 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
|||||||
sif::debug << "HeaterHandler::handleSwitchHandling: Failed to get state of"
|
sif::debug << "HeaterHandler::handleSwitchHandling: Failed to get state of"
|
||||||
<< " main line switch" << std::endl;
|
<< " main line switch" << std::endl;
|
||||||
if (heater.replyQueue != commandQueue->getId()) {
|
if (heater.replyQueue != commandQueue->getId()) {
|
||||||
actionHelper.finish(false, heater.replyQueue, static_cast<ActionId_t>(heater.action), mainSwitchState);
|
actionHelper.finish(false, heater.replyQueue, static_cast<ActionId_t>(heater.action),
|
||||||
|
mainSwitchState);
|
||||||
}
|
}
|
||||||
heater.cmdActive = false;
|
heater.cmdActive = false;
|
||||||
}
|
}
|
||||||
@ -316,6 +320,8 @@ bool HeaterHandler::allSwitchesOff() {
|
|||||||
|
|
||||||
MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); }
|
MessageQueueId_t HeaterHandler::getCommandQueue() const { return commandQueue->getId(); }
|
||||||
|
|
||||||
|
ActionHelper* HeaterHandler::getActionHelper() { return &actionHelper; }
|
||||||
|
|
||||||
ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; }
|
ReturnValue_t HeaterHandler::sendFuseOnCommand(uint8_t fuseNr) { return RETURN_OK; }
|
||||||
|
|
||||||
ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const {
|
ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const {
|
||||||
|
@ -66,8 +66,10 @@ class HeaterHandler : public ExecutableObjectIF,
|
|||||||
uint32_t getSwitchDelayMs(void) const override;
|
uint32_t getSwitchDelayMs(void) const override;
|
||||||
|
|
||||||
MessageQueueId_t getCommandQueue() const override;
|
MessageQueueId_t getCommandQueue() const override;
|
||||||
|
ActionHelper* getActionHelper() override;
|
||||||
ReturnValue_t executeAction(Action* action) override;
|
ReturnValue_t executeAction(Action* action) override;
|
||||||
ReturnValue_t handleAction(SetHeaterAction *heaterAction);
|
ReturnValue_t handleAction(SetHeaterAction *heaterAction);
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -111,8 +111,10 @@ void SolarArrayDeploymentHandler::performWaitOn8VActions() {
|
|||||||
} else {
|
} else {
|
||||||
if (mainSwitchCountdown.hasTimedOut()) {
|
if (mainSwitchCountdown.hasTimedOut()) {
|
||||||
triggerEvent(MAIN_SWITCH_ON_TIMEOUT);
|
triggerEvent(MAIN_SWITCH_ON_TIMEOUT);
|
||||||
actionHelper.finish(false, rememberCommanderId, static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS),
|
actionHelper.finish(
|
||||||
MAIN_SWITCH_TIMEOUT_FAILURE);
|
false, rememberCommanderId,
|
||||||
|
static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS),
|
||||||
|
MAIN_SWITCH_TIMEOUT_FAILURE);
|
||||||
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
stateMachine = WAIT_ON_DELOYMENT_COMMAND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +131,10 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
|
|||||||
* 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, static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS), SWITCHING_DEPL_SA1_FAILED);
|
actionHelper.finish(
|
||||||
|
false, rememberCommanderId,
|
||||||
|
static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS),
|
||||||
|
SWITCHING_DEPL_SA1_FAILED);
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_OFF);
|
||||||
}
|
}
|
||||||
result = gpioInterface->pullHigh(deplSA2);
|
result = gpioInterface->pullHigh(deplSA2);
|
||||||
@ -139,7 +144,10 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
|
|||||||
<< 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, static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS), SWITCHING_DEPL_SA2_FAILED);
|
actionHelper.finish(
|
||||||
|
false, rememberCommanderId,
|
||||||
|
static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::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);
|
||||||
@ -149,7 +157,10 @@ void SolarArrayDeploymentHandler::switchDeploymentTransistors() {
|
|||||||
void SolarArrayDeploymentHandler::handleDeploymentFinish() {
|
void SolarArrayDeploymentHandler::handleDeploymentFinish() {
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = RETURN_OK;
|
||||||
if (deploymentCountdown.hasTimedOut()) {
|
if (deploymentCountdown.hasTimedOut()) {
|
||||||
actionHelper.finish(true, rememberCommanderId, static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS), RETURN_OK);
|
actionHelper.finish(
|
||||||
|
true, rememberCommanderId,
|
||||||
|
static_cast<DeviceCommandId_t>(SolarArrayDeploymentCommands::DEPLOY_SOLAR_ARRAYS),
|
||||||
|
RETURN_OK);
|
||||||
result = gpioInterface->pullLow(deplSA1);
|
result = gpioInterface->pullLow(deplSA1);
|
||||||
if (result != RETURN_OK) {
|
if (result != RETURN_OK) {
|
||||||
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
sif::debug << "SolarArrayDeploymentHandler::handleStateMachine: Failed to pull solar"
|
||||||
@ -187,7 +198,7 @@ ReturnValue_t SolarArrayDeploymentHandler::executeAction(Action* action) {
|
|||||||
<< "waiting-on-command-state" << std::endl;
|
<< "waiting-on-command-state" << std::endl;
|
||||||
return DEPLOYMENT_ALREADY_EXECUTING;
|
return DEPLOYMENT_ALREADY_EXECUTING;
|
||||||
}
|
}
|
||||||
//delegates to SolarArrayDeploymentHandler::handleAction()
|
// delegates to SolarArrayDeploymentHandler::handleAction()
|
||||||
return action->handle();
|
return action->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,3 +211,5 @@ ReturnValue_t SolarArrayDeploymentHandler::handleAction(SolarArrayDeploymentActi
|
|||||||
MessageQueueId_t SolarArrayDeploymentHandler::getCommandQueue() const {
|
MessageQueueId_t SolarArrayDeploymentHandler::getCommandQueue() const {
|
||||||
return commandQueue->getId();
|
return commandQueue->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActionHelper* SolarArrayDeploymentHandler::getActionHelper() { return &actionHelper; }
|
||||||
|
@ -50,6 +50,7 @@ class SolarArrayDeploymentHandler : public ExecutableObjectIF,
|
|||||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||||
|
|
||||||
virtual MessageQueueId_t getCommandQueue() const override;
|
virtual MessageQueueId_t getCommandQueue() const override;
|
||||||
|
virtual ActionHelper *getActionHelper() override;
|
||||||
virtual ReturnValue_t executeAction(Action* action) override;
|
virtual ReturnValue_t executeAction(Action* action) override;
|
||||||
ReturnValue_t handleAction(SolarArrayDeploymentAction* action);
|
ReturnValue_t handleAction(SolarArrayDeploymentAction* action);
|
||||||
virtual ReturnValue_t initialize() override;
|
virtual ReturnValue_t initialize() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user