Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -r954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file DGInterface.c +* @file DGInterface.c * -* @author (last) Sean Nash -* @date (last) 24-Sep-2020 +* @author (last) Quang Nguyen +* @date (last) 24-Aug-2021 * -* @author (original) Sean -* @date (original) 08-Apr-2020 +* @author (original) Sean +* @date (original) 08-Apr-2020 * ***************************************************************************/ @@ -23,6 +23,7 @@ #include "ModeTreatment.h" #include "ModeTreatmentParams.h" #include "OperationModes.h" +#include "PersistentAlarm.h" #include "SystemCommMessages.h" #include "Timers.h" @@ -33,15 +34,22 @@ // ********** private definitions ********** -#define START_DG_CMD TRUE ///< Parameter for DG start/stop command function. True = start. -#define STOP_DG_CMD FALSE ///< Parameter for DG start/stop command function. False = stop. +#define START_DG_CMD TRUE ///< Parameter for DG start/stop command function. True = start. +#define STOP_DG_CMD FALSE ///< Parameter for DG start/stop command function. False = stop. -#define RESERVOIR_SETTLE_TIME_MS 5000 ///< Time (in ms) allotted for reservoir to settle (after fill, before drain). +#define RESERVOIR_SETTLE_TIME_MS 5000 ///< Time (in ms) allotted for reservoir to settle (after fill, before drain). -#define MAX_RESERVOIR_VOLUME_ML 1950.0 ///< Maximum reservoir volume. Switch reservoirs if active reservoir exceeds this volume. +#define MAX_RESERVOIR_VOLUME_ML 1950.0 ///< Maximum reservoir volume. Switch reservoirs if active reservoir exceeds this volume. -#define SIZE_OF_LARGE_LOAD_CELL_AVG 32 ///< Large load cell moving average has 32 samples. +#define SIZE_OF_LARGE_LOAD_CELL_AVG 32 ///< Large load cell moving average has 32 samples. +#define DIALYSATE_TEMP_PERSISTENCE_PERIOD ( 3 * MS_PER_SECOND ) ///< Persistence period for dialysate temperature alarm. + +#define DIALYSATE_TEMP_RECOVERY_TOLERANCE_C 2.0 ///< Dialysate temperature recovery tolerance in degree C. +#define DIALYSATE_TEMP_TOLERANCE_C 4.0 ///< Dialysate temperature tolerance in degree C. +#define DIALYSATE_TEMP_HIGH_LIMIT_C 42.0 ///< Dialysate high temperature limit in degree C. +#define DIALYSATE_TEMP_LOW_LIMIT_C 33.0 ///< Dialysate low temperature limit in degree C. + /// States of the treatment reservoir management state machine. typedef enum TreatmentReservoirMgmt_States { @@ -158,6 +166,9 @@ lgLoadCellReadingsIdx = 0; lgLoadCellReadingsTotal[ DG_RESERVOIR_1 ] = 0.0; lgLoadCellReadingsTotal[ DG_RESERVOIR_2 ] = 0.0; + + initPersistentAlarm( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, DIALYSATE_TEMP_PERSISTENCE_PERIOD, DIALYSATE_TEMP_PERSISTENCE_PERIOD ); + initPersistentAlarm( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, DIALYSATE_TEMP_PERSISTENCE_PERIOD, DIALYSATE_TEMP_PERSISTENCE_PERIOD ); } /*********************************************************************//** @@ -485,18 +496,6 @@ /*********************************************************************//** * @brief - * The getDialysateTemperature function gets the latest dialysate temperature. - * @details Inputs: dgDialysateTemp - * @details Outputs: none - * @return the current dialysate temperature - *************************************************************************/ -F32 getDialysateTemperature( void ) -{ - return dgDialysateTemp; -} - -/*********************************************************************//** - * @brief * The getDGDisinfectsStates function returns the DG disinfects readings. * @details Inputs: none * @details Outputs: disinfectsStatus @@ -509,6 +508,18 @@ /*********************************************************************//** * @brief + * The getDialysateTemperature function gets the latest dialysate temperature. + * @details Inputs: dgDialysateTemp + * @details Outputs: none + * @return the current dialysate temperature + *************************************************************************/ +F32 getDialysateTemperature( void ) +{ + return dgDialysateTemp; +} + +/*********************************************************************//** + * @brief * The getReservoirWeight function gets the load cell weight of a given reservoir. * @details Inputs: loadCellWeightInGrams[] * @details Outputs: none @@ -1026,6 +1037,47 @@ /*********************************************************************//** * @brief + * The checkDialysateTemperature function checks the dialysate temperature + * reported by DG and alarm if temperature is out of range. + * @details Inputs: dgTrimmerTempSet, dgDialysateTemp, dgRedundantDialysateTemp + * @details Outputs: alarm if dialysate temperature is out of accepted range + * @return none + *************************************************************************/ +void checkDialysateTemperature( void ) +{ + BOOL const dialysateHighTemp = ( ( ( dgDialysateTemp - dgTrimmerTempSet ) > DIALYSATE_TEMP_TOLERANCE_C ) || + ( dgDialysateTemp > DIALYSATE_TEMP_HIGH_LIMIT_C ) ); + + BOOL const dialysateLowTemp = ( ( ( dgTrimmerTempSet - dgDialysateTemp ) > DIALYSATE_TEMP_TOLERANCE_C ) || + ( dgDialysateTemp < DIALYSATE_TEMP_LOW_LIMIT_C ) ); + + BOOL const dialysateTempRecovered = fabs( dgDialysateTemp - dgTrimmerTempSet ) < DIALYSATE_TEMP_RECOVERY_TOLERANCE_C ? TRUE : FALSE; + +#ifndef DISABLE_DIALYSATE_TEMP_CHECK + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dialysateHighTemp ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dgTrimmerTempSet, dgDialysateTemp ); + } + + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dialysateLowTemp ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dgTrimmerTempSet, dgDialysateTemp ); + } + + if ( TRUE == isPersistentAlarmConditionCleared( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH, dialysateHighTemp ) ) + { + clearAlarmCondition( ALARM_ID_DIALYSATE_TEMPERATURE_HIGH ); + } + + if ( TRUE == isPersistentAlarmConditionCleared( ALARM_ID_DIALYSATE_TEMPERATURE_LOW, dialysateTempRecovered ) ) + { + clearAlarmCondition( ALARM_ID_DIALYSATE_TEMPERATURE_LOW ); + } +#endif +} + +/*********************************************************************//** + * @brief * The checkDGRestart function checks to see if DG has restarted after started * by HD and triggers appropriate alarm. * @details Inputs: dgStarted Index: firmware/App/Controllers/DGInterface.h =================================================================== diff -u -r954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision 954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac) +++ firmware/App/Controllers/DGInterface.h (.../DGInterface.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file DGInterface.h +* @file DGInterface.h * -* @author (last) Sean Nash -* @date (last) 05-Oct-2020 +* @author (last) Quang Nguyen +* @date (last) 09-Aug-2021 * -* @author (original) Sean -* @date (original) 08-Apr-2020 +* @author (original) Sean +* @date (original) 08-Apr-2020 * ***************************************************************************/ @@ -54,30 +54,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. @@ -124,8 +124,8 @@ F32 getLoadCellWeight( LOAD_CELL_ID_T loadCellID ); F32 getReservoirWeight( DG_RESERVOIR_ID_T resID ); F32 getReservoirWeightLargeFilter( DG_RESERVOIR_ID_T resID ); -F32 getDialysateTemperature( void ); DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ); +F32 getDialysateTemperature( void ); void setDGOpMode( U32 opMode, U32 subMode ); void setDialysateTemperatureReadings( F32 temp1, F32 temp2 ); @@ -156,6 +156,8 @@ void handleDGCommandResponse( DG_CMD_RESPONSE_T *dgCmdRespPtr ); BOOL getDGCommandResponse( U32 commandID, DG_CMD_RESPONSE_T *cmdRespPtr ); +void checkDialysateTemperature( void ); + BOOL testSetDialOutLoadCellWeightOverride( U32 sensor, F32 value ); BOOL testResetDialOutLoadCellWeightOverride( U32 sensor ); Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -5,13 +5,13 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file DialInFlow.c +* @file DialInFlow.c * -* @author (last) H. Nguyen -* @date (last) 28-Oct-2021 +* @author (last) H. Nguyen +* @date (last) 28-Oct-2021 * -* @author (original) Sean -* @date (original) 16-Dec-2019 +* @author (original) Sean +* @date (original) 16-Dec-2019 * ***************************************************************************/ @@ -97,7 +97,7 @@ #define DIP_GEAR_RATIO 32.0 ///< DialIn pump motor to dialIn pump gear ratio. #define DIP_PWM_ZERO_OFFSET 0.1 ///< 10% PWM duty cycle = zero speed. /// Macro converts flow rate to estimate PWM needed to achieve it. // TODO - I added 1.2 gain based on empirical data -#define DIP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DIP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DIP_GEAR_RATIO * DIP_MOTOR_RPM_TO_PWM_DC_FACTOR * 1.2 + DIP_PWM_ZERO_OFFSET ) +#define DIP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DIP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DIP_GEAR_RATIO * DIP_MOTOR_RPM_TO_PWM_DC_FACTOR * 1.258 + DIP_PWM_ZERO_OFFSET ) /// Conversion from PWM duty cycle % to commanded pump motor speed. #define DIP_PWM_TO_MOTOR_SPEED_RPM(pwm) ( ((pwm) - DIP_PWM_ZERO_OFFSET) * 4000.0 ) @@ -953,7 +953,9 @@ if ( lastDialInPumpDirectionCount != dirErrorCnt ) { lastDialInPumpDirectionCount = dirErrorCnt; +#ifndef DISABLE_PUMP_DIRECTION_CHECKS SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_PUMP_DIRECTION_STATUS_ERROR, (U32)HD_PUMP_DIALYSATE_INLET_PUMP ) +#endif } #endif Index: firmware/App/Controllers/DialInFlow.h =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/DialInFlow.h (.../DialInFlow.h) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Controllers/DialInFlow.h (.../DialInFlow.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file DialInFlow.h +* @file DialInFlow.h * -* @author (last) Sean Nash -* @date (last) 03-Aug-2020 +* @author (last) Sean Nash +* @date (last) 13-Aug-2021 * -* @author (original) Sean -* @date (original) 16-Dec-2019 +* @author (original) Sean +* @date (original) 16-Dec-2019 * ***************************************************************************/ Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r84e94699ac1a6236a6aba130e45149a9cf3ac5f8 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 84e94699ac1a6236a6aba130e45149a9cf3ac5f8) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file PresOccl.c +* @file PresOccl.c * -* @author (last) Sean Nash -* @date (last) 24-Sep-2020 +* @author (last) Sean Nash +* @date (last) 19-Aug-2021 * -* @author (original) Sean -* @date (original) 15-Jan-2020 +* @author (original) Sean +* @date (original) 15-Jan-2020 * ***************************************************************************/ @@ -576,11 +576,11 @@ if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) { signalBloodPumpHardStop(); // Stop pump immediately - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + //SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) } else if ( bpOccl < ( OCCLUSION_CLEAR_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) { - clearAlarmCondition( ALARM_ID_OCCLUSION_BLOOD_PUMP ); + //clearAlarmCondition( ALARM_ID_OCCLUSION_BLOOD_PUMP ); } #endif } Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file SyringePump.c +* @file SyringePump.c * -* @author (last) Sean Nash -* @date (last) 02-Mar-2021 +* @author (last) Sean Nash +* @date (last) 13-Aug-2021 * -* @author (original) Sean Nash -* @date (original) 02-Mar-2021 +* @author (original) Sean Nash +* @date (original) 04-Mar-2021 * ***************************************************************************/ #include Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -rccfd15568f1e3d304320c2babb2fd4bcf0413304 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision ccfd15568f1e3d304320c2babb2fd4bcf0413304) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -84,6 +84,7 @@ BOOL retractSyringePump( void ); BOOL seekSyringePlunger( void ); BOOL primeSyringePump( void ); +void resetHeparinVolumeDelivered( void ); BOOL startHeparinBolus( void ); BOOL startHeparinContinuous( void ); BOOL setSyringePumpDACVref( F32 vRef ); Index: firmware/App/HDCommon.h =================================================================== diff -u -r84e94699ac1a6236a6aba130e45149a9cf3ac5f8 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 84e94699ac1a6236a6aba130e45149a9cf3ac5f8) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file HDCommon.h +* @file HDCommon.h * -* @author (last) Sean Nash -* @date (last) 14-Oct-2020 +* @author (last) Sean Nash +* @date (last) 14-Oct-2020 * -* @author (original) Sean -* @date (original) 27-Feb-2020 +* @author (original) Sean +* @date (original) 27-Feb-2020 * ***************************************************************************/ @@ -25,7 +25,7 @@ #define HD_VERSION_MAJOR 0 #define HD_VERSION_MINOR 6 #define HD_VERSION_MICRO 0 -#define HD_VERSION_BUILD 0 +#define HD_VERSION_BUILD 103 // ********** development build switches ********** @@ -57,8 +57,9 @@ #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks #define DISABLE_SYRINGE_PUMP 1 // Disable syringe pump functionality #define ALWAYS_ALLOW_SYRINGE_PUMP_CMDS 1 // Allow syringe pump commands at any time except when pump is busy -// #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks -// #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks + #define DISABLE_UF_ALARMS 1 // Do not error on HD ultrafiltration checks + #define DISABLE_DIALYSATE_TEMP_CHECK 1 // Disable dialysate temperature check + #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks #define DISABLE_VALVE_ALARMS 1 // Do not error on HD valve position #define SKIP_CAL_CHECK 1 // // #define RUN_PUMPS_OPEN_LOOP 1 // BP and DPi pumps will be run open loop (no flow sensor feedback) @@ -71,11 +72,11 @@ #define DISABLE_OCCLUSION_SELF_TEST 1 // Skip occlusion sensor self-test. // #define SKIP_CARTRIDGE_REMOVAL 1 // Skip cartridge removal check // #define DISABLE_FPGA_COUNTER_CHECKS 1 // Disable alarms associated with FPGA read/error counters -// #define DISABLE_VOLTAGE_MONITOR 1 // Disable voltage monitoring/alarms + #define DISABLE_VOLTAGE_MONITOR 1 // Disable voltage monitoring/alarms #define ALLOW_1_MIN_TREATMENT_DURATION 1 // Allow user to change treatment duration to as low as 1 minute #define DISABLE_SYRINGE_PUMP_ALARMS 1 // Disable some syringe pump alarms that are triggering intermittently // #define NO_PUMP_FLOW_LIMITS 1 // Allow any commanded flow rate for peristaltic pumps -// #define DISABLE_BUBBLE_ALARMS 1 // Disable bubble alarms + #define DISABLE_BUBBLE_ALARMS 1 // Disable bubble alarms #define DISABLE_UI_POST_TEST 1 // Disable the UI POST // Skip Pre-Treatment and get to treatment as soon as possible Index: firmware/App/Modes/BloodPrime.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Modes/BloodPrime.c (.../BloodPrime.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -5,13 +5,13 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file TreatmentEnd.c +* @file BloodPrime.c * -* @author (last) Sean Nash -* @date (last) 04-Feb-2021 +* @author (last) Sean Nash +* @date (last) 13-Aug-2021 * -* @author (original) Sean -* @date (original) 04-Feb-2021 +* @author (original) Sean Nash +* @date (original) 06-Feb-2021 * ***************************************************************************/ Index: firmware/App/Modes/BloodPrime.h =================================================================== diff -u -rccfd15568f1e3d304320c2babb2fd4bcf0413304 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/BloodPrime.h (.../BloodPrime.h) (revision ccfd15568f1e3d304320c2babb2fd4bcf0413304) +++ firmware/App/Modes/BloodPrime.h (.../BloodPrime.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -41,7 +41,7 @@ { F32 targetBloodPrimeVolumeMl; F32 deliveredBloodPrimeVolumeMl; - F32 indDeliveredBloodPrimeVolumeMl; + F32 unused; } BLOOD_PRIME_DATA_PAYLOAD_T; // ********** public function prototypes ********** @@ -54,8 +54,6 @@ BOOL testSetBloodPrimeVolumeOverride( F32 vol ); BOOL testResetBloodPrimeVolumeOverride( void ); -BOOL testSetBloodPrimeSafetyVolumeOverride( F32 vol ); -BOOL testResetBloodPrimeSafetyVolumeOverride( void ); BOOL testSetBloodPrimePublishIntervalOverride( U32 ms ); BOOL testResetBloodPrimePublishIntervalOverride( void ); Index: firmware/App/Modes/Dialysis.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Modes/Dialysis.c (.../Dialysis.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file Dialysis.c +* @file Dialysis.c * -* @author (last) Sean Nash -* @date (last) 24-Sep-2020 +* @author (last) Sean Nash +* @date (last) 19-Aug-2021 * -* @author (original) Sean -* @date (original) 15-Jan-2020 +* @author (original) Sean +* @date (original) 15-Jan-2020 * ***************************************************************************/ Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -r954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file ModePostTreat.c +* @file ModePostTreat.c * -* @author (last) Sean Nash -* @date (last) 08-Oct-2020 +* @author (last) Quang Nguyen +* @date (last) 24-Aug-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -5,13 +5,13 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file ModePreTreat.c +* @file ModePreTreat.c * -* @author (last) Sean Nash -* @date (last) 06-Oct-2020 +* @author (last) Quang Nguyen +* @date (last) 24-Aug-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ @@ -388,6 +388,10 @@ case ALARM_ACTION_END_TREATMENT: if ( HD_PRE_TREATMENT_PRIME_STATE > currentPreTreatmentState ) { + if ( HD_PRE_TREATMENT_WATER_SAMPLE_STATE == currentPreTreatmentState ) + { + cmdDGSampleWater( SAMPLE_WATER_CMD_END ); + } requestNewOperationMode( MODE_STAN ); } else Index: firmware/App/Modes/ModeTreatmentParams.c =================================================================== diff -u -ra8234afee1db86505836151ab4bf061e490eadb1 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision a8234afee1db86505836151ab4bf061e490eadb1) +++ firmware/App/Modes/ModeTreatmentParams.c (.../ModeTreatmentParams.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file ModeTreatmentParams.c +* @file ModeTreatmentParams.c * -* @author (last) Sean Nash -* @date (last) 14-Oct-2020 +* @author (last) Sean Nash +* @date (last) 13-Aug-2021 * -* @author (original) Sean Nash -* @date (original) 29-May-2020 +* @author (original) Sean Nash +* @date (original) 29-May-2020 * ***************************************************************************/ Index: firmware/App/Modes/Rinseback.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Modes/Rinseback.c (.../Rinseback.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file Rinseback.c +* @file Rinseback.c * -* @author (last) Sean Nash -* @date (last) 14-Jan-2021 +* @author (last) Quang Nguyen +* @date (last) 01-Sep-2021 * -* @author (original) Sean -* @date (original) 14-Jan-2021 +* @author (original) Sean Nash +* @date (original) 20-Jan-2021 * ***************************************************************************/ Index: firmware/App/Modes/Rinseback.h =================================================================== diff -u -rccfd15568f1e3d304320c2babb2fd4bcf0413304 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/Rinseback.h (.../Rinseback.h) (revision ccfd15568f1e3d304320c2babb2fd4bcf0413304) +++ firmware/App/Modes/Rinseback.h (.../Rinseback.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -44,7 +44,7 @@ U32 rinsebackFlowRateMlMin; U32 timeout; U32 countdown; - F32 safetyRinsebackVolumeMl; + F32 unused; } RINSEBACK_DATA_PAYLOAD_T; #pragma pack(pop) @@ -60,8 +60,6 @@ BOOL testSetRinsebackVolumeOverride( F32 vol ); BOOL testResetRinsebackVolumeOverride( void ); -BOOL testSetRinsebackSafetyVolumeOverride( F32 vol ); -BOOL testResetRinsebackSafetyVolumeOverride( void ); BOOL testSetRinsebackPublishIntervalOverride( U32 ms ); BOOL testResetRinsebackPublishIntervalOverride( void ); Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -r954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 954107454f4c5d4cfbdfaefda5cc1cd15b1e18ac) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -5,13 +5,13 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file TreatmentEnd.c +* @file TreatmentEnd.c * -* @author (last) Sean Nash -* @date (last) 04-Feb-2021 +* @author (last) Sean Nash +* @date (last) 19-Aug-2021 * -* @author (original) Sean -* @date (original) 04-Feb-2021 +* @author (original) Sean Nash +* @date (original) 05-Feb-2021 * ***************************************************************************/ Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file SystemComm.c +* @file SystemComm.c * -* @author (last) Sean Nash -* @date (last) 14-Oct-2020 +* @author (last) Quang Nguyen +* @date (last) 23-Aug-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ @@ -195,7 +195,7 @@ if ( TRUE == isAlarmActive( ALARM_ID_DG_COMM_TIMEOUT ) ) { - clearAlarm( ALARM_ID_DG_COMM_TIMEOUT ); + clearAlarmCondition( ALARM_ID_DG_COMM_TIMEOUT ); } } Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file SystemCommMessages.c +* @file SystemCommMessages.c * -* @author (last) Peman Montazemi -* @date (last) 18-Mar-2021 +* @author (last) Sean Nash +* @date (last) 19-Aug-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ @@ -2254,7 +2254,7 @@ TEMPERATURE_SENSORS_DATA_T payload; memcpy( &payload, message->payload, sizeof( TEMPERATURE_SENSORS_DATA_T ) ); - setDialysateTemperatureReadings( payload.inletDialysate, payload.outletRedundant ); + setDialysateTemperatureReadings( payload.TDi, payload.TRo ); } // TODO - what to do if invalid payload length? // TODO - how to know if DG stops sending these? @@ -5119,6 +5119,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 ); Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -re45524455c005d4fa1734efcbaf7ed0499302670 -rea0ed778cde80abbb042a8a0a8ef56b3a434dfb2 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision e45524455c005d4fa1734efcbaf7ed0499302670) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision ea0ed778cde80abbb042a8a0a8ef56b3a434dfb2) @@ -1,17 +1,17 @@ /************************************************************************** * -* Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * -* @file SystemCommMessages.h +* @file SystemCommMessages.h * -* @author (last) Sean Nash -* @date (last) 14-Oct-2020 +* @author (last) Sean Nash +* @date (last) 19-Aug-2021 * -* @author (original) Dara Navaei -* @date (original) 05-Nov-2019 +* @author (original) Dara Navaei +* @date (original) 05-Nov-2019 * ***************************************************************************/ @@ -23,6 +23,7 @@ #include "BloodLeak.h" #include "BloodPrime.h" #include "Bubble.h" +#include "CommBuffers.h" #include "DGInterface.h" #include "DialInFlow.h" #include "DialOutFlow.h" @@ -56,7 +57,10 @@ * @{ */ -// ********** public definitions ********** +// ********** public definitions ********** + +#define ACK_REQUIRED TRUE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. +#define ACK_NOT_REQUIRED FALSE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. #define ACK_REQUIRED TRUE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. #define ACK_NOT_REQUIRED FALSE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. @@ -67,7 +71,10 @@ U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); // ACK MSG -BOOL sendACKMsg( MESSAGE_T *message ); +BOOL sendACKMsg( MESSAGE_T *message ); + +// Serialize message +U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); // MSG_ID_DG_CHECK_IN void handleDGCheckIn( MESSAGE_T *message );