Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r335c721d795f22c6dc4a24f5180dee3ba095a2b2 -r5ca11d82e660ba31b6821420eb9098e036e6d93c --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 335c721d795f22c6dc4a24f5180dee3ba095a2b2) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 5ca11d82e660ba31b6821420eb9098e036e6d93c) @@ -460,14 +460,14 @@ /*********************************************************************//** * @brief - * The getDialysateTemperature function gets the latest dialysate temperature. - * @details Inputs: dgDialysateTemp + * The getDGDisinfectsStates function returns the DG disinfects readings. + * @details Inputs: none * @details Outputs: none - * @return the current dialysate temperature + * @return the current DG disinfects readings *************************************************************************/ -F32 getDialysateTemperature( void ) +DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) { - return dgDialysateTemp; + return disinfectsStatus; } /*********************************************************************//** @@ -501,11 +501,11 @@ * The getDGDisinfectsStates function returns the DG disinfects readings. * @details Inputs: none * @details Outputs: none - * @return the current DG disinfects readings + * @return the current dialysate temperature *************************************************************************/ -DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) +F32 getDialysateTemperature( void ) { - return disinfectsStatus; + return dgDialysateTemp; } /*********************************************************************//** @@ -1055,17 +1055,17 @@ /*********************************************************************//** * @brief - * The cmdStartDGChememicalFlushDisinfect function sends a start chemical disinfect + * The cmdStartDGChemicalFlushDisinfect function sends a start chemical disinfect * flush command message to the DG. * @details Inputs: none * @details Outputs: start chemical disinfect flush mode command sent to DG. * @return none *************************************************************************/ -void cmdStartDGChememicalFlushDisinfect( void ) +void cmdStartDGChemicalFlushDisinfect( void ) { BOOL start = TRUE; dgCmdResp[ DG_CMD_START_CHEM_DISINFECT_FLUSH ].commandID = DG_CMD_NONE; - sendDGStartChemicalDisinfectFlushModeCommand( start ); + sendDGStartStopChemicalDisinfectFlushModeCommand( start ); } /*********************************************************************//** @@ -1080,11 +1080,55 @@ { BOOL start = FALSE; dgCmdResp[ DG_CMD_STOP_CHEM_DISINFECT_FLUSH ].commandID = DG_CMD_NONE; - sendDGStartChemicalDisinfectFlushModeCommand( start ); + sendDGStartStopChemicalDisinfectFlushModeCommand( start ); } /*********************************************************************//** * @brief + * The cmdStopDGActiveCool function sends a stop active cool command + * message to the DG. + * @details Inputs: none + * @details Outputs: stop active cool mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGActiveCool( void ) +{ + dgCmdResp[ DG_CMD_STOP_ACTIVE_COOL ].commandID = DG_CMD_NONE; + sendDGStopActiveCoolModeCommand(); +} + +/*********************************************************************//** + * @brief + * The cmdStartDGROPermeateSampleMode function sends an RO permeate sample + * start command message to the DG. + * @details Inputs: none + * @details Outputs: start RO permeate sample mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStartDGROPermeateSampleMode( void ) +{ + BOOL start = TRUE; + dgCmdResp[ DG_CMD_START_RO_PERMEATE_SAMPLE ].commandID = DG_CMD_NONE; + sendDGStartStopDGROPermeateSampleModeCommand( start ); +} + +/*********************************************************************//** + * @brief + * The cmdStopDGROPermeateSampleMode function sends an RO permeate sample + * stop command message to the DG. + * @details Inputs: none + * @details Outputs: stop RO permeate sample mode command sent to DG. + * @return none + *************************************************************************/ +void cmdStopDGROPermeateSampleMode( void ) +{ + BOOL start = FALSE; + dgCmdResp[ DG_CMD_STOP_RO_PERMEATE_SAMPLE ].commandID = DG_CMD_NONE; + sendDGStartStopDGROPermeateSampleModeCommand( start ); +} + +/*********************************************************************//** + * @brief * The cmdRequestDGConcentrateRatios function sends a request to DG to receive * the concentrate ratios. * @details Inputs: none Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -rbb6e905d7e6330508f00d6a6779cb11ef92c22d1 -r5ca11d82e660ba31b6821420eb9098e036e6d93c --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision bb6e905d7e6330508f00d6a6779cb11ef92c22d1) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 5ca11d82e660ba31b6821420eb9098e036e6d93c) @@ -512,7 +512,7 @@ } else { // Alarm if not receiving new dialysate flow readings in timely manner - if ( ( TRUE == isDGCommunicating() ) && ( isACPowerLost() != TRUE ) ) + if ( ( TRUE == isDGCommunicating() ) && ( FALSE == isACPowerLost() ) ) { if ( ++dialysateFlowDataFreshStatusCounter > DIP_DIALYSATE_FLOW_DATA_ALARM_THRESHOLD ) { Index: firmware/App/Drivers/Battery.c =================================================================== diff -u -rbe80e2ef0d8f01580e047be35b485e65dcbcbdd7 -r5ca11d82e660ba31b6821420eb9098e036e6d93c --- firmware/App/Drivers/Battery.c (.../Battery.c) (revision be80e2ef0d8f01580e047be35b485e65dcbcbdd7) +++ firmware/App/Drivers/Battery.c (.../Battery.c) (revision 5ca11d82e660ba31b6821420eb9098e036e6d93c) @@ -222,27 +222,6 @@ /*********************************************************************//** * @brief - * The isACPowerLost function determines whether A/C power loss has been - * detected. - * @details Inputs: none - * @details Outputs: none - * @return TRUE if A/C power loss condition is in effect, FALSE if not - *************************************************************************/ -BOOL isACPowerLost( void ) -{ - BOOL result = TRUE; - - if ( ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST ) ) && - ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST_IN_TREATMENT ) ) ) - { - result = FALSE; - } - - return result; -} - -/*********************************************************************//** - * @brief * The getI2CStatusRegister function returns the I2C status register * @details Inputs: batteryI2CStatusRegister, i2cREG1->STR * @details Outputs: none Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rcb341120bd78ba7a9852e495038e5c5bcf4abe04 -r5ca11d82e660ba31b6821420eb9098e036e6d93c --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision cb341120bd78ba7a9852e495038e5c5bcf4abe04) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 5ca11d82e660ba31b6821420eb9098e036e6d93c) @@ -254,6 +254,33 @@ /*********************************************************************//** * @brief + * The isACPowerLost function determines whether A/C power loss has + * been detected. This function sets the alarms blocked condition to + * allow smooth alarm recovery. + * + * @details Inputs: alarmStatus + * @details Outputs: alarmsBlockedTimer + * @return TRUE if A/C power loss alarm is in effect, FALSE if not + *************************************************************************/ +BOOL isACPowerLost( void ) +{ + BOOL result = TRUE; + + // Continue to block new alarms until the alarms are cleared. + if ( ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST ) ) && + ( FALSE == isAlarmConditionDetected( ALARM_ID_HD_AC_POWER_LOST_IN_TREATMENT ) ) ) + { + result = FALSE; + } + else + { + alarmsBlockedTimer = ALARM_BLOCKED_COUNT_AFTER_AC_RETURN; + } + return result; +} + +/*********************************************************************//** + * @brief * The activateAlarm function activates a given alarm. * @details Inputs: none * @details Outputs: alarmIsActive[], alarmStartedAt[], alarmStatus is updated @@ -262,6 +289,11 @@ *************************************************************************/ static void activateAlarm( ALARM_ID_T alarm ) { + // Block new alarms, occuring during loss of AC power + if ( ( TRUE == getCPLDACPowerLossDetected() ) ) + { + alarmsBlockedTimer = ALARM_BLOCKED_COUNT_AFTER_AC_RETURN; + } // Verify valid alarm index if ( ( alarm > ALARM_ID_NO_ALARM ) && ( alarm < NUM_OF_ALARM_IDS ) ) { @@ -358,12 +390,7 @@ * @return none *************************************************************************/ void activateAlarm2Data( ALARM_ID_T alarm, ALARM_DATA_T alarmData1, ALARM_DATA_T alarmData2 ) -{ - // Block if new alarms are occur during loss of AC power - if ( ( TRUE == getCPLDACPowerLossDetected() ) ) - { - alarmsBlockedTimer = ALARM_BLOCKED_COUNT_AFTER_AC_RETURN; - } +{ // Sanity check, verify valid alarm index if ( ( alarm > ALARM_ID_NO_ALARM ) && ( alarm < NUM_OF_ALARM_IDS ) ) { Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r4e9b962e7cb3c0b477462756a32214118b10fc16 -r5ca11d82e660ba31b6821420eb9098e036e6d93c --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 4e9b962e7cb3c0b477462756a32214118b10fc16) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 5ca11d82e660ba31b6821420eb9098e036e6d93c) @@ -204,6 +204,7 @@ void setAlarmUserActionEnabled( ALARM_USER_ACTION_T action, BOOL enabled ); void signalAlarmSilence( ALARM_SILENCE_CMD_T cmd ); void signalAlarmUserActionInitiated( ALARM_USER_ACTION_T action ); +BOOL isACPowerLost( void ); BOOL isAlarmActive( ALARM_ID_T alarm ); BOOL isAlarmConditionDetected( ALARM_ID_T alarm ); BOOL isAnyAlarmActive( void );