Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -rf9c0896317f27b4fe62fc51c3938b242a40d69ce -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision f9c0896317f27b4fe62fc51c3938b242a40d69ce) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file Valves.c * -* @author (last) Bill Bracken -* @date (last) 12-May-2023 +* @author (last) Dara Navaei +* @date (last) 17-Oct-2023 * * @author (original) Dara Navaei * @date (original) 07-Aug-2020 @@ -19,7 +19,7 @@ #include "reg_het.h" #include "gio.h" -#include "Battery.h" +#include "CPLD.h" #include "FPGA.h" #include "MessageSupport.h" #include "NVDataMgmt.h" @@ -272,7 +272,9 @@ static VALVE_STATE_T handleValveStateHomingFindDeenergizedEdge( VALVE_T valve ); static VALVE_STATE_T handleValveStateIdle( VALVE_T valve ); static VALVE_STATE_T handleValveStateInTransition( VALVE_T valve ); +#ifdef DEBUG_ENABLED static VALVE_STATE_T handleValveStateInBypassMode( VALVE_T valve ); +#endif // Private function prototypes static void setValveControlMode( VALVE_T valve, VALVE_MODE_T mode ); @@ -925,7 +927,7 @@ state = VALVE_STATE_IDLE; } // Check if the valve's transition time has timed out - else if ( ( TRUE == didTimeout( valvesStatus[ valve ].transitionStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && ( FALSE == isACPowerLost() ) ) + else if ( ( TRUE == didTimeout( valvesStatus[ valve ].transitionStartTime, VALVE_TRANSITION_TIMEOUT_MS ) ) && ( getCPLDACPowerLossDetected() != TRUE ) ) { // Go back to Idle state and set the valve position to not in position because it was not able to get to the target position valvesStatus[ valve ].currentPosition = VALVE_POSITION_NOT_IN_POSITION; @@ -1081,7 +1083,7 @@ position &= DISABLE_VALVE_CURRENT_RELAXATION; // If current relaxation is needed, set the MSB to 1 - if ( enableCurrentRelaxation ) + if ( TRUE == enableCurrentRelaxation ) { position |= ENABLE_VALVE_CURRENT_RELAXATION; } @@ -1187,7 +1189,7 @@ for ( valve = VDI; valve < NUM_OF_VALVES; valve++ ) { // Check the valve is in Idle state, otherwise the position should not be checked - if ( ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) && ( FALSE == isACPowerLost() ) ) + if ( ( valvesStatus[ valve ].execState == VALVE_STATE_IDLE ) && ( getCPLDACPowerLossDetected() != TRUE ) ) { U32 maxDeviation = MAX_DEVIATION_FROM_TARGET_IN_COUNTS;