Merge pull request 'Dual Lane Boards: Allow Side Switches' (#412) from feature_allow_side_switch into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #412
This commit is contained in:
commit
61c26fe53a
@ -35,6 +35,7 @@ will consitute of a breaking change warranting a new major release:
|
||||
- STR: Fix weird issues on datalink layer data reception which sometimes occur.
|
||||
- Syrlinks FDIR: Fully allow FDIR to do more recoveries. Assembly should take care of preventing
|
||||
the switch to go off.
|
||||
- Allow dual lane assembly side switches.
|
||||
|
||||
## Changed
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 279 translations.
|
||||
* @details
|
||||
* Generated on: 2023-03-24 20:58:22
|
||||
* Generated on: 2023-03-24 21:09:31
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -212,8 +212,7 @@ const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING = "SIDE_SWITCH_TRANSITION_
|
||||
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
|
||||
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
|
||||
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
|
||||
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING =
|
||||
"SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
||||
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
||||
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
|
||||
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
|
||||
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 169 translations.
|
||||
* Generated on: 2023-03-24 20:58:22
|
||||
* Generated on: 2023-03-24 21:09:31
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 279 translations.
|
||||
* @details
|
||||
* Generated on: 2023-03-24 20:58:22
|
||||
* Generated on: 2023-03-24 21:09:31
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 173 translations.
|
||||
* Generated on: 2023-03-24 20:58:22
|
||||
* Generated on: 2023-03-24 21:09:31
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @brief Auto-generated event translation file. Contains 279 translations.
|
||||
* @details
|
||||
* Generated on: 2023-03-24 20:58:22
|
||||
* Generated on: 2023-03-24 21:09:31
|
||||
*/
|
||||
#include "translateEvents.h"
|
||||
|
||||
@ -212,8 +212,7 @@ const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_STRING = "SIDE_SWITCH_TRANSITION_
|
||||
const char *TRANSITION_OTHER_SIDE_FAILED_12900_STRING = "TRANSITION_OTHER_SIDE_FAILED_12900";
|
||||
const char *NOT_ENOUGH_DEVICES_DUAL_MODE_12901_STRING = "NOT_ENOUGH_DEVICES_DUAL_MODE_12901";
|
||||
const char *POWER_STATE_MACHINE_TIMEOUT_12902_STRING = "POWER_STATE_MACHINE_TIMEOUT_12902";
|
||||
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING =
|
||||
"SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
||||
const char *SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903_STRING = "SIDE_SWITCH_TRANSITION_NOT_ALLOWED_12903";
|
||||
const char *CHILDREN_LOST_MODE_STRING = "CHILDREN_LOST_MODE";
|
||||
const char *GPS_FIX_CHANGE_STRING = "GPS_FIX_CHANGE";
|
||||
const char *CANT_GET_FIX_STRING = "CANT_GET_FIX";
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 173 translations.
|
||||
* Generated on: 2023-03-24 20:58:22
|
||||
* Generated on: 2023-03-24 21:09:31
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
|
@ -110,27 +110,25 @@ ReturnValue_t AcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
|
||||
using namespace duallane;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
bool needsSecondStep = false;
|
||||
if (sideSwitchState == SideSwitchState::REQUESTED) {
|
||||
sideSwitchState = SideSwitchState::TO_DUAL;
|
||||
}
|
||||
// Switch to dual side first, and later switch back to the otherside
|
||||
if (sideSwitchState == SideSwitchState::TO_DUAL) {
|
||||
targetSubmodeForSideSwitch = static_cast<duallane::Submodes>(submode);
|
||||
submode = Submodes::DUAL_MODE;
|
||||
sideSwitchState = SideSwitchState::DISABLE_OTHER_SIDE;
|
||||
// TODO: Ugly hack. The base class should support arbitrary number of steps..
|
||||
needsSecondStep = true;
|
||||
} else if (sideSwitchState == SideSwitchState::DISABLE_OTHER_SIDE) {
|
||||
submode = targetSubmodeForSideSwitch;
|
||||
}
|
||||
auto cmdSeq = [&](object_id_t objectId, Mode_t devMode, ModeTableIdx tableIdx) {
|
||||
if (mode == devMode) {
|
||||
modeTable[tableIdx].setMode(mode);
|
||||
} else if (mode == DeviceHandlerIF::MODE_NORMAL) {
|
||||
if (isUseable(objectId, devMode)) {
|
||||
if (devMode == MODE_ON) {
|
||||
modeTable[tableIdx].setMode(mode);
|
||||
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
||||
} else {
|
||||
modeTable[tableIdx].setMode(MODE_ON);
|
||||
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
||||
if (internalState != STATE_SECOND_STEP) {
|
||||
needsSecondStep = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mode == MODE_ON) {
|
||||
if (isUseable(objectId, devMode)) {
|
||||
modeTable[tableIdx].setMode(MODE_ON);
|
||||
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
||||
}
|
||||
} else if (isUseable(objectId, devMode)) {
|
||||
modeTable[tableIdx].setMode(mode);
|
||||
modeTable[tableIdx].setSubmode(SUBMODE_NONE);
|
||||
}
|
||||
};
|
||||
bool gpsUsable = isUseable(helper.gpsId, helper.gpsMode);
|
||||
|
@ -36,6 +36,7 @@ void DualLaneAssemblyBase::performChildOperation() {
|
||||
void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
|
||||
using namespace duallane;
|
||||
pwrStateMachine.reset();
|
||||
|
||||
if (mode != MODE_OFF) {
|
||||
// Special exception: A transition from dual side to single mode must be handled like
|
||||
// going OFF.
|
||||
@ -45,9 +46,13 @@ void DualLaneAssemblyBase::startTransition(Mode_t mode, Submode_t submode) {
|
||||
AssemblyBase::startTransition(mode, submode);
|
||||
return;
|
||||
}
|
||||
uint8_t pwrSubmode = submode;
|
||||
if (sideSwitchState == SideSwitchState::REQUESTED) {
|
||||
pwrSubmode = duallane::DUAL_MODE;
|
||||
}
|
||||
// If anything other than MODE_OFF is commanded, perform power state machine first
|
||||
// Cache the target modes, required by power state machine
|
||||
pwrStateMachine.start(mode, submode);
|
||||
pwrStateMachine.start(mode, pwrSubmode);
|
||||
// Cache these for later after the power state machine has finished
|
||||
targetMode = mode;
|
||||
targetSubmode = submode;
|
||||
@ -111,11 +116,7 @@ ReturnValue_t DualLaneAssemblyBase::isModeCombinationValid(Mode_t mode, Submode_
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
if (sideSwitchTransition(mode, submode)) {
|
||||
// I could implement this but this would increase the already high complexity. This is not
|
||||
// necessary. The operator should can send a command to switch the assembly off first and
|
||||
// then send a command to turn on the other side, either to ON or to NORMAL
|
||||
triggerEvent(SIDE_SWITCH_TRANSITION_NOT_ALLOWED_ID, 0, 0);
|
||||
return TRANS_NOT_ALLOWED;
|
||||
sideSwitchState = SideSwitchState::REQUESTED;
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -231,9 +232,8 @@ bool DualLaneAssemblyBase::sideSwitchTransition(Mode_t mode, Submode_t submode)
|
||||
return false;
|
||||
}
|
||||
if (this->mode == MODE_ON or this->mode == DeviceHandlerIF::MODE_NORMAL) {
|
||||
if (this->submode == Submodes::A_SIDE and submode == Submodes::B_SIDE) {
|
||||
return true;
|
||||
} else if (this->submode == Submodes::B_SIDE and submode == Submodes::A_SIDE) {
|
||||
if ((this->submode == Submodes::A_SIDE and submode == Submodes::B_SIDE) or
|
||||
(this->submode == Submodes::B_SIDE and submode == Submodes::A_SIDE)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -247,6 +247,7 @@ void DualLaneAssemblyBase::finishModeOp() {
|
||||
pwrStateMachine.reset();
|
||||
powerRetryCounter = 0;
|
||||
tryingOtherSide = false;
|
||||
sideSwitchState = SideSwitchState::NONE;
|
||||
dualToSingleSideTransition = false;
|
||||
dualModeErrorSwitch = true;
|
||||
}
|
||||
|
@ -34,6 +34,11 @@ class DualLaneAssemblyBase : public AssemblyBase, public ConfirmsFailuresIF {
|
||||
bool dualToSingleSideTransition = false;
|
||||
duallane::Submodes defaultSubmode = duallane::Submodes::A_SIDE;
|
||||
|
||||
enum SideSwitchState { NONE, REQUESTED, TO_DUAL, DISABLE_OTHER_SIDE };
|
||||
|
||||
SideSwitchState sideSwitchState = SideSwitchState::NONE;
|
||||
duallane::Submodes targetSubmodeForSideSwitch = duallane::Submodes::B_SIDE;
|
||||
|
||||
enum RecoveryCustomStates {
|
||||
IDLE,
|
||||
POWER_SWITCHING_OFF,
|
||||
|
Loading…
Reference in New Issue
Block a user