Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rad6b3443575d3f6bbac52237866e19a212d36bc1 -rd8dbfa71fd70064ffe00d09ffa270f477c8f7af2 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision ad6b3443575d3f6bbac52237866e19a212d36bc1) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision d8dbfa71fd70064ffe00d09ffa270f477c8f7af2) @@ -352,11 +352,11 @@ { if ( DG_PRIMARY_HEATER == heater ) { - checkPersistentAlarm( ALARM_ID_RO_FLOW_TOO_LOW_WHILE_PRIMARY_HEATER_IS_ON, FALSE, 0.0, 0.0 ); + checkPersistentAlarm( ALARM_ID_RO_FLOW_TOO_LOW_WHILE_PRIMARY_HEATER_IS_ON, FALSE, 0.0F, 0.0F ); } else { - checkPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_TOO_LOW_WHILE_TRIMMER_HEATER_IS_ON, FALSE, 0.0, 0.0 ); + checkPersistentAlarm( ALARM_ID_DIALYSATE_FLOW_TOO_LOW_WHILE_TRIMMER_HEATER_IS_ON, FALSE, 0.0F, 0.0F ); } } } Index: firmware/App/Controllers/Pressures.c =================================================================== diff -u -r44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3 -rd8dbfa71fd70064ffe00d09ffa270f477c8f7af2 --- firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision 44f739bf3e9dfe0bfb5910a6a32fc4c5b1533af3) +++ firmware/App/Controllers/Pressures.c (.../Pressures.c) (revision d8dbfa71fd70064ffe00d09ffa270f477c8f7af2) @@ -194,7 +194,7 @@ } else { - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_PRESSURE_SENSOR_ID, pressureID ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_PRESSURE_SENSOR_SELECTED, pressureID ); } return result; @@ -351,6 +351,13 @@ pressures[ sensorId ].data = getCalibrationAppliedPressure( sensorId, pressureBeforeCal ); msrdPressureSum[ sensorId ] = 0; break; + +#ifndef _VECTORCAST_ + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_PRESSURE_SENSOR_SELECTED, sensorId ); + break; +#endif + } } } @@ -376,6 +383,12 @@ checkPersistentAlarm( ALARM_ID_DG_BARO_PRESSURE_OUT_OF_RANGE, isPressureOutOfRange, (F32)sensorId, pressureReading ); } break; + +#ifndef _VECTORCAST_ + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_PRESSURE_SENSOR_SELECTED, sensorId ); + break; +#endif } } Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r8074ecece0b11532c173ad951a98036f0c54ca52 -rd8dbfa71fd70064ffe00d09ffa270f477c8f7af2 --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 8074ecece0b11532c173ad951a98036f0c54ca52) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision d8dbfa71fd70064ffe00d09ffa270f477c8f7af2) @@ -27,6 +27,7 @@ #include "TaskGeneral.h" #include "Timers.h" #include "UVReactors.h" +#include "Valves.h" /** * @addtogroup UV Reactors @@ -44,7 +45,7 @@ #define SELF_TEST_DELAY_TIME 1000 ///< Self test wait time after enabling the reactors and before checking for their health in ms. #define MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD MS_PER_SECOND ///< UV reactors unhealthy state period. #define DATA_PUBLISH_COUNTER_START_COUNT 90 ///< Data publish counter start count. -#define UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< UV reactors on with no flow time out in milliseconds. +#define UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< UV reactors on with no flow time out in milliseconds. #define MIN_RO_UV_FLOWRATE_LPM 0.2F ///< Minimum target RO UV flow rate in L/min. /// UV reactors self test states @@ -73,8 +74,6 @@ U32 reactorEnablePin; ///< UV reactor enable pin of GIO port A. U32 reactorHealthStatusPin; ///< UV reactor status pin of N2HET1. OVERRIDE_U32_T healthStatus; ///< UV reactor current health status. - BOOL isFlowBelowMin; ///< UV reactor flag to indicate the flow is below minimum. - U32 reactorOnWithNoFlowTimer; ///< UV reactor on with no flow start time. } UV_REACTOR_STATUS_T; // ********** private data ********** @@ -139,6 +138,8 @@ } initPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); + initPersistentAlarm( ALARM_ID_DG_INLET_UV_REACTOR_ON_WITH_NO_FLOW, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_DG_OUTLET_UV_REACTOR_ON_WITH_NO_FLOW, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ); } /*********************************************************************//** @@ -197,11 +198,12 @@ reactorsStatus[ reactor ].execState = handleUVReactorStateOn( reactor ); break; +#ifndef _VECTORCAST_ default: - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_UV_REACTORS_INVALID_EXEC_STATE, - reactorsStatus[ reactor ].execState ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_UV_REACTORS_INVALID_EXEC_STATE, reactorsStatus[ reactor ].execState ); reactorsStatus[ reactor].execState = UV_REACTOR_STATE_OFF; break; +#endif } } @@ -375,16 +377,8 @@ // Check if the a reactor is requested to be on and it is off if ( TURN_ON == reactorsStatus[ reactor ].switchState ) { - // Check if the flow is below minimum - reactorsStatus[ reactor ].isFlowBelowMin = ( getMeasuredFlowRateLPM( RO_FLOW_SENSOR ) < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); - - // If the flow is no longer below minimum and the reactor is requested to be on, turn it back on - if ( FALSE == reactorsStatus[ reactor ].isFlowBelowMin ) - { - setReactorEnableStatus( reactor, PIN_SIGNAL_HIGH ); - - state = UV_REACTOR_STATE_ON; - } + setReactorEnableStatus( reactor, PIN_SIGNAL_HIGH ); + state = UV_REACTOR_STATE_ON; } return state; @@ -401,13 +395,11 @@ static UV_REACTOR_STATE_T handleUVReactorStateOn( UV_REACTORS_T reactor ) { UV_REACTOR_STATE_T state = UV_REACTOR_STATE_ON; + BOOL isReactorUnhealthy = ( UV_REACTOR_HEALTHY == getUVReactorHealth( reactor ) ? FALSE : TRUE ); // Update the UV reactor's health. It should be either healthy (1) or not healthy (0) reactorsStatus[ reactor ].healthStatus.data = getReactorHealth( reactor ); - // Get the health of the reactor (override or non-override) and decide the status - BOOL isReactorUnhealthy = ( UV_REACTOR_HEALTHY == getUVReactorHealth( reactor ) ? FALSE : TRUE ); - #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UV_REACTORS ) != SW_CONFIG_ENABLE_VALUE ) #endif @@ -419,32 +411,34 @@ } } - // Check if the flow is below minimum - BOOL isFlowBelowMin = ( getMeasuredFlowRateLPM( RO_FLOW_SENSOR ) < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); - - if ( TRUE == isFlowBelowMin ) + switch( reactor ) { - // If the flow is below minimum for the first time, start the timer - if ( FALSE == reactorsStatus[ reactor ].isFlowBelowMin ) + case INLET_UV_REACTOR: { - reactorsStatus[ reactor ].isFlowBelowMin = TRUE; - reactorsStatus[ reactor ].reactorOnWithNoFlowTimer = getMSTimerCount(); + BOOL isVPIClosed = ( VALVE_STATE_CLOSED == getValveStateName( VPI ) ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_INLET_UV_REACTOR_ON_WITH_NO_FLOW, isVPIClosed, (F32)VALVE_STATE_CLOSED, (F32)VALVE_STATE_OPEN ); } - else if ( TRUE == didTimeout( reactorsStatus[ reactor ].reactorOnWithNoFlowTimer, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ) ) + break; + + case OUTLET_UV_REACTOR: { - // If the flow is below minimum and the allowed time has elapsed, set the reactor's signal to be low and set its state - // to be off. - setReactorEnableStatus( reactor, PIN_SIGNAL_LOW ); - // The state is directly changed here because the switch state is not changed to be off - reactorsStatus[ reactor ].execState = UV_REACTOR_STATE_OFF; + F32 flow = getMeasuredFlowRateLPM( RO_FLOW_SENSOR ); + BOOL isFlowBelowMin = ( flow < MIN_RO_UV_FLOWRATE_LPM ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_DG_OUTLET_UV_REACTOR_ON_WITH_NO_FLOW, isFlowBelowMin, flow, MIN_RO_UV_FLOWRATE_LPM ); } + break; + +#ifndef _VECTORCAST_ + default: + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_UV_REACTORS_INVALID_REACTOR_SELECTD ) + break; +#endif } // Check if it has been requested to turn off a reactor if ( TURN_OFF == reactorsStatus[ reactor ].switchState ) { setReactorEnableStatus( reactor, PIN_SIGNAL_LOW ); - state = UV_REACTOR_STATE_OFF; } Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -re6c4c61c793a91f9ed9dfe969e01bdeee565347d -rd8dbfa71fd70064ffe00d09ffa270f477c8f7af2 --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision e6c4c61c793a91f9ed9dfe969e01bdeee565347d) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision d8dbfa71fd70064ffe00d09ffa270f477c8f7af2) @@ -120,7 +120,7 @@ SW_FAULT_ID_CAN_TX_FAULT, SW_FAULT_ID_INVALID_CAN_MESSAGE_SIZE, SW_FAULT_ID_INVALID_CONDUCTIVITY_SENSOR_ID, // 90 - SW_FAULT_ID_INVALID_PRESSURE_SENSOR_ID, + SW_FAULT_ID_INVALID_PRESSURE_SENSOR_SELECTED, SW_FAULT_ID_INVALID_TASK, SW_FAULT_ID_INVALID_VOLTAGE_MONITOR_STATE, SW_FAULT_ID_INVALID_MONITORED_VOLTAGE_ID, Index: firmware/App/Services/FPGA.c =================================================================== diff -u -re6c4c61c793a91f9ed9dfe969e01bdeee565347d -rd8dbfa71fd70064ffe00d09ffa270f477c8f7af2 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision e6c4c61c793a91f9ed9dfe969e01bdeee565347d) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision d8dbfa71fd70064ffe00d09ffa270f477c8f7af2) @@ -243,6 +243,7 @@ U08 fpgaHeater1ADCErrorCount; ///< Reg 481. Heater 1 ADC error count U16 fpgaPowerSupply2; ///< Reg 482. Power supply 2 count U16 fpgaOnBoardThermistor; ///< Reg 484. Onboard thermistor + U08 fpgaDrainPumpDirection; ///< Reg 486. Drain pump direction } DG_FPGA_SENSORS_T; typedef struct @@ -2430,4 +2431,42 @@ return fpgaSensorReadings.fpgaHeater1ADCErrorCount; } +/*********************************************************************//** + * @brief + * The getFPGADrainPumpCurrentFeedback function returns the drain pump current + * feedback. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return drain pump current feedback + *************************************************************************/ +U16 getFPGADrainPumpCurrentFeedback( void ) +{ + return fpgaSensorReadings.fpgaDrainPumpCurrentFeedback; +} + +/*********************************************************************//** + * @brief + * The getFPGADrainPumpSpeedFeedback function returns the drain pump speed + * feedback. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return drain pump speed feedback + *************************************************************************/ +U16 getFPGADrainPumpSpeedFeedback( void ) +{ + return fpgaSensorReadings.fpgaDrainPumpSpeedFeedback; +} + +/*********************************************************************//** + * @brief + * The getFPGADrainPumpDirecion function returns the drain pump direction. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return drain pump direction + *************************************************************************/ +U08 getFPGADrainPumpDirecion( void ) +{ + return fpgaSensorReadings.fpgaDrainPumpDirection; +} + /**@}*/ Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r2e21405574597474db0ebae86cdd7fa2d517f71c -rd8dbfa71fd70064ffe00d09ffa270f477c8f7af2 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 2e21405574597474db0ebae86cdd7fa2d517f71c) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision d8dbfa71fd70064ffe00d09ffa270f477c8f7af2) @@ -173,6 +173,10 @@ U08 getFPGAHeaterGateADCReadCount( void ); U08 getFPGAHeaterGateADCErrorCount( void ); +U16 getFPGADrainPumpCurrentFeedback( void ); +U16 getFPGADrainPumpSpeedFeedback( void ); +U08 getFPGADrainPumpDirecion( void ); + /**@}*/ #endif