diff --git a/mission/payload/PayloadPcduHandler.cpp b/mission/payload/PayloadPcduHandler.cpp index 2ec12fc0..b3f35897 100644 --- a/mission/payload/PayloadPcduHandler.cpp +++ b/mission/payload/PayloadPcduHandler.cpp @@ -419,33 +419,13 @@ void PayloadPcduHandler::checkAdcValues() { return; } // Now check against voltage and current limits. - if (ssrToDroInjectionRequested) { - handleFailureInjection("SSR to DRO", NEG_V_OUT_OF_BOUNDS); - ssrToDroInjectionRequested = false; - return; - } - if (droToX8InjectionRequested) { - handleFailureInjection("X8 to TX", U_X8_OUT_OF_BOUNDS); - droToX8InjectionRequested = false; - return; - } - if (txToMpaInjectionRequested) { - handleFailureInjection("TX to MPA", U_TX_OUT_OF_BOUNDS); - txToMpaInjectionRequested = false; - return; - } - if (mpaToHpaInjectionRequested) { - handleFailureInjection("MPA to HPA", U_HPA_OUT_OF_BOUNDS); - mpaToHpaInjectionRequested = false; - return; - } - if (allOnInjectRequested) { - handleFailureInjection("All On", U_HPA_OUT_OF_BOUNDS); - allOnInjectRequested = false; - return; - } uint8_t submode = getSubmode(); if (((submode >> NormalSubmodeBits::DRO_ON) & 0b1) == 0b1) { + if (ssrToDroInjectionRequested) { + handleFailureInjection("SSR to DRO", NEG_V_OUT_OF_BOUNDS); + ssrToDroInjectionRequested = false; + return; + } params.getValue(PARAM_KEY_MAP[NEG_V_LOWER_BOUND], lowerBound); params.getValue(PARAM_KEY_MAP[NEG_V_UPPER_BOUND], upperBound); if (not checkVoltage(adcSet.processed[U_NEG_V_FB], lowerBound, upperBound, @@ -468,6 +448,11 @@ void PayloadPcduHandler::checkAdcValues() { } } if (((submode >> NormalSubmodeBits::X8_ON) & 0b1) == 0b1) { + if (droToX8InjectionRequested) { + handleFailureInjection("X8 to TX", U_X8_OUT_OF_BOUNDS); + droToX8InjectionRequested = false; + return; + } params.getValue(PARAM_KEY_MAP[X8_U_LOWER_BOUND], lowerBound); params.getValue(PARAM_KEY_MAP[X8_U_UPPER_BOUND], upperBound); if (not checkVoltage(adcSet.processed[U_X8_DIV_6], lowerBound, upperBound, @@ -480,6 +465,11 @@ void PayloadPcduHandler::checkAdcValues() { } } if (((submode >> NormalSubmodeBits::TX_ON) & 0b1) == 0b1) { + if (txToMpaInjectionRequested) { + handleFailureInjection("TX to MPA", U_TX_OUT_OF_BOUNDS); + txToMpaInjectionRequested = false; + return; + } params.getValue(PARAM_KEY_MAP[TX_U_LOWER_BOUND], lowerBound); params.getValue(PARAM_KEY_MAP[TX_U_UPPER_BOUND], upperBound); if (not checkVoltage(adcSet.processed[U_TX_DIV_6], lowerBound, upperBound, @@ -492,6 +482,11 @@ void PayloadPcduHandler::checkAdcValues() { } } if (((submode >> NormalSubmodeBits::MPA_ON) & 0b1) == 0b1) { + if (mpaToHpaInjectionRequested) { + handleFailureInjection("MPA to HPA", U_HPA_OUT_OF_BOUNDS); + mpaToHpaInjectionRequested = false; + return; + } params.getValue(PARAM_KEY_MAP[MPA_U_LOWER_BOUND], lowerBound); params.getValue(PARAM_KEY_MAP[MPA_U_UPPER_BOUND], upperBound); if (not checkVoltage(adcSet.processed[U_MPA_DIV_6], lowerBound, upperBound, @@ -504,6 +499,11 @@ void PayloadPcduHandler::checkAdcValues() { } } if (((submode >> NormalSubmodeBits::HPA_ON) & 0b1) == 0b1) { + if (allOnInjectRequested) { + handleFailureInjection("All On", U_HPA_OUT_OF_BOUNDS); + allOnInjectRequested = false; + return; + } params.getValue(PARAM_KEY_MAP[HPA_U_LOWER_BOUND], lowerBound); params.getValue(PARAM_KEY_MAP[HPA_U_UPPER_BOUND], upperBound); if (not checkVoltage(adcSet.processed[U_HPA_DIV_6], lowerBound, upperBound,