Index: NVDataMgmt.c =================================================================== diff -u -r2e09881186cf980912956f5c1f490fecc1f44fbb -r3b70d6b53c78039aa9b7b2546a0137e906966519 --- NVDataMgmt.c (.../NVDataMgmt.c) (revision 2e09881186cf980912956f5c1f490fecc1f44fbb) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision 3b70d6b53c78039aa9b7b2546a0137e906966519) @@ -8,7 +8,7 @@ * @file NVDataMgmt.c * * @author (last) Dara Navaei -* @date (last) 06-Mar-2024 +* @date (last) 09-May-2024 * * @author (original) Dara Navaei * @date (original) 12-Feb-2020 @@ -130,6 +130,7 @@ #ifdef _HD_ #define DEFAULT_BLOOD_LEAK_SET_POINT 20 ///< Blood leak default set point. #define DEFAULT_HEPARIN_PUMP_VOLTAGE 0.15F ///< Heparin pump default voltage. +#define DEFAULT_ENABLE_CHEM_DISINFECT 0 ///< Disable chemical disinfect in institutional record. #endif // DG specific defines @@ -937,9 +938,15 @@ BOOL scheduleStatus = enqueueSector0Records(); #ifdef _HD_ + MESSAGE_T institMsg; // Got new data for the EEPROM records, set the latest institutional record to treatment parameters to make sure // the treatment parameters have the record available all the time setNVInstitutionalRecordToTxParamsRecord( &hdInstitutionalGroup.hdInstitutionalRecord ); + + // Received new institutional record and it is valid, send it to the UI to be up to date + institMsg.hdr.msgID = 0; + institMsg.hdr.payloadLen = 0; + handleSendInstitutionalRecordToUI( &institMsg ); #endif // Signal that there is a new calibration record available. @@ -1522,6 +1529,21 @@ return status; } + +/*********************************************************************//** + * @brief + * The isChemDisinfectEnabledInInstitRecord returns the enable/disable + * status of the chemical disinfect in institutional record + * @details Inputs: hdInstitutionalGroup + * Output: none + * @return TRUE if chemical disinfect is enabled otherwise, FALSE + *************************************************************************/ +BOOL isChemDisinfectEnabledInInstitRecord( void ) +{ + BOOL status = ( DEFAULT_ENABLE_CHEM_DISINFECT == hdInstitutionalGroup.hdInstitutionalRecord.enableChemicalDisinfect ? FALSE : TRUE ); + + return status; +} #endif #ifdef _DG_ /*********************************************************************//** @@ -1760,6 +1782,7 @@ #ifdef _HD_ case NVDATAMGMT_INTITUTIONAL_RECORD: hdInstitutionalGroup.hdInstitutionalRecord.crc = crc; + status = enqueueSector0Records(); break; #endif } @@ -1864,6 +1887,14 @@ newCalStartTimer = getMSTimerCount(); isNewCalAvailable = TRUE; nvDataMgmtSelfTestResult = SELF_TEST_STATUS_PASSED; + +#ifdef _HD_ + MESSAGE_T institMsg; + // Received new institutional record and it is valid, send it to the UI to be up to date + institMsg.hdr.msgID = 0; + institMsg.hdr.payloadLen = 0; + handleSendInstitutionalRecordToUI( &institMsg ); +#endif } else { @@ -3366,7 +3397,7 @@ // CRC did not pass so set all values to default record->maxResidualFluid = RECORD_DEFAULT_CONST; record->normalFillVolume = RECORD_DEFAULT_CONST; - record->rsrvrUnfilledWeight = RECORD_DEFAULT_CONST; + record->rsrvrUnfilledWeight = EMPTY_RESERVOIR_WEIGHT_GRAMS; record->rsrvrVolume = RECORD_DEFAULT_CONST; record->calibrationTime = RECORD_DEFAULT_TIME; record->crc = crc16 ( (U08*)record, sizeof(DG_RESERVOIR_VOLUME_DATA_T) - sizeof(U16) ); @@ -3914,30 +3945,31 @@ if ( calcCRC != recordCRC ) { // CRC did not pass so set all values to default - hdInstitutionalGroup.hdInstitutionalRecord.minBloodFlowMLPM = getU32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_BLOOD_FLOW ); - hdInstitutionalGroup.hdInstitutionalRecord.maxBloodFlowMLPM = getU32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_BLOOD_FLOW ); - hdInstitutionalGroup.hdInstitutionalRecord.minDialysateFlowMLPM = getU32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_DIALYSATE_FLOW ); - hdInstitutionalGroup.hdInstitutionalRecord.maxDialysateFlowMLPM = getU32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_DIALYSATE_FLOW ); - hdInstitutionalGroup.hdInstitutionalRecord.minTxDurationMIN = getU32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_TREATMENT_DURATION ); - hdInstitutionalGroup.hdInstitutionalRecord.maxTxDurationMIN = getU32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_TREATMENT_DURATION ); - hdInstitutionalGroup.hdInstitutionalRecord.minStopHeparinDispBeforeTxEndMIN = getU32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_HEPARIN_PRE_STOP_TIME ); - hdInstitutionalGroup.hdInstitutionalRecord.maxStopHeparinDispBeforeTxEndMIN = getU32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_HEPARIN_PRE_STOP_TIME ); - hdInstitutionalGroup.hdInstitutionalRecord.minSalineBolusVolumeML = getU32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_SALINE_BOLUS_VOLUME ); - hdInstitutionalGroup.hdInstitutionalRecord.maxSalineBolusVolumeML = getU32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_SALINE_BOLUS_VOLUME ); - hdInstitutionalGroup.hdInstitutionalRecord.minDialysateTempC = getF32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_DIALYSATE_TEMPERATURE ); - hdInstitutionalGroup.hdInstitutionalRecord.maxDialysateTempC = getF32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_DIALYSATE_TEMPERATURE ); - hdInstitutionalGroup.hdInstitutionalRecord.minArtPressLimitWindowMMHG = getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW ); - hdInstitutionalGroup.hdInstitutionalRecord.maxArtPressLimitWindowMMHG = getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW ); - hdInstitutionalGroup.hdInstitutionalRecord.minVenPressLimitWindowMMHG = getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW ); - hdInstitutionalGroup.hdInstitutionalRecord.maxVenPressLimitWindowMMHG = getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW ); - hdInstitutionalGroup.hdInstitutionalRecord.minVenAsymPressLimitMMHG = getS32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC ); - hdInstitutionalGroup.hdInstitutionalRecord.maxVenAsymPressLimitMMHG = getS32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC ); - hdInstitutionalGroup.hdInstitutionalRecord.minUFVolumeL = getF32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_UF_VOLUME ); - hdInstitutionalGroup.hdInstitutionalRecord.maxUFVolumeL = getF32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_UF_VOLUME ); - hdInstitutionalGroup.hdInstitutionalRecord.minHeparinDispRateMLPHR = getF32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_HEPARIN_DISPENSE_RATE ); - hdInstitutionalGroup.hdInstitutionalRecord.maxHeparinDispRateMLPHR = getF32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_HEPARIN_DISPENSE_RATE ); - hdInstitutionalGroup.hdInstitutionalRecord.minHeparinBolusVolumeML = getF32TreatmentParamLowerRangeLimit( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME ); - hdInstitutionalGroup.hdInstitutionalRecord.maxHeparinBolusVolumeML = getF32TreatmentParamUpperRangeLimit( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME ); + hdInstitutionalGroup.hdInstitutionalRecord.minBloodFlowMLPM = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_BLOOD_FLOW, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxBloodFlowMLPM = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_BLOOD_FLOW, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minDialysateFlowMLPM = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_DIALYSATE_FLOW, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxDialysateFlowMLPM = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_DIALYSATE_FLOW, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minTxDurationMIN = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_TREATMENT_DURATION, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxTxDurationMIN = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_TREATMENT_DURATION, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minStopHeparinDispBeforeTxEndMIN = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_HEPARIN_PRE_STOP_TIME, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxStopHeparinDispBeforeTxEndMIN = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_HEPARIN_PRE_STOP_TIME, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minSalineBolusVolumeML = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_SALINE_BOLUS_VOLUME, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxSalineBolusVolumeML = getU32DefaultTreatmentParamEdge( TREATMENT_PARAM_SALINE_BOLUS_VOLUME, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minDialysateTempC = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_DIALYSATE_TEMPERATURE, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxDialysateTempC = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_DIALYSATE_TEMPERATURE, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minArtPressLimitWindowMMHG = getS32DefaultTreatmentParamEdge( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxArtPressLimitWindowMMHG = getS32DefaultTreatmentParamEdge( TREATMENT_PARAM_ART_PRES_LIMIT_WINDOW, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minVenPressLimitWindowMMHG = getS32DefaultTreatmentParamEdge( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxVenPressLimitWindowMMHG = getS32DefaultTreatmentParamEdge( TREATMENT_PARAM_VEN_PRES_LIMIT_WINDOW, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minVenAsymPressLimitMMHG = getS32DefaultTreatmentParamEdge( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxVenAsymPressLimitMMHG = getS32DefaultTreatmentParamEdge( TREATMENT_PARAM_VEN_PRES_LIMIT_ASYMMETRIC, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minUFVolumeL = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_UF_VOLUME, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxUFVolumeL = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_UF_VOLUME, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minHeparinDispRateMLPHR = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_HEPARIN_DISPENSE_RATE, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxHeparinDispRateMLPHR = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_HEPARIN_DISPENSE_RATE, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.minHeparinBolusVolumeML = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME, TRUE ); + hdInstitutionalGroup.hdInstitutionalRecord.maxHeparinBolusVolumeML = getF32DefaultTreatmentParamEdge( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME, FALSE ); + hdInstitutionalGroup.hdInstitutionalRecord.enableChemicalDisinfect = DEFAULT_ENABLE_CHEM_DISINFECT; hdInstitutionalGroup.hdInstitutionalRecord.calibrationTime = getRTCTimestamp(); hdInstitutionalGroup.hdInstitutionalRecord.crc = crc16 ( (U08*)&hdInstitutionalGroup.hdInstitutionalRecord, sizeof( HD_INSTITUTIONAL_RECORD_T ) - sizeof( U16 ) );