Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -358,26 +358,26 @@ /*********************************************************************//** * @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; } /*********************************************************************//** * @brief - * The getDGDisinfectsStates function returns the DG disinfects readings. - * @details Inputs: none + * The getDialysateTemperature function gets the latest dialysate temperature. + * @details Inputs: dgDialysateTemp * @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; } /*********************************************************************//** @@ -872,6 +872,19 @@ /*********************************************************************//** * @brief + * The cmdSetDGToServiceMode function sends a request to DG to transition + * to service mode. + * @details Inputs: none + * @details Outputs: none + * @return none + *************************************************************************/ +void cmdSetDGToServiceMode( void ) +{ + sendDGServiceModeRequest(); +} + +/*********************************************************************//** + * @brief * The handleDGCommandResponse function processes the latest DG command response. * @details Inputs: none * @details Outputs: process command response from DG Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r8b73263b38f449dacc0795c67a7cf6240cb79026 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 8b73263b38f449dacc0795c67a7cf6240cb79026) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -74,30 +74,30 @@ /// Payload record structure for DG temperature sensors data message. typedef struct { - F32 inletPrimaryHeater; ///< Inlet primary heater temperature sensor - F32 outletPrimaryHeater; ///< Outlet primary heater temperature sensor - F32 conductivitySensor1; ///< Conductivity sensor 1 temperature sensor - F32 conductivitySensor2; ///< Conductivity sensor 2 temperature sensor - F32 outletRedundant; ///< Outlet redundant temperature sensor - F32 inletDialysate; ///< Inlet dialysate temperature sensor - F32 primaryHeaterThermocouple; ///< Primary heaters thermocouple sensor - F32 trimmerHeaterThermocouple; ///< Trimmer heater thermocouple sensor - F32 priamyHeaterColdjunction; ///< Primary heaters cold junction temperature sensor - F32 trimmerHeaterColdjunction; ///< Trimmer heater cold junction temperature sensor - F32 primaryHeaterInternal; ///< Primary heaters internal temperature (calculated from thermocouple and cold junction) - F32 trimmerHeaterInternal; ///< Trimmer heater internal temperature (calculated from thermocouple and cold junction) - F32 fpgaBoard; ///< FPGA board temperature sensor - F32 loadCellA1B1; ///< Load cell A1/B1 temperature sensor - F32 loadCellA2B2; ///< Load cell A2/B2 temperature sensor - F32 internalTHDORTD; ///< THDo RTD channel temperature sensor - F32 internalTDIRTD; ///< TDI RTD channel temperature sensor - F32 internalCondSnsrTemp; ///< Conductivity Sensor internal temperature sensor - U32 primaryThermoCoupleRaw; ///< Primary heaters thermocouple raw ADC value - U32 primaryColdjuncRaw; ///< Primary heaters cold junction raw ADC value - U32 trimmerThermoCoupleRaw; ///< Trimmer heater thermocouple raw ADC value - U32 trimmerColdjuncRaw; ///< Trimmer heater cold junction raw ADC value - S32 cond1Raw; ///< Conductivity sensor 1 raw temperature ADC value - S32 cond2Raw; ///< Conductivity sensor 2 raw temperature ADC value + F32 TPi; ///< Inlet primary heaters temperature sensor + F32 TPo; ///< Outlet primary heaters temperature sensor + F32 TD1; ///< Conductivity sensor 1 temperature sensor + F32 TD2; ///< Conductivity sensor 2 temperature sensor + F32 TRo; ///< Outlet redundant temperature sensor + F32 TDi; ///< Inlet dialysate temperature sensor + F32 HtrPrimThermo; ///< Primary heaters internal temperature sensor + F32 HtrTrimThermo; ///< Trimmer heater internal temperature sensor + F32 HtrPrimColdJunc; ///< Primary heaters cold junction temperature sensor + F32 HtrTrimColdJunc; ///< Trimmer heater cold junction temperature sensor + F32 HtrPrimInternal; ///< Primary heaters internal temperature + F32 HtrTrimInternal; ///< Trimmer heater internal temperature + F32 DGBoardTemp; ///< DG board temperature + F32 ResOneLoadCellTemp; ///< Reservoir 1 load cell sensor temperature + F32 ResTwoLoadCellTemp; ///< Reservoir 2 load cell sensor temperature + F32 THDoInternalTemp; ///< THDo RTD channel temperature sensor + F32 TDiInternalTemp; ///< TDI RTD channel temperature sensor + F32 internalCondSnsrTemp; ///< Conductivity Sensor internal temperature sensor + U32 primaryThermoCoupleRaw; ///< Primary heaters thermocouple raw ADC value + U32 primaryColdjuncRaw; ///< Primary heaters cold junction raw ADC value + U32 trimmerThermoCoupleRaw; ///< Trimmer heater thermocouple raw ADC value + U32 trimmerColdjuncRaw; ///< Trimmer heater cold junction raw ADC value + S32 cond1Raw; ///< Conductivity sensor 1 raw temperature ADC value + S32 cond2Raw; ///< Conductivity sensor 2 raw temperature ADC value } TEMPERATURE_SENSORS_DATA_T; /// Payload record structure for a drain reservoir command message. @@ -156,6 +156,7 @@ F32 getReservoirBackupWeightLargeFilter( DG_RESERVOIR_ID_T resID ); F32 getDialysateTemperature( void ); DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ); +F32 getDialysateTemperature( void ); DG_MIXING_RATIOS_T getDGMixingRatios( void ); void setDGOpMode( U32 opMode, U32 subMode ); @@ -184,6 +185,7 @@ void cmdStartDGChemicalDisinfect( void ); void cmdStopDGChemicalDisinfect( void ); void cmdRequestDGMixingRatios( void ); +void cmdSetDGToServiceMode( void ); void handleDGCommandResponse( DG_CMD_RESPONSE_T *dgCmdRespPtr ); BOOL getDGCommandResponse( U32 commandID, DG_CMD_RESPONSE_T *cmdRespPtr ); Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -92,6 +92,7 @@ /// Expected position of empty in relation to home position. #define SYRINGE_PUMP_EMPTY_POS ( SYRINGE_ENCODER_COUNTS_PER_ML * 10.84F ) + /// Margin of error for empty position determination. #define SYRINGE_PUMP_EMPTY_POS_MARGIN ( SYRINGE_ENCODER_COUNTS_PER_ML * 0.5F ) /// Minimum retract position. @@ -1985,6 +1986,7 @@ + /*********************************************************************//** * @brief * The testSetSyringePumpDataPublishIntervalOverride function overrides the Index: firmware/App/Modes/ConsumableSelfTest.c =================================================================== diff -u -r8b73263b38f449dacc0795c67a7cf6240cb79026 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 8b73263b38f449dacc0795c67a7cf6240cb79026) +++ firmware/App/Modes/ConsumableSelfTest.c (.../ConsumableSelfTest.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -106,6 +106,7 @@ if ( TRUE == consumableInstallConfirmed ) { consumableInstallConfirmed = FALSE; + #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_CONSUMABLES_TESTS ) ) { Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -52,6 +52,14 @@ #define MAX_ACTIVE_LOAD_CELL_CHANGE_G 50.0F ///< Maximum delta between new and previous measured UF volume. +/// Defined states for the Load Cell cycles. +typedef enum Reservoir_Steady_Cycle +{ + RESERVOIR_STEADY_CYCLE_START = 0, ///< Reservoir steady cycle load cell reading at Start + RESERVOIR_STEADY_CYCLE_FINAL, ///< Reservoir steady cycle load cell reading at Final + NUM_OF_RESERVOIR_STEADY_CYCLES ///< Number of Reservoir steady cycle load cell readings +} RESERVOIR_STEADY_CYCLE_T; + // ********** private data ********** static DIALYSIS_STATE_T currentDialysisState; ///< Current state of the dialysis sub-mode state machine. @@ -65,7 +73,7 @@ static F32 resCurrVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir current volume. static F32 resLastVolume[ NUM_OF_DG_RESERVOIRS ]; ///< Reservoir previous volume. static F32 measUFVolumeFromPriorReservoirs; ///< Current total ultrafiltration volume from previous reservoirs in current treatment. -static F32 lcLastSteadyWeight[NUM_OF_LOAD_CELLS]; ///< Load Cell Last Steady Weight for drift test +static F32 lcLastSteadyWeight[NUM_OF_RESERVOIR_STEADY_CYCLES][NUM_OF_LOAD_CELLS]; ///< Load Cell Last Steady Weight for drift test Start/Final cycle static U32 uFTimeMS; ///< Current elapsed ultrafiltration time (in ms). Used for calculating UF reference volume. static U32 lastUFTimeStamp; ///< HD timer value when we last took stock of ultrafiltration time (so we can determine how much time has elapsed since). @@ -107,7 +115,7 @@ static void updateUFVolumes( void ); static void publishSalineBolusData( void ); -static void checkLoadCellsStablePrimaryBackupDriftOutOfRange( DG_RESERVOIR_ID_T reservoirID ); +static void checkLoadCellsStablePrimaryBackupDriftOutOfRange( DG_RESERVOIR_ID_T reservoirID, RESERVOIR_STEADY_CYCLE_T cycle ); /*********************************************************************//** * @brief @@ -148,7 +156,8 @@ for (i=0; i ( LOAD_CELL_ILLEGAL_WEIGHT_VALUE + 1 ) ) + if ( ( RESERVOIR_STEADY_CYCLE_FINAL == cycle ) && ( lcLastSteadyWeight[RESERVOIR_STEADY_CYCLE_START][lcPrimaryIndex] > (LOAD_CELL_ILLEGAL_WEIGHT_VALUE + 1) ) ) { - // Weight has been previously saved, ok to test - loadCellPreviousDrift = lcLastSteadyWeight[lcPrimaryIndex] - lcLastSteadyWeight[lcBackupIndex]; + // Start Weight has been previously saved, ok to test + loadCellPreviousDrift = lcLastSteadyWeight[RESERVOIR_STEADY_CYCLE_START][lcPrimaryIndex] - lcLastSteadyWeight[RESERVOIR_STEADY_CYCLE_START][lcBackupIndex]; driftDiff = fabs ( loadCellCurrentDrift - loadCellPreviousDrift ); } // Save latest reading for next test time - lcLastSteadyWeight[ lcPrimaryIndex ] = loadCellPrimaryWeight; - lcLastSteadyWeight[ lcBackupIndex ] = loadCellBackupWeight; + lcLastSteadyWeight[cycle][lcPrimaryIndex] = loadCellPrimaryWeight; + lcLastSteadyWeight[cycle][lcBackupIndex] = loadCellBackupWeight; #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ULTRAFILTRATION_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -527,6 +527,7 @@ *************************************************************************/ static SELF_TEST_STATUS_T execUITest( void ) { + #ifndef DISABLE_UI_POST_TEST SELF_TEST_STATUS_T result = SELF_TEST_STATUS_IN_PROGRESS; @@ -554,6 +555,7 @@ #endif return result; + } /**@}*/ Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r8b73263b38f449dacc0795c67a7cf6240cb79026 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 8b73263b38f449dacc0795c67a7cf6240cb79026) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -478,12 +478,24 @@ * given reservoir. * @details Inputs: reservoirFilledStatus * @details Outputs: none - * @return TRUE if reservoir has been filled, otherwise FALSE; + * @return TRUE if reservoir has been filled, otherwise FALSE *************************************************************************/ BOOL getReservoirFillStatus( DG_RESERVOIR_ID_T reservoirID ) { return reservoirFilledStatus[ reservoirID ]; } +/*********************************************************************//** + * @brief + * The getPreTreatmentSubState function gets the current + * pre-treatment mode state. + * @details Inputs: currentPreTreatmentState + * @details Outputs: none + * @return currentPreTreatmentState + *************************************************************************/ +HD_PRE_TREATMENT_MODE_STATE_T getPreTreatmentSubState( void ) +{ + return currentPreTreatmentState; +} /*********************************************************************//** * @brief Index: firmware/App/Modes/ModePreTreat.h =================================================================== diff -u -r8b73263b38f449dacc0795c67a7cf6240cb79026 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 8b73263b38f449dacc0795c67a7cf6240cb79026) +++ firmware/App/Modes/ModePreTreat.h (.../ModePreTreat.h) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -62,7 +62,8 @@ void signalAlarmActionToPreTreatmentMode( ALARM_ACTION_T action ); // Execute alarm action as appropriate for pre-treatment mode -BOOL getReservoirFillStatus( DG_RESERVOIR_ID_T reservoirID ); +BOOL getReservoirFillStatus( DG_RESERVOIR_ID_T reservoirID ); // Get the fill complete status for given reservoir +HD_PRE_TREATMENT_MODE_STATE_T getPreTreatmentSubState( void ); // Get the current pre-treatment sub mode. BOOL testSetPreTreatmentModePublishIntervalOverride( U32 ms ); BOOL testResetPreTreatmentModePublishIntervalOverride( void ); Index: firmware/App/Modes/Prime.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -52,7 +52,7 @@ #define DIALYZER_VOLUME_SCALE_FACTOR 0.5F ///< Half of the dialyzer total volume. #define NO_AIR_DETECTED_COUNT ( 20 * MS_PER_SECOND ) ///< No air detected time period count. -#define PURGE_AIR_TIME_OUT_COUNT ( 60 * MS_PER_SECOND ) ///< Time period count for purge air time out. +#define PURGE_AIR_TIME_OUT_COUNT ( 120 * MS_PER_SECOND ) ///< Time period count for purge air time out. #define LOAD_CELL_STEADY_VOLUME_SAMPLING_TIME ( 1 * MS_PER_SECOND ) ///< Time load cell reading steady state detection sampling time in seconds. #define PRIME_DIALYSATE_BYPASS_TIME_LIMIT ( 15 * MS_PER_SECOND ) ///< Time limit for priming dialysate bypass circuit. #define STEADY_VOLUME_COUNT_SEC ( 10000 / LOAD_CELL_STEADY_VOLUME_SAMPLING_TIME ) ///< Counter must be greater than 10 seconds before steady volume is true. Index: firmware/App/Modes/SelfTests.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Modes/SelfTests.c (.../SelfTests.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -41,7 +41,7 @@ #define PUMP_RUN_SELF_TEST_TIME_MS ( 15 * MS_PER_SECOND ) ///< Self-test time to run pumps in ms. #define PUMP_SELF_TEST_FLOW_RATE_ML_MIN 100 ///< Self-test pump flow rate in mL/min. -#define SYRINGE_PUMP_OCCLUSION_CHECK_DELAY ( 3 * MS_PER_SECOND ) ///< Delay 3 seconds then check for syringe pump prime occlusion. +#define SYRINGE_PUMP_OCCLUSION_CHECK_DELAY ( 1 * MS_PER_SECOND ) ///< Delay 3 seconds then check for syringe pump prime occlusion. #define BLOOD_PUMP_RUN_TIME_PRESSURE_SELF_TEST ( 5 * MS_PER_SECOND ) ///< Pressure self-test time to run blood pump in ms. #define NORMALIZED_PRESSURE_SELF_TEST_TIME ( 4 * MS_PER_SECOND ) ///< Time to wait for pressure to normalize in ms. @@ -326,7 +326,7 @@ } else { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_NO_CART_SELF_TEST_TIMEOUT, currentNoCartSelfTestsState ); +// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_NO_CART_SELF_TEST_TIMEOUT, currentNoCartSelfTestsState ); } } } @@ -878,16 +878,19 @@ DRY_SELF_TESTS_STATE_T state = DRY_SELF_TESTS_USED_CARTRIDGE_CHECK_STATE; BUBBLE_STATUS_T const ADVBubbleStatus = getBubbleStatus( ADV ); + + SEND_EVENT_WITH_2_U32_DATA(HD_EVENT_DRY_SELF_TEST_CARTRIDGE_RESULT,(U32)ADVBubbleStatus,(U32)BUBBLE_DETECTED) + if ( ( BUBBLE_DETECTED == ADVBubbleStatus ) && ( AIR_TRAP_LEVEL_AIR == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_LOWER ) ) && ( AIR_TRAP_LEVEL_AIR == getAirTrapLevel( AIR_TRAP_LEVEL_SENSOR_UPPER ) ) ) { state = DRY_SELF_TESTS_OCCLUSION_SENSORS_STATE; } - else - { - activateAlarmNoData( ALARM_ID_INSTALL_NEW_CARTRIDGE ); - } +// else +// { +// activateAlarmNoData( ALARM_ID_INSTALL_NEW_CARTRIDGE ); +// } if ( TRUE == doesAlarmStatusIndicateStop() ) { @@ -1030,8 +1033,8 @@ { if ( TRUE == isSyringePumpPrimed() ) { + syringeOcclusionDelayStartTime = getMSTimerCount(); // Get the current time to check for occlusion after 1 second has elapsed state = DRY_SELF_TESTS_SYRINGE_PUMP_OCCLUSION_DETECTION_STATE; - syringeOcclusionDelayStartTime = getMSTimerCount(); // Get the current time to check for occlusion after 3 seconds has elapsed } else { @@ -1426,6 +1429,10 @@ } #endif + + SEND_EVENT_WITH_2_F32_DATA(HD_EVENT_WET_SELF_TEST_DISPLACEMENT_RESULT,resOneDiffAfterDisplacement,resOneDiffAfterDisplacement) + SEND_EVENT_WITH_2_F32_DATA(HD_EVENT_WET_SELF_TEST_DISPLACEMENT_RESULT,integratedVolumeDiff,WET_SELF_TEST_INTEGRATED_VOLUME_TOLERANCE) + if ( ( fabs( resOneDiffAfterDisplacement - resTwoDiffAfterDisplacement) <= WET_SELF_TEST_DISPLACEMENT_TOLERANCE_G ) && ( ( integratedVolumeDiff <= integrateVolumeToleranceG ) || ( integratedVolumeToTargetPercent <= WET_SELF_TEST_INTEGRATED_VOLUME_PCT_TOLERANCE ) ) ) @@ -1561,6 +1568,9 @@ } #endif + SEND_EVENT_WITH_2_F32_DATA(HD_EVENT_WET_SELF_TEST_DISPLACEMENT_RESULT,resOneDiffAfterDisplacement,resOneDiffAfterDisplacement) + SEND_EVENT_WITH_2_F32_DATA(HD_EVENT_WET_SELF_TEST_DISPLACEMENT_RESULT,integratedVolumeToTargetPercent,WET_SELF_TEST_INTEGRATED_VOLUME_TOLERANCE) + if ( ( fabs( resOneDiffAfterDisplacement - resTwoDiffAfterDisplacement) <= WET_SELF_TEST_DISPLACEMENT_TOLERANCE_G ) && ( integratedVolumeToTargetPercent <= integrateVolumeToleranceG ) ) { Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r8b73263b38f449dacc0795c67a7cf6240cb79026 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 8b73263b38f449dacc0795c67a7cf6240cb79026) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -245,8 +245,10 @@ U16 bloodLeakRxFIFOCount; ///< Reg 448. Blood leak receive FIFO count. U08 bloodLeakRxFIFODataOut; ///< Reg 450. Blood leak receive FIFO data out. U08 dummyByte; ///< Reg 451. Dummy byte to meet the even of the data. + U16 fpgaCompatibilityRev; ///< Reg 452. Compatibility revisions U08 bloodLeakSelfTestErrorCounter; ///< Reg 452. Blood leak self test error counter. U08 bloodLeakZeroErrorCounter; ///< Reg 453. Blood leak zero error counter. + } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -931,25 +933,18 @@ { SELF_TEST_STATUS_T result; - // Check FPGA reported correct ID + // check FPGA reported correct ID if ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) { // Check FPGA compatibility w/ firmware - if ( fpgaHeader.fpgaRevMajor > MIN_HD_FPGA_MAJOR ) + if ( HD_FPGA_COMPATIBILITY_REV == fpgaSensorReadings.fpgaCompatibilityRev ) { result = SELF_TEST_STATUS_PASSED; } else { - if ( fpgaHeader.fpgaRev >= MIN_HD_FPGA_MINOR ) - { - result = SELF_TEST_STATUS_PASSED; - } - else - { - result = SELF_TEST_STATUS_FAILED; - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_FPGA_POST_TEST_FAILED, (U32)fpgaHeader.fpgaRevMajor, (U32)fpgaHeader.fpgaRev ) - } + result = SELF_TEST_STATUS_FAILED; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_FPGA_POST_TEST_FAILED, (U32)HD_FPGA_COMPATIBILITY_REV, (U32)fpgaSensorReadings.fpgaCompatibilityRev ) } } else Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -52,8 +52,7 @@ #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window #define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< Maximum time for a Denali message that requires ACK to be ACK'd - -#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST +#define MSG_NOT_ACKED_TIMEOUT_MS_INIT 5000 ///< Maximum time for a Denali message that requires ACK to be ACK'd on the INIT state for the first (UI version request) message of the POST #define MSG_NOT_ACKED_MAX_RETRIES 3 ///< Maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm #define PENDING_ACK_LIST_SIZE 25 ///< Maximum number of Denali messages that can be pending ACK at any given time @@ -1614,10 +1613,6 @@ handleTestSyringePumpHeprinBolusTargetRateOverrideRequest( message ); break; - case MSG_ID_HD_REQ_CURRENT_TREATMENT_PARAMETERS: - handleTestCurrentTreamtmentParametersRequest( message ); - break; - case MSG_ID_HD_FANS_DUTY_CYCLE_OVERRIDE: handleSetFansDutyCycleOverrideRequest( message ); break; @@ -1654,6 +1649,7 @@ handleResendAllAlarmsCommand( message ); break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -28,6 +28,7 @@ #include "Fans.h" #include "FPGA.h" #include "ModeStandby.h" +#include "ModeInitPOST.h" #include "OperationModes.h" #include "RTC.h" #include "SampleWater.h" @@ -2359,13 +2360,13 @@ { TEMPERATURE_SENSORS_DATA_T payload; - memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); - setDialysateTemperatureReadings( payload.inletDialysate, payload.outletRedundant ); - } - // TODO - what to do if invalid payload length? - // TODO - how to know if DG stops sending these? -} - + memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); + setDialysateTemperatureReadings( payload.TDi, payload.TRo ); + } + // TODO - what to do if invalid payload length? + // TODO - how to know if DG stops sending these? +} + /*********************************************************************//** * @brief * The handleDialysateFlowData function handles dialysate flow data broadcast @@ -5155,6 +5156,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingPercentOverride( payload.state.u32 ); @@ -7030,15 +7032,26 @@ { BOOL status = FALSE; HD_OP_MODE_T currentMode = getCurrentOperationMode(); + DG_OP_MODE_T currentDGMode = getDGOpMode(); REQUEST_REJECT_REASON_CODE_T reject; if ( 0 == message->hdr.payloadLen ) { if ( ( MODE_STAN == currentMode ) || ( MODE_FAUL == currentMode ) ) { - status = TRUE; + requestNewOperationMode( MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; + + if ( (DG_MODE_STAN == currentDGMode) || (DG_MODE_FAUL == currentDGMode) ) + { + status = TRUE; + cmdSetDGToServiceMode(); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } } else { @@ -7316,4 +7329,28 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The sendDGServiceModeRequest function constructs a service mode request msg + * to the DG and queues the msg for transmit on the appropriate CAN channel. + * @details Inputs: none + * @details Outputs: DG Service mode request msg constructed and queued. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendDGServiceModeRequest() +{ + BOOL result; + MESSAGE_T msg; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_DG_SERVICE_MODE; + msg.hdr.payloadLen = 0; + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_HD_2_DG, ACK_REQUIRED ); + + return result; +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rc20c77ef196a760a7642d2426e509995e4a98e01 -r1b2472b1717a9964df9267278e046bc5c8ed26a1 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision c20c77ef196a760a7642d2426e509995e4a98e01) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 1b2472b1717a9964df9267278e046bc5c8ed26a1) @@ -395,6 +395,15 @@ // MSG_ID_DG_START_STOP_CHEM_DISINFECT BOOL sendDGStartChemicalDisinfectModeCommand( BOOL start ); +// MSG_ID_HD_RESPONSE_SERVICE_MODE_REQUEST +void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ); + +// MSG_ID_HD_REQUEST_DG_SERVICE_MODE +BOOL sendDGServiceModeRequest( void ); + +// MSG_ID_UI_REQUEST_SERVICE_MODE +void handleUIServiceModeRequest( MESSAGE_T *message ); + // MSG_ID_ALARM_STATUS BOOL broadcastAlarmStatus( COMP_ALARM_STATUS_T almStatus ); @@ -422,9 +431,6 @@ // MSG_ID_HD_SET_SW_CONFIG_RECORD void handleSetHDSoftwareConfigRecord( MESSAGE_T *message ); -// MSG_ID_UI_REQUEST_SERVICE_MODE -void handleUIServiceModeRequest( MESSAGE_T *message ); -void sendUIServiceModeResponse( BOOL accepted, U32 rejCode ); // MSG_ID_HD_REQUEST_DG_ALARMS BOOL sendRequestForDGResendAlarms( void );