Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r33c3a81272ce8c9bae64ae20537e9be45b11edd0 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 33c3a81272ce8c9bae64ae20537e9be45b11edd0) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -154,7 +154,7 @@ uFAccuracyCheckTimerCtr = 0; lastUFVolumeChecked = 0.0; - for ( i = 0; i= (F32)MAX_UF_ACCURACY_ERROR_ML ) + if ( ( fabs( refUFVolume - measUFVolume ) ) > (F32)MAX_UF_ACCURACY_ERROR_ML ) { #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r660876bca7ae34f862ae9cc6feef9a30ec02fe94 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 660876bca7ae34f862ae9cc6feef9a30ec02fe94) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -122,7 +122,12 @@ signalBloodPumpHardStop(); signalDialInPumpHardStop(); signalDialOutPumpHardStop(); - // TODO - turn off air pump +#ifndef _RELEASE_ + if ( SW_CONFIG_DISABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_AIR_PUMP ) ) +#endif + { + setAirPumpState( AIR_PUMP_STATE_OFF ); + } // Ensure all valves are in safe position setValveAirTrap( STATE_CLOSED ); Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -r775f8ad98cccfd06d712ab339d1d88e3e640803c -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 775f8ad98cccfd06d712ab339d1d88e3e640803c) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -458,8 +458,6 @@ *************************************************************************/ static HD_POST_TREATMENT_STATE_T handlePostTreatmentVerifyState( void ) { - // Assuming the cartridge door is removed already. - // This is used when the disable cartridge removal step software configuration is enabled BOOL isCartridgeRemoved = TRUE; #ifndef _RELEASE_ Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -r660876bca7ae34f862ae9cc6feef9a30ec02fe94 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 660876bca7ae34f862ae9cc6feef9a30ec02fe94) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -63,18 +63,23 @@ setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_END_TREATMENT, FALSE ); - // Start out with all actuators de-energized in service mode + // Start out with all actuators off in service mode (exception for valves which will be in insert position to allow cartridge insert) cmdStopDGTrimmerHeater(); stopSyringePump(); signalBloodPumpHardStop(); signalDialInPumpHardStop(); signalDialOutPumpHardStop(); - // TODO - turn off air pump +#ifndef _RELEASE_ + if ( SW_CONFIG_DISABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_AIR_PUMP ) ) +#endif + { + setAirPumpState( AIR_PUMP_STATE_OFF ); + } setValveAirTrap( STATE_CLOSED ); - setValvePosition( VDI, VALVE_POSITION_C_CLOSE ); - setValvePosition( VDO, VALVE_POSITION_C_CLOSE ); - setValvePosition( VBA, VALVE_POSITION_C_CLOSE ); - setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + setValvePosition( VDI, VALVE_POSITION_A_INSERT_EJECT ); + setValvePosition( VDO, VALVE_POSITION_A_INSERT_EJECT ); + setValvePosition( VBA, VALVE_POSITION_A_INSERT_EJECT ); + setValvePosition( VBV, VALVE_POSITION_A_INSERT_EJECT ); return 0; } Index: firmware/App/Modes/Rinseback.c =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -497,19 +497,19 @@ if ( ( rinsebackTimerCtr > MAX_RINSEBACK_DONE_TIME ) && ( getRinsebackVolume() >= rinsebackTargetVolume_mL ) ) { signalGoToTreatmentStopped(); - activateAlarmNoData( ALARM_ID_TREATMENT_RINSEBACK_TIMEOUT_ALARM ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TREATMENT_RINSEBACK_TIMEOUT_ALARM, rinsebackTimerCtr, MAX_RINSEBACK_DONE_TIME ); clearAlarm( ALARM_ID_HD_TREATMENT_RINSEBACK_TIMEOUT_WARNING ); } // Have we been in this stopped state for too long despite having delivered full blood volume back to patient? else if ( ( RINSEBACK_DONE_WARNING_TIME == rinsebackTimerCtr ) && ( getRinsebackVolume() >= rinsebackTargetVolume_mL ) ) { - activateAlarmNoData( ALARM_ID_HD_TREATMENT_RINSEBACK_TIMEOUT_WARNING ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_TREATMENT_RINSEBACK_TIMEOUT_WARNING, rinsebackTimerCtr, RINSEBACK_DONE_WARNING_TIME ); } // Have we been in this stopped state for too long w/o having delivered full blood volume back to patient? else if ( ( rinsebackTimerCtr > MAX_RINSEBACK_TIME ) && ( getRinsebackVolume() < rinsebackTargetVolume_mL ) ) { signalGoToTreatmentStopped(); - activateAlarmNoData( ALARM_ID_TREATMENT_RINSEBACK_TIMEOUT_ALARM ); + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TREATMENT_RINSEBACK_TIMEOUT_ALARM, rinsebackTimerCtr, MAX_RINSEBACK_TIME ); } else if ( TRUE == recircRequested ) { @@ -518,7 +518,7 @@ else if ( TRUE == additionalRinsebackRequested ) { additionalRinsebackRequested = FALSE; - // deliver additional rinseback volume only if max volume not reached and max time not reached + // deliver additional rinseback volume only if max time not reached or max volume has been reached (i.e. no more blood in line) if ( ( rinsebackTimerCtr < MAX_RINSEBACK_TIME ) || ( getRinsebackVolume() >= rinsebackTargetVolume_mL ) ) { rinsebackAdditionalTimerCtr = 0; @@ -904,7 +904,7 @@ { *rejReason = REQUEST_REJECT_REASON_TREATMENT_IS_COMPLETED; } - else if ( RINSEBACK_STOP_STATE != rinsebackState ) + else if ( rinsebackState != RINSEBACK_STOP_STATE ) { *rejReason = REQUEST_REJECT_REASON_ACTION_DISABLED_IN_CURRENT_STATE; } Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -139,9 +139,10 @@ { U08 errorCountProcessor; ///< Reg 256. TBD. U08 errorCountPC; ///< Reg 257. TBD. - U08 fpgaHWConfigReg; ///< Reg 258. Hardware configuration register (i.e. BETA or DVT) - U08 reserved2; ///< Reg 259. Reserved. - F32 reserved3; ///< Reg 260. Reserved. + U08 fpgaHWConfigReg; ///< Reg 258. Hardware configuration register (i.e. BETA or DVT) + U08 sPumpDACRdStatus; ///< Reg 259. Syringe pump DAC read status. + U16 sPumpDACSet; ///< Reg 260. Syringe pump DAC setting. + U16 sPumpDACEEProm; ///< Reg 262. Syringe pump DAC EEProm data. U08 reserved4; ///< Reg 264. Reserved. U08 reserved5; ///< Reg 265. Reserved. U08 reserved6; ///< Reg 266. Reserved. @@ -1642,6 +1643,50 @@ /*********************************************************************//** * @brief + * The getFPGASyringePumpDACStatus function gets the latest syringe pump + * DAC status. + * Bit 0: PD0 + * Bit 1: PD1 + * Bit 2: POR + * Bit 3: Ready (not busy) + * Bits 4..7: N/A + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last syringe pump DAC status reading + *************************************************************************/ +U08 getFPGASyringePumpDACStatus( void ) +{ + return fpgaSensorReadings.sPumpDACRdStatus; +} + +/*********************************************************************//** + * @brief + * The getFPGASyringePumpDACSetting function gets the latest syringe pump + * DAC setting. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last syringe pump DAC setting + *************************************************************************/ +U16 getFPGASyringePumpDACSetting( void ) +{ + return fpgaSensorReadings.sPumpDACSet; +} + +/*********************************************************************//** + * @brief + * The getFPGASyringePumpDACStoredSetting function gets the latest syringe + * pump DAC setting stored in sensor's EEPROM. + * @details Inputs: fpgaSensorReadings + * @details Outputs: none + * @return last syringe pump DAC setting stored in EEPROM + *************************************************************************/ +U16 getFPGASyringePumpDACStoredSetting( void ) +{ + return fpgaSensorReadings.sPumpDACEEProm; +} + +/*********************************************************************//** + * @brief * The getFPGATimerCount function gets the latest FPGA timer millisecond count. * @details Inputs: fpgaSensorReadings * @details Outputs: none Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -98,6 +98,9 @@ U16 getFPGASyringePumpADCChannel1( void ); U16 getFPGASyringePumpADCChannel2( void ); U16 getFPGASyringePumpADCChannel3( void ); +U08 getFPGASyringePumpDACStatus( void ); +U16 getFPGASyringePumpDACSetting( void ); +U16 getFPGASyringePumpDACStoredSetting( void ); U16 getFPGATimerCount( void ); Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -ra4436011a3f30a7b20474c3ddb4d4373ac4b87b6 -r43d1739837a207e6d4d2960f3f0442af85b22a8c --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision a4436011a3f30a7b20474c3ddb4d4373ac4b87b6) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 43d1739837a207e6d4d2960f3f0442af85b22a8c) @@ -30,8 +30,6 @@ #define RESERVOIR_DEPLETION_INTERVAL ( MAX_RESERVOIR_DEPLETION_TIME_MS / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) for maximum allowed depletion time. #define DIALYSATE_FLOW_RATE_350_ML_PER_MIN 0.35F ///< Dialysate flow rate 350 mL/min. -#define DIALYSATE_FLOW_RATE_400_ML_PER_MIN 0.4F ///< Dialysate flow rate 400 mL/min. -#define DIALYSATE_FLOW_RATE_500_ML_PER_MIN 0.5F ///< Dialysate flow rate 500 mL/min. #define DIALYSATE_FLOW_RATE_550_ML_PER_MIN 0.55F ///< Dialysate flow rate 550 mL/min. #define TGT_FILL_FLOW_FOR_DIA_FLOW_100_TO_350_ML_PER_MIN 0.5F ///< Target fill flow rate for dialysate flow rates in between 100 to 350 mL/min. #define TGT_FILL_FLOW_FOR_DIA_FLOW_550_TO_600_ML_PER_MIN 0.8F ///< Target fill flow rate for dialysate flow rates in between 500 to 600 mL/min. @@ -297,16 +295,16 @@ { fillFlowRate = TGT_FILL_FLOW_FOR_DIA_FLOW_100_TO_350_ML_PER_MIN; } - else if ( ( dialysateFlow >= DIALYSATE_FLOW_RATE_400_ML_PER_MIN ) && ( dialysateFlow <= DIALYSATE_FLOW_RATE_500_ML_PER_MIN ) ) + else if ( dialysateFlow >= DIALYSATE_FLOW_RATE_550_ML_PER_MIN ) { + fillFlowRate = TGT_FILL_FLOW_FOR_DIA_FLOW_550_TO_600_ML_PER_MIN; + } + else + { // fill flow = 10 x dialysate_flow ^ 2 - 7.5 x dialysate_flow + 2.0 fillFlowRate = pow( dialysateFlow, 2 ) * DIA_FLOW_TO_FILL_FLOW_SECOND_ORDER_COEFF - dialysateFlow * DIA_FLOW_TO_FILL_FLOW_FIRST_ORDER_COEFF + DIA_FLOW_TO_FILL_FLOW_CONSTANT; } - else if ( dialysateFlow >= DIALYSATE_FLOW_RATE_550_ML_PER_MIN ) - { - fillFlowRate = TGT_FILL_FLOW_FOR_DIA_FLOW_550_TO_600_ML_PER_MIN; - } targetFillFlowLPM = fillFlowRate;