Disable Order Check PL PCDU #825

Merged
muellerr merged 10 commits from disable-order-check-plpcdu into main 2023-11-29 15:13:58 +01:00
3 changed files with 52 additions and 33 deletions
Showing only changes of commit ed8f2c75bf - Show all commits

View File

@ -590,6 +590,9 @@ ReturnValue_t PayloadPcduHandler::checkModeCommand(Mode_t commandedMode, Submode
ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) { ReturnValue_t PayloadPcduHandler::isModeCombinationValid(Mode_t mode, Submode_t submode) {
using namespace plpcdu; using namespace plpcdu;
if (mode == MODE_NORMAL) { if (mode == MODE_NORMAL) {
if (disableChannelOrderCheck) {
return returnvalue::OK;
}
uint8_t dhbSubmode = getSubmode(); uint8_t dhbSubmode = getSubmode();
diffMask = submode ^ dhbSubmode; diffMask = submode ^ dhbSubmode;
// Also deals with the case where the mode is MODE_ON, submode should be 0 here // Also deals with the case where the mode is MODE_ON, submode should be 0 here
@ -637,56 +640,68 @@ ReturnValue_t PayloadPcduHandler::getParameter(uint8_t domainId, uint8_t uniqueI
uint16_t startAtIndex) { uint16_t startAtIndex) {
using namespace plpcdu; using namespace plpcdu;
switch (uniqueId) { switch (uniqueId) {
case (PlPcduParamIds::NEG_V_LOWER_BOUND): case (PlPcduParamId::NEG_V_LOWER_BOUND):
case (PlPcduParamIds::NEG_V_UPPER_BOUND): case (PlPcduParamId::NEG_V_UPPER_BOUND):
case (PlPcduParamIds::DRO_U_LOWER_BOUND): case (PlPcduParamId::DRO_U_LOWER_BOUND):
case (PlPcduParamIds::DRO_U_UPPER_BOUND): case (PlPcduParamId::DRO_U_UPPER_BOUND):
case (PlPcduParamIds::DRO_I_UPPER_BOUND): case (PlPcduParamId::DRO_I_UPPER_BOUND):
case (PlPcduParamIds::X8_U_LOWER_BOUND): case (PlPcduParamId::X8_U_LOWER_BOUND):
case (PlPcduParamIds::X8_U_UPPER_BOUND): case (PlPcduParamId::X8_U_UPPER_BOUND):
case (PlPcduParamIds::X8_I_UPPER_BOUND): case (PlPcduParamId::X8_I_UPPER_BOUND):
case (PlPcduParamIds::TX_U_LOWER_BOUND): case (PlPcduParamId::TX_U_LOWER_BOUND):
case (PlPcduParamIds::TX_U_UPPER_BOUND): case (PlPcduParamId::TX_U_UPPER_BOUND):
case (PlPcduParamIds::TX_I_UPPER_BOUND): case (PlPcduParamId::TX_I_UPPER_BOUND):
case (PlPcduParamIds::MPA_U_LOWER_BOUND): case (PlPcduParamId::MPA_U_LOWER_BOUND):
case (PlPcduParamIds::MPA_U_UPPER_BOUND): case (PlPcduParamId::MPA_U_UPPER_BOUND):
case (PlPcduParamIds::MPA_I_UPPER_BOUND): case (PlPcduParamId::MPA_I_UPPER_BOUND):
case (PlPcduParamIds::HPA_U_LOWER_BOUND): case (PlPcduParamId::HPA_U_LOWER_BOUND):
case (PlPcduParamIds::HPA_U_UPPER_BOUND): case (PlPcduParamId::HPA_U_UPPER_BOUND):
case (PlPcduParamIds::HPA_I_UPPER_BOUND): case (PlPcduParamId::HPA_I_UPPER_BOUND):
case (PlPcduParamIds::SSR_TO_DRO_WAIT_TIME): case (PlPcduParamId::SSR_TO_DRO_WAIT_TIME):
case (PlPcduParamIds::DRO_TO_X8_WAIT_TIME): case (PlPcduParamId::DRO_TO_X8_WAIT_TIME):
case (PlPcduParamIds::X8_TO_TX_WAIT_TIME): case (PlPcduParamId::X8_TO_TX_WAIT_TIME):
case (PlPcduParamIds::TX_TO_MPA_WAIT_TIME): case (PlPcduParamId::TX_TO_MPA_WAIT_TIME):
case (PlPcduParamIds::MPA_TO_HPA_WAIT_TIME): { case (PlPcduParamId::MPA_TO_HPA_WAIT_TIME): {
handleDoubleParamUpdate(PARAM_KEY_MAP[static_cast<PlPcduParamIds>(uniqueId)], handleDoubleParamUpdate(PARAM_KEY_MAP[static_cast<PlPcduParamId>(uniqueId)], parameterWrapper,
parameterWrapper, newValues); newValues);
break; break;
} }
case (PlPcduParamIds::INJECT_SSR_TO_DRO_FAILURE): { case (PlPcduParamId::INJECT_SSR_TO_DRO_FAILURE): {
ssrToDroInjectionRequested = true; ssrToDroInjectionRequested = true;
break; break;
} }
case (PlPcduParamIds::INJECT_DRO_TO_X8_FAILURE): { case (PlPcduParamId::INJECT_DRO_TO_X8_FAILURE): {
droToX8InjectionRequested = true; droToX8InjectionRequested = true;
break; break;
} }
case (PlPcduParamIds::INJECT_X8_TO_TX_FAILURE): { case (PlPcduParamId::INJECT_X8_TO_TX_FAILURE): {
x8ToTxInjectionRequested = true; x8ToTxInjectionRequested = true;
break; break;
} }
case (PlPcduParamIds::INJECT_TX_TO_MPA_FAILURE): { case (PlPcduParamId::INJECT_TX_TO_MPA_FAILURE): {
txToMpaInjectionRequested = true; txToMpaInjectionRequested = true;
break; break;
} }
case (PlPcduParamIds::INJECT_MPA_TO_HPA_FAILURE): { case (PlPcduParamId::INJECT_MPA_TO_HPA_FAILURE): {
mpaToHpaInjectionRequested = true; mpaToHpaInjectionRequested = true;
break; break;
} }
case (PlPcduParamIds::INJECT_ALL_ON_FAILURE): { case (PlPcduParamId::INJECT_ALL_ON_FAILURE): {
allOnInjectRequested = true; allOnInjectRequested = true;
break; break;
} }
case (PlPcduParamId::DISABLE_ORDER_CHECK_CHANNELS): {
uint8_t newValue = 0;
ReturnValue_t result = newValues->getElement(&newValue);
if (result != returnvalue::OK) {
return result;
}
if(newValue > 1) {
return HasParametersIF::INVALID_VALUE;
}
parameterWrapper->set(&disableChannelOrderCheck);
break;
}
default: { default: {
return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues, return DeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues,
startAtIndex); startAtIndex);

View File

@ -137,6 +137,8 @@ class PayloadPcduHandler : public DeviceHandlerBase {
PoolEntry<float>({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}); PoolEntry<float>({0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
PoolEntry<float> tempC = PoolEntry<float>({0.0}); PoolEntry<float> tempC = PoolEntry<float>({0.0});
uint8_t disableChannelOrderCheck = false;
void updateSwitchGpio(gpioId_t id, gpio::Levels level); void updateSwitchGpio(gpioId_t id, gpio::Levels level);
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;

View File

@ -35,7 +35,7 @@ enum PlPcduAdcChannels : uint8_t {
NUM_CHANNELS = 12 NUM_CHANNELS = 12
}; };
enum PlPcduParamIds : uint8_t { enum PlPcduParamId : uint8_t {
NEG_V_LOWER_BOUND = 0, NEG_V_LOWER_BOUND = 0,
NEG_V_UPPER_BOUND = 1, NEG_V_UPPER_BOUND = 1,
DRO_U_LOWER_BOUND = 2, DRO_U_LOWER_BOUND = 2,
@ -65,10 +65,12 @@ enum PlPcduParamIds : uint8_t {
INJECT_X8_TO_TX_FAILURE = 32, INJECT_X8_TO_TX_FAILURE = 32,
INJECT_TX_TO_MPA_FAILURE = 33, INJECT_TX_TO_MPA_FAILURE = 33,
INJECT_MPA_TO_HPA_FAILURE = 34, INJECT_MPA_TO_HPA_FAILURE = 34,
INJECT_ALL_ON_FAILURE = 35 INJECT_ALL_ON_FAILURE = 35,
DISABLE_ORDER_CHECK_CHANNELS = 40
}; };
static std::map<PlPcduParamIds, std::string> PARAM_KEY_MAP = { static std::map<PlPcduParamId, std::string> PARAM_KEY_MAP = {
{NEG_V_LOWER_BOUND, "negVoltLowerBound"}, {NEG_V_UPPER_BOUND, "negVoltUpperBound"}, {NEG_V_LOWER_BOUND, "negVoltLowerBound"}, {NEG_V_UPPER_BOUND, "negVoltUpperBound"},
{DRO_U_LOWER_BOUND, "droVoltLowerBound"}, {DRO_U_UPPER_BOUND, "droVoltUpperBound"}, {DRO_U_LOWER_BOUND, "droVoltLowerBound"}, {DRO_U_UPPER_BOUND, "droVoltUpperBound"},
{DRO_I_UPPER_BOUND, "droCurrUpperBound"}, {X8_U_LOWER_BOUND, "x8VoltLowerBound"}, {DRO_I_UPPER_BOUND, "droCurrUpperBound"}, {X8_U_LOWER_BOUND, "x8VoltLowerBound"},