Index: firmware/App/Controllers/DrainPump.c =================================================================== diff -u -r03647e275b3c1e55196be2bbeb733fd51f3b0a00 -r6499ea25921fcf67826fa0c35bb03caf411ba542 --- firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 03647e275b3c1e55196be2bbeb733fd51f3b0a00) +++ firmware/App/Controllers/DrainPump.c (.../DrainPump.c) (revision 6499ea25921fcf67826fa0c35bb03caf411ba542) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2020-2022 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2023 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 DrainPump.c * * @author (last) Dara Navaei -* @date (last) 12-Oct-2022 +* @date (last) 03-Nov-2022 * * @author (original) Sean * @date (original) 08-Apr-2020 @@ -33,6 +33,7 @@ #include "TaskGeneral.h" #include "TaskPriority.h" #include "Timers.h" +#include "Utilities.h" #include "Valves.h" /** @@ -365,7 +366,7 @@ #endif { #ifndef _RELEASE_ - if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) != SW_CONFIG_ENABLE_VALUE ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) + if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) #endif { checkFPGAPersistentErrorCountAlarm( FPGA_PERS_ERROR_DRAIN_PUMP_DIR_HALL_SENSOR, dirHallSensorErrorCount ); @@ -388,7 +389,7 @@ } #ifndef _RELEASE_ - if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) != SW_CONFIG_ENABLE_VALUE ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) + if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) #endif { checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_CURRENT_OUT_OF_RANGE, isOffCurrentOut, currentA, DRAIN_PUMP_MAX_CURRENT_WHEN_OFF_A ); @@ -409,7 +410,7 @@ checkPersistentAlarm( ALARM_ID_DRAIN_PUMP_OFF_FAULT, FALSE, getDrainPumpMeasuredRPM(), MIN_DRAIN_PUMP_RPM ); #ifndef _RELEASE_ - if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) != SW_CONFIG_ENABLE_VALUE ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) + if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) #endif { checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_DIRECTION_INVALID, isDirInvalid, (F32)direction, DRAIN_PUMP_FORWARD_DIR ); @@ -423,7 +424,7 @@ BOOL isDirInvalid = ( direction != DRAIN_PUMP_FORWARD_DIR ? TRUE : FALSE ); #ifndef _RELEASE_ - if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) != SW_CONFIG_ENABLE_VALUE ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) + if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) #endif { checkPersistentAlarm( ALARM_ID_DG_DRAIN_PUMP_DIRECTION_INVALID, isDirInvalid, (F32)direction, DRAIN_PUMP_FORWARD_DIR ); @@ -440,7 +441,7 @@ } #ifndef _RELEASE_ - if ( ( getSoftwareConfigStatus( SW_CONFIG_ENABLE_V3_SYSTEM ) != SW_CONFIG_ENABLE_VALUE ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) + if ( ( getHardwareConfigStatus() != HW_CONFIG_BETA ) && ( getCurrentOperationMode() != DG_MODE_INIT ) ) #endif { // Check the persistent alarm for the maximum drain pump current @@ -493,7 +494,7 @@ drainPumpControlModeSet = drainPumpControlMode; signalNewRPMRequest = TRUE; } - pendingDrainPumpCmdTarget = 0.0; + pendingDrainPumpCmdTarget = 0.0F; pendingDrainPumpCmd = DRAIN_PUMP_OFF_STATE; } } @@ -918,7 +919,7 @@ drainPumpMeasuredRPM.ovData = value; drainPumpMeasuredRPM.override = OVERRIDE_KEY; drainPumpMeasuredRPM.ovInitData = drainPumpMeasuredRPM.data; - status = TRUE; + status = TRUE; } } @@ -942,10 +943,106 @@ { drainPumpMeasuredRPM.ovData = drainPumpMeasuredRPM.ovInitData; drainPumpMeasuredRPM.override = OVERRIDE_RESET; - status = TRUE; + status = TRUE; } return status; } +/*********************************************************************//** + * @brief + * The testSetDrainPumpMeasuredCurrentOverride function overrides the drain pump + * measured current data. + * @details Inputs: none + * @details Outputs: drainPumpMeasuredCurrentA + * @param value override drain pump measured current data + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetDrainPumpMeasuredCurrentOverride( F32 value ) +{ + BOOL status = FALSE; + + // Check if the user is logged in + if ( TRUE == isTestingActivated() ) + { + drainPumpMeasuredCurrentA.ovData = value; + drainPumpMeasuredCurrentA.override = OVERRIDE_KEY; + drainPumpMeasuredCurrentA.ovInitData = drainPumpMeasuredCurrentA.data; + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief + * The testResetDrainPumpMeasuredCurrentOverride function resets the drain pump + * measured current data. + * @details Inputs: none + * @details Outputs: drainPumpMeasuredCurrentA + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetDrainPumpMeasuredCurrentOverride( void ) +{ + BOOL status = FALSE; + + // Check if the user is logged in + if ( TRUE == isTestingActivated() ) + { + drainPumpMeasuredCurrentA.ovData = drainPumpMeasuredCurrentA.ovInitData; + drainPumpMeasuredCurrentA.override = OVERRIDE_RESET; + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief + * The testSetDrainPumpMeasuredDirectionOverride function overrides the drain pump + * measured direction data. + * @details Inputs: none + * @details Outputs: drainPumpMeasuredDir + * @param value override drain pump measured direction data + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetDrainPumpMeasuredDirectionOverride( U32 value ) +{ + BOOL status = FALSE; + + // Check if the user is logged in + if ( TRUE == isTestingActivated() ) + { + drainPumpMeasuredDir.ovData = value; + drainPumpMeasuredDir.override = OVERRIDE_KEY; + drainPumpMeasuredDir.ovInitData = drainPumpMeasuredDir.data; + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief + * The testResetDrainPumpMeasuredDirectionOverride function resets the drain pump + * measured direction data. + * @details Inputs: none + * @details Outputs: drainPumpMeasuredDir + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetDrainPumpMeasuredDirectionOverride( void ) +{ + BOOL status = FALSE; + + // Check if the user is logged in + if ( TRUE == isTestingActivated() ) + { + drainPumpMeasuredDir.ovData = drainPumpMeasuredDir.ovInitData; + drainPumpMeasuredDir.override = OVERRIDE_RESET; + status = TRUE; + } + + return status; +} + /**@}*/