Index: firmware/App/Controllers/BloodLeak.h =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/BloodLeak.h (.../BloodLeak.h) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -64,7 +64,7 @@ SELF_TEST_STATUS_T execBloodLeakSelfTest( void ); BLOOD_LEAK_STATUS_T getBloodLeakStatus( void ); -SELF_TEST_STATUS_T getBloodLeakSelfTestStatus( void ); +SELF_TEST_STATUS_T getBloodLeakSelfTestStatus( void ); BOOL testSetBloodLeakDataPublishIntervalOverride( U32 value ); BOOL testResetBloodLeakDataPublishIntervalOverride( void ); Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -25,7 +25,7 @@ #include "ModeInitPOST.h" #include "ModeTreatment.h" #include "ModeTreatmentParams.h" -#include "OperationModes.h" +#include "OperationModes.h" #include "PersistentAlarm.h" #include "SystemComm.h" #include "SystemCommMessages.h" @@ -58,12 +58,12 @@ // ********** private data ********** -// DG status -static DG_OP_MODE_T dgCurrentOpMode; ///< Current DG operation mode. +// DG status +static DG_OP_MODE_T dgCurrentOpMode; ///< Current DG operation mode. static U32 dgSubMode; ///< Current state (sub-mode) of current DG operation mode. -static BOOL dgStartCommandSent; ///< Flag indicates command to start DG has been sent. -static BOOL dgStarted; ///< Flag indicates whether we have commanded the DG to start or stop. -static BOOL dgTrimmerHeaterOn; ///< Flag indicates whether we have commanded the DG to start or stop the trimmer heater. +static BOOL dgStartCommandSent; ///< Flag indicates command to start DG has been sent. +static BOOL dgStarted; ///< Flag indicates whether we have commanded the DG to start or stop. +static BOOL dgTrimmerHeaterOn; ///< Flag indicates whether we have commanded the DG to start or stop the trimmer heater. // DG sensor data static F32 dgDialysateTemp; ///< Dialysate temperature reported by the DG. @@ -125,8 +125,8 @@ U32 i, j; // NOTE: the active reservoir is set to reservoir 1 since DG will send active reservoir 1 as active on power up - dgStarted = FALSE; - dgTrimmerHeaterOn = FALSE; + dgStarted = FALSE; + dgTrimmerHeaterOn = FALSE; dgTrimmerTempSet = 0.0F; dgTrimmerTempCheckTimerCtr = 0; dgActiveReservoirSet = DG_RESERVOIR_2; @@ -458,14 +458,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 latest dialysate temperature + * @return the current DG disinfects readings *************************************************************************/ -F32 getDialysateTemperature( void ) +DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) { - return dgDialysateTemp; + return disinfectsStatus; } /*********************************************************************//** @@ -509,14 +509,14 @@ /*********************************************************************//** * @brief - * The getDGDisinfectsStates function returns the DG disinfects readings. - * @details Inputs: disinfectsStatus + * The getDialysateTemperature function returns the DG dialysate temperature. + * @details Inputs: dgDialysateTemp * @details Outputs: none - * @return the current DG disinfects readings + * @return the latest dialysate temperature *************************************************************************/ -DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) +F32 getDialysateTemperature( void ) { - return disinfectsStatus; + return dgDialysateTemp; } /*********************************************************************//** Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -118,6 +118,7 @@ F32 getHeatDisinfectTemperatureSensorValue( void ); BOOL getTrimmerHeaterCommandedOn( void ); DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ); +F32 getDialysateTemperature( void ); DG_MIXING_RATIOS_T getDGMixingRatios( void ); void getHDVersionDGServiceAndUsageData( DG_SERVICE_AND_USAGE_DATA_T* data ); Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -85,6 +85,7 @@ #define PSI_TO_MMHG ( 51.7149F ) ///< Conversion factor for converting PSI to mmHg. +// The new arterial pressure sensor is the same as the venous pressure sensor #define VENOUS_PRESSURE_NORMAL_OP 0 ///< Venous pressure status bits indicate normal operation. #define VENOUS_PRESSURE_CMD_MODE 1 ///< Venous pressure status bits indicate sensor in command mode. #define VENOUS_PRESSURE_STALE_DATA 2 ///< Venous pressure status bits indicate data is stale (no new data since last fpga read). @@ -927,7 +928,6 @@ } } } - // Check for occlusion in Treatment modes where pumps are moving else if ( MODE_TREA == hdMode ) { Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -166,10 +166,12 @@ #define SYRINGE_PUMP_STALL_SPEED_THRESHOLD 0.05F ///< Minimum syringe pump speed to be considered not stalled. #define SYRINGE_PUMP_ADC_FPGA_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Syringe pump ADC FPGA error timeout in milliseconds. + #define SYRINGE_PUMP_DAC_MAX_RETRIES 5 ///< Syringe pump DAC retries to write. #define SYRINGE_PUMP_DAC_TIMER ( 200 / TASK_PRIORITY_INTERVAL ) ///< Syringe pump DAC timer between retries. #define SYRINGE_PUMP_OCCLUSION_PERSISTENCE 50 ///< Syringe pump occlusion persistence timer in milliseconds. #define SYRINGE_PUMP_EMPTY_FORCE_COUNT 5 ///< Syringe pump empty force voltage count persistence. + /// Defined states for the syringe pump control state machine. typedef enum SyringePump_States { @@ -349,6 +351,7 @@ initPersistentAlarm( ALARM_ID_HD_SYRINGE_PUMP_CONTROLLER_DIRECTION_ERROR, 0, SYRINGE_PUMP_DIR_ALARM_PERSISTENCE ); initPersistentAlarm( ALARM_ID_HD_SYRINGE_PUMP_RUNNING_WHILE_BP_OFF_ERROR, 0, SYRINGE_PUMP_OFF_ALARM_PERSISTENCE ); initPersistentAlarm( ALARM_ID_HD_SYRINGE_PUMP_SPEED_ERROR, 0, SYRINGE_PUMP_RATE_ALARM_PERSISTENCE ); + initPersistentAlarm( ALARM_ID_HD_SYRINGE_PUMP_OCCLUSION, 0, SYRINGE_PUMP_OCCLUSION_PERSISTENCE); initTimeWindowedCount( TIME_WINDOWED_COUNT_SYRINGE_PUMP_OFF_ERROR, SYRINGE_PUMP_OFF_ERROR_MAX_CNT, SYRINGE_PUMP_OFF_ERROR_TIME_WIN_MS ); initFPGAPersistentAlarm( FPGA_PERS_ERROR_SYRINGE_PUMP_ADC, ALARM_ID_HD_SYRINGE_PUMP_FPGA_ADC_FAULT, Index: firmware/App/Controllers/Temperatures.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/Temperatures.c (.../Temperatures.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -289,9 +289,10 @@ if ( ( temperature > MAX_ALLOWED_TEMPERATURE ) || ( temperature < MIN_ALLOWED_TEMPERATURE ) ) { - isTempOutOfRange |= TRUE; - lastFaultSensor = sensor; + isTempOutOfRange = TRUE; + lastFaultSensor = sensor; } + } checkPersistentAlarm( ALARM_ID_HD_TEMPERATURES_OUT_OF_RANGE, isTempOutOfRange, lastFaultSensor, MAX_ALLOWED_TEMPERATURE ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -1203,31 +1203,34 @@ maxDeviation = MAX_DEVIATION_FROM_TRAGET_IN_POS_B; } - // Check if the current position has deviated from the position it is supposed to be in - // For more than a certain amount of time. If it has, raise an alarm - // Absolute value is used for comparison to cover +/- from the commanded position - if ( abs( currentPosition - commandedPosition ) > maxDeviation ) + if ( FALSE == isACPowerLost() ) { - valvesStatus[ valve ].positionOutOfRangeCounter++; - } + // Check if the current position has deviated from the position it is supposed to be in + // For more than a certain amount of time. If it has, raise an alarm + // Absolute value is used for comparison to cover +/- from the commanded position + if ( abs( currentPosition - commandedPosition ) > maxDeviation ) + { + valvesStatus[ valve ].positionOutOfRangeCounter++; + } - if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) - { - // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. - // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here - // because this is a monitor function that is called in the controller function. - valvesStatus[ valve ].execState = VALVE_STATE_IDLE; - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); + if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) + { + // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. + // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here + // because this is a monitor function that is called in the controller function. + valvesStatus[ valve ].execState = VALVE_STATE_IDLE; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); - if ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) + if ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) + { + activateSafetyShutdown(); + } + } + else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) { - activateSafetyShutdown(); + valvesStatus[ valve ].positionOutOfRangeCounter = 0; } } - else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) - { - valvesStatus[ valve ].positionOutOfRangeCounter = 0; - } } else { Index: firmware/App/Drivers/Battery.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Drivers/Battery.c (.../Battery.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Drivers/Battery.c (.../Battery.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -204,6 +204,7 @@ if ( TRUE == didTimeout( lastBatteryMonitorTime, BATTERY_MONITOR_INTERVAL_MS ) ) { lastBatteryMonitorTime = getMSTimerCount(); + getBatteryManagementData(); } } Index: firmware/App/HDCommon.h =================================================================== diff -u -r7c2805b3e77dca6be94ecc0d4bfb24671480d632 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 7c2805b3e77dca6be94ecc0d4bfb24671480d632) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -10,8 +10,8 @@ * @author (last) Sean Nash * @date (last) 24-Aug-2023 * -* @author (original) Sean -* @date (original) 27-Feb-2020 +* @author (original) Sean +* @date (original) 27-Feb-2020 * ***************************************************************************/ @@ -25,8 +25,9 @@ #define HD_VERSION_MAJOR 0 #define HD_VERSION_MINOR 9 #define HD_VERSION_MICRO 0 -#define HD_VERSION_BUILD 294 +#define HD_VERSION_BUILD 797 + // ********** development build switches ********** #ifndef _RELEASE_ Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -110,6 +110,7 @@ if ( TRUE == consumableInstallConfirmed ) // TODO - should we check that concentrate cap is off too? { consumableInstallConfirmed = FALSE; + #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CONSUMABLES_TESTS ) ) { Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -912,7 +912,6 @@ // Reset bolus data before we start bolusSalineVolumeDelivered_mL = 0.0; bolusSalineLastVolumeTimeStamp = getMSTimerCount(); - // Bypass dialyzer setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -76,6 +76,9 @@ /// Interval (in task intervals) at which to publish standby mode data to CAN bus. static OVERRIDE_U32_T standbyModePublishInterval = { DISINFECTS_DATA_PUB_INTERVAL, DISINFECTS_DATA_PUB_INTERVAL, DISINFECTS_DATA_PUB_INTERVAL, 0 }; +static const U32 SERVICE_TIME_INTERVAL_S = (U32)( 365 * 0.5 * SECONDS_IN_A_DAY ); ///< HD/DG 6-month service interval in seconds. +static BOOL homingInitiated; ///< Flag indicates actuator homing has been initiated from standby mode. + // ********** private function prototypes ********** static HD_STANDBY_STATE_T handleStandbyModeStartState( void ); Index: firmware/App/Modes/ModeStandby.h =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Modes/ModeStandby.h (.../ModeStandby.h) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -40,10 +40,11 @@ BOOL signalUserInitiateTreatment( void ); // User has initiated a treatment - go to treatment parameters mode void signalNoDisinfectRequired( void ); // User has aborted a treatment prior to introduction of blood - no disinfect required afterward void signalAlarmActionToStandbyMode( ALARM_ACTION_T action ); // Execute alarm action as appropriate for Standby mode -BOOL signalUserInitiateFlushMode( void ); -BOOL signalUserInitiateHeatDisinfectMode( void ); -BOOL signalUserInitiateChemicalDisinfectMode( void ); -BOOL signalUserInitiateChemcialDisinfectFlushMode( void ); +BOOL signalUserInitiateFlushMode( void ); // User has requested to start flush +BOOL signalUserInitiateHeatDisinfectMode( void ); // User has requested to start heat disinfection +BOOL signalUserInitiateChemicalDisinfectMode( void ); // User has requested to start chem disinfection +BOOL signalUserInitiateChemcialDisinfectFlushMode( void ); // User has requested to start chem flush +BOOL signalInitiateStandbyDisinfectSubmode( U32 cmd ); // UI has signaled user will be selecting a cleaning operation to perform BOOL signalUserInitiateROPermeateSampleMode( void ); BOOL signalInitiateStandbyDisinfectSubmode( U32 cmd ); void signalROPermeateSampleDGReadyToDispense( void ); Index: firmware/App/Modes/TreatmentRecirc.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Modes/TreatmentRecirc.c (.../TreatmentRecirc.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -51,6 +51,8 @@ static BOOL recircBackToTreatmenRequested; ///< Flag indicates user requesting to go back to treatment (confirming re-connected). static BOOL recircResumeRequested; ///< Flag indicates user requesting resumption of re-circulating. static BOOL recircEndTreatmentRequested; ///< Flag indicates user requesting end of treatment. +static BOOL prevDialysateRecircBlocked; ///< Flag indicates previous user stop dialysate recirculation condition +static BOOL prevBloodRecircBlocked; ///< Flag indicates previous user stop blood recirculation condition // ********** private function prototypes ********** @@ -69,6 +71,8 @@ static BOOL handleRecircResumeUserAction( REQUEST_REJECT_REASON_CODE_T *rejReason ); static BOOL handleRecircConfirmDisconnectUserAction( REQUEST_REJECT_REASON_CODE_T *rejReason ); +static void checkTreatmentRecircOnOff( void ); + static void publishTreatmentRecircData( void ); /*********************************************************************//** @@ -85,6 +89,8 @@ recircTimerCtr = 0; recircPublishTimerCtr = 0; resetTreatmentRecircFlags(); + prevDialysateRecircBlocked = isDialysateRecircBlocked(); + prevBloodRecircBlocked = isBloodRecircBlocked(); } /*********************************************************************//** @@ -122,13 +128,14 @@ setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); setupForRecirculationStopState(); - // Enable venous bubble detection while recirculating - setVenousBubbleDetectionEnabled( TRUE ); + // Disable venous bubble detection while recirculating + setVenousBubbleDetectionEnabled( FALSE ); // Ensure syringe pump is stopped stopSyringePump(); // Stop air trap leveling control endAirTrapControl(); + // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); cmdStartDGTrimmerHeater(); @@ -170,6 +177,7 @@ { // Stop blood pump signalBloodPumpHardStop(); + // Close arterial and venous lines setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); @@ -223,6 +231,9 @@ // Broadcast recirc status publishTreatmentRecircData(); + + // Start/stop dialysate recirculation during rinseback mode based on active alarms that would block it + checkTreatmentRecircOnOff( ); } /*********************************************************************//** @@ -522,6 +533,47 @@ /*********************************************************************//** * @brief + * The checkTreatmentRecircOnOff function starts/stops recirculation + * during rinseback sub-mode based on active alarm properties. + * Simplified case for user stop - all stop/all go states only. + * @details Inputs: prevBloodRecircBlocked, prevDialysateRecircBlocked, + * alarmStatus, recircResumeRequested + * @details Outputs: recirculation started or stopped as appropriate; + * prevBloodRecircBlocked,prevDialysateRecircBlocked + * @return none + *************************************************************************/ +static void checkTreatmentRecircOnOff( void ) +{ + BOOL dialysateRecircBlocked = isDialysateRecircBlocked(); // Flag indicates user stop dialysate recirculation condition + BOOL bloodRecircBlocked = isBloodRecircBlocked(); // Flag indicates user stop blood recirculation condition + + // if there was any change + if ( dialysateRecircBlocked != prevDialysateRecircBlocked ) + { // Stop recirc if blocked by alarm + if ( ( TRUE == dialysateRecircBlocked ) ) + { // Stop the dialin pumps + signalDialInPumpHardStop(); + cmdStopDGTrimmerHeater(); + } + else + { // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature + setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + cmdStartDGTrimmerHeater(); + } + prevDialysateRecircBlocked = dialysateRecircBlocked; + } + if ( bloodRecircBlocked != prevBloodRecircBlocked ) + { // Stop recirc if blocked by alarm + if ( TRUE == bloodRecircBlocked ) + { + signalBloodPumpHardStop(); + } // Pump on/blood and valves dealt with in the state machine. + prevBloodRecircBlocked = bloodRecircBlocked; + } +} + +/*********************************************************************//** + * @brief * The publishTreatmentRecircData function publishes recirc progress to UI * at 1 Hz interval. * @details Inputs: recircPublishTimerCtr, recircTimerCtr Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -260,6 +260,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 @@ -268,6 +295,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 ) ) { Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -205,6 +205,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 ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -1669,6 +1669,7 @@ U32 epoch; memcpy( &epoch, message->payload, sizeof( U32 ) ); + isEpochValid ( epoch ); result = setRTCEpoch( epoch ); if ( FALSE == result ) { @@ -5529,6 +5530,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingCapacityOverride( payload.state.f32 ); Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -944,9 +944,6 @@ // MSG_ID_HD_SEND_BLOOD_LEAK_EMB_MODE_RESPONSE BOOL sendBloodLeakEmbeddedModeCommandResponse( U08 cmd, U32 responseLen, U08* response ); -// MSG_ID_HD_SEND_ALARMS_COMMAND -void handleResendAllAlarmsCommand( MESSAGE_T* message ); - // MSG_ID_HD_BLOOD_PUMP_SET_PWM void handleTestBloodPumpSetPWM( MESSAGE_T* message ); Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -r736cc5b56cc9c784ab1d8fc8687a73d190c35759 -r71319ba4a10ae2e8d33c74a388b39cff14e9b636 --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 736cc5b56cc9c784ab1d8fc8687a73d190c35759) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 71319ba4a10ae2e8d33c74a388b39cff14e9b636) @@ -185,7 +185,7 @@ { F32 v24 = getIntADCVoltageConverted( INT_ADC_24V_ACTUATORS ); F32 audioCurrent = getFPGABackupAlarmAudioCurrent(); - + // Verify 24V is down when w.d. expired if ( v24 > MAX_24V_LEVEL_ON_WATCHDOG_EXPIRED ) {