Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -r70d33c50c8c3fd987f39eaa1f3b294860d569830 -r2bdd010a62ea113058640fc1e9c763dcf885c93c --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 70d33c50c8c3fd987f39eaa1f3b294860d569830) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 2bdd010a62ea113058640fc1e9c763dcf885c93c) @@ -937,25 +937,33 @@ if ( ++bpMotorSpeedCalcTimerCtr >= BP_SPEED_CALC_INTERVAL ) { U16 bpMotorHallSensorCount = getFPGABloodPumpHallSensorCount(); + U16 last = bpLastMotorHallSensorCounts[ bpMotorSpeedCalcIdx ]; U32 nextIdx = INC_WRAP( bpMotorSpeedCalcIdx, 0, BP_SPEED_CALC_BUFFER_LEN - 1 ); U16 incDelta = ( bpMotorHallSensorCount >= bpLastMotorHallSensorCounts[ nextIdx ] ? \ bpMotorHallSensorCount - bpLastMotorHallSensorCounts[ nextIdx ] : \ ( HEX_64_K - bpLastMotorHallSensorCounts[ nextIdx ] ) + bpMotorHallSensorCount ); U16 decDelta = HEX_64_K - incDelta; - U16 delta; - + U16 spdDelta; + U16 delta; + + // Keep a running 32-bit edge count used for safety check on volume in some functions + bloodPumpMotorEdgeCount += delta; + // Determine blood pump speed/direction from delta hall sensor count since last interval if ( incDelta < decDelta ) { - delta = incDelta; - bloodPumpSpeedRPM.data = ( (F32)delta / (F32)BP_HALL_EDGE_COUNTS_PER_REV ) * (F32)SEC_PER_MIN; + spdDelta = incDelta; + bloodPumpSpeedRPM.data = ( (F32)spdDelta / (F32)BP_HALL_EDGE_COUNTS_PER_REV ) * (F32)SEC_PER_MIN; + delta = ( bpMotorHallSensorCount >= last ? bpMotorHallSensorCount - last : ( HEX_64_K - last ) + bpMotorHallSensorCount ); + bloodPumpMotorEdgeCount += delta; } else { - delta = decDelta; - bloodPumpSpeedRPM.data = ( (F32)delta / (F32)BP_HALL_EDGE_COUNTS_PER_REV ) * (F32)SEC_PER_MIN * -1.0; + spdDelta = decDelta; + bloodPumpSpeedRPM.data = ( (F32)spdDelta / (F32)BP_HALL_EDGE_COUNTS_PER_REV ) * (F32)SEC_PER_MIN * -1.0; + delta = ( bpMotorHallSensorCount <= last ? last - bpMotorHallSensorCount : ( HEX_64_K - bpMotorHallSensorCount ) + last ); + bloodPumpMotorEdgeCount -= (S32)delta; } - bloodPumpMotorEdgeCount += delta; // Update last count for next time bpLastMotorHallSensorCounts[ nextIdx ] = bpMotorHallSensorCount; Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r893bdb4ea1636ae343babcd830d6ddf7c71535d0 -r2bdd010a62ea113058640fc1e9c763dcf885c93c --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 893bdb4ea1636ae343babcd830d6ddf7c71535d0) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 2bdd010a62ea113058640fc1e9c763dcf885c93c) @@ -163,7 +163,6 @@ static S32 syringePumpHomePositionOffset; ///< FPGA reported position when at home postion. static S32 syringePumpPosition1SecAgo; ///< Position recorded at last 1 Hz speed check. -static BOOL syringePumpHasBeenHomed; ///< Flag indicates whether syringe pump has been homed at least once (indicates position is known). static BOOL syringePumpRetractRequested; ///< Flag indicates a retract operation is requested. static BOOL syringePumpPrimeRequested; ///< Flag indicates plunger seek and Heparin prime operations are requested. static BOOL syringePumpSeekToPrimeRequested; ///< Flag indicates plunger seek finished, pump stopped, now requesting prime operation. @@ -226,8 +225,6 @@ syringePumpHomePositionOffset = 0; syringePumpPosition1SecAgo = 0; - syringePumpHasBeenHomed = FALSE; - syringePumpDataPublicationTimerCounter = 0; syringePumpSelfTestTimerCount = 0; syringePumpSpeedCalcTimerCounter = 0; @@ -1283,5 +1280,70 @@ return result; } + +BOOL testSyringePumpOperationRequest( U32 op, F32 rate, F32 volume ) +{ + +} + +BOOL testSetSyringePumpMeasuredRateOverride( U32 value ) +{ + +} + +BOOL testResetSyringePumpMeasuredRateOverride( void ) +{ + +} + +BOOL testSetSyringePumpMeasuredForceOverride( U32 value ) +{ + +} + +BOOL testResetSyringePumpMeasuredForceOverride( void ) +{ + +} + +BOOL testSetSyringePumpMeasuredSyringeDetectOverride( U32 value ) +{ + +} + +BOOL testResetSyringePumpMeasuredSyringeDetectOverride( void ) +{ + +} + +BOOL testSetSyringePumpMeasuredHomeOverride( U32 value ) +{ + +} + +BOOL testResetSyringePumpMeasuredHomeOverride( void ) +{ + +} + +BOOL testSetSyringePumpMeasuredPositionOverride( U32 value ) +{ + +} + +BOOL testResetSyringePumpMeasuredPositionOverride( void ) +{ + +} + +BOOL testSetSyringePumpMeasuredVolumeOverride( U32 value ) +{ + +} + +BOOL testResetSyringePumpMeasuredVolumeOverride( void ) +{ + +} /**@}*/ Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -racb165deff7036d41bbe12678f35cd9539012838 -r2bdd010a62ea113058640fc1e9c763dcf885c93c --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision acb165deff7036d41bbe12678f35cd9539012838) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 2bdd010a62ea113058640fc1e9c763dcf885c93c) @@ -44,6 +44,16 @@ F32 syringePumpMeasForce; } SYRINGE_PUMP_DATA_PAYLOAD_T; +/// Enumeration of syringe pump operations. +typedef enum SyringePumpOperations +{ + SYRINGE_PUMP_OP_STOP = 0 + SYRINGE_PUMP_OP_RETRACT = 1 + SYRINGE_PUMP_OP_SEEK_AND_PRIME = 2 + SYRINGE_PUMP_OP_BOLUS = 3 + SYRINGE_PUMP_OP_CONTINUOUS = 4 +} SYRINGE_PUMP_OPERATION_T; + // ********** public function prototypes ********** void initSyringePump( void ); @@ -65,6 +75,19 @@ BOOL testSetSyringePumpDataPublishIntervalOverride( U32 value ); BOOL testResetSyringePumpDataPublishIntervalOverride( void ); +BOOL testSyringePumpOperationRequest( U32 op, F32 rate, F32 volume ); +BOOL testSetSyringePumpMeasuredRateOverride( U32 value ); +BOOL testResetSyringePumpMeasuredRateOverride( void ); +BOOL testSetSyringePumpMeasuredForceOverride( U32 value ); +BOOL testResetSyringePumpMeasuredForceOverride( void ); +BOOL testSetSyringePumpMeasuredSyringeDetectOverride( U32 value ); +BOOL testResetSyringePumpMeasuredSyringeDetectOverride( void ); +BOOL testSetSyringePumpMeasuredHomeOverride( U32 value ); +BOOL testResetSyringePumpMeasuredHomeOverride( void ); +BOOL testSetSyringePumpMeasuredPositionOverride( U32 value ); +BOOL testResetSyringePumpMeasuredPositionOverride( void ); +BOOL testSetSyringePumpMeasuredVolumeOverride( U32 value ); +BOOL testResetSyringePumpMeasuredVolumeOverride( void ); /**@}*/ Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -r70d33c50c8c3fd987f39eaa1f3b294860d569830 -r2bdd010a62ea113058640fc1e9c763dcf885c93c --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 70d33c50c8c3fd987f39eaa1f3b294860d569830) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 2bdd010a62ea113058640fc1e9c763dcf885c93c) @@ -736,7 +736,7 @@ setUFRate = 0.0; } // Handle saline bolus start request from user - else if ( TRUE == salineBolusStartRequested ) + if ( TRUE == salineBolusStartRequested ) { if ( SALINE_BOLUS_STATE_IDLE == currentSalineBolusState ) { Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r70d33c50c8c3fd987f39eaa1f3b294860d569830 -r2bdd010a62ea113058640fc1e9c763dcf885c93c --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 70d33c50c8c3fd987f39eaa1f3b294860d569830) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 2bdd010a62ea113058640fc1e9c763dcf885c93c) @@ -142,6 +142,11 @@ postState = handlePOSTStatus( testStatus ); break; + case POST_STATE_ALARM_LAMP: + testStatus = execAlarmLampTest(); + postState = handlePOSTStatus( testStatus ); + break; + case POST_STATE_ACCELEROMETER: #ifndef DISABLE_ACCELS testStatus = execAccelTest(); @@ -151,11 +156,6 @@ postState = handlePOSTStatus( testStatus ); break; - case POST_STATE_ALARM_LAMP: - testStatus = execAlarmLampTest(); - postState = handlePOSTStatus( testStatus ); - break; - // Should be last POST case POST_STATE_STUCK_BUTTON: testStatus = execStuckButtonTest();