Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -re7c4a51e6057f0cc83fabc72f2df9bb5dffee391 -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision e7c4a51e6057f0cc83fabc72f2df9bb5dffee391) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -7,15 +7,15 @@ * * @file BloodFlow.c * -* @author (last) Dara Navaei -* @date (last) 26-Jul-2023 +* @author (last) Sean Nash +* @date (last) 17-Jul-2023 * * @author (original) Sean Nash * @date (original) 07-Nov-2019 * ***************************************************************************/ -#include // Used for fabs() and pow() functions +//#include // Used for fabs() functions #include "can.h" #include "etpwm.h" Index: firmware/App/Controllers/DGInterface.c =================================================================== diff -u -re7c4a51e6057f0cc83fabc72f2df9bb5dffee391 -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision e7c4a51e6057f0cc83fabc72f2df9bb5dffee391) +++ firmware/App/Controllers/DGInterface.c (.../DGInterface.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -96,14 +96,9 @@ static BOOL dgOpModeDataFreshFlag = FALSE; ///< Flag to signal the handleDGOpMode() to process fresh dg op mode data // Reservoir data -static DG_RESERVOIR_ID_T dgActiveReservoir = DG_RESERVOIR_2; ///< Latest active reservoir reported by the DG. -static DG_RESERVOIR_ID_T dgActiveReservoirSet = DG_RESERVOIR_2; ///< Active reservoir commanded. +static DG_RESERVOIR_ID_T dgActiveReservoir; ///< Latest active reservoir reported by the DG. +static DG_RESERVOIR_ID_T dgActiveReservoirSet; ///< Active reservoir commanded. -static U32 dgReservoirFillVolumeTarget = 0; ///< Latest fill-to volume reported by the DG. -static U32 dgReservoirFillVolumeTargetSet = 0; ///< Fill-to volume commanded. -static U32 dgReservoirDrainVolumeTarget = 0; ///< Latest drain-to volume reported by the DG. -static U32 dgReservoirDrainVolumeTargetSet = 0; ///< Drain-to volume commanded. - static DG_DISINFECT_UI_STATES_T disinfectsStatus; ///< DG disinfects status. static DG_MIXING_RATIOS_T dgMixingRatios; ///< DG mixing ratios. static HEATERS_DATA_T dgHeatersData; ///< DG heaters data. @@ -129,14 +124,13 @@ { U32 i, j; + // NOTE: the active reservoir is set to reservoir 1 since DG will send active reservoir 1 as active on power up dgStarted = FALSE; dgTrimmerHeaterOn = FALSE; dgTrimmerTempSet = 0.0F; dgTrimmerTempCheckTimerCtr = 0; - dgActiveReservoirSet = DG_RESERVOIR_2; - dgActiveReservoir = DG_RESERVOIR_2; - dgReservoirFillVolumeTargetSet = 0; - dgReservoirDrainVolumeTargetSet = 0; + dgActiveReservoirSet = DG_RESERVOIR_1; + dgActiveReservoir = DG_RESERVOIR_1; dgDialysateTemp = 0.0F; dgCurrentOpMode = DG_MODE_INIT; dgSubMode = 0; @@ -465,18 +459,31 @@ /*********************************************************************//** * @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 getRedundantDialysateTemperature function gets the latest redundant + * dialysate temperature. + * @details Inputs: dgRedundantDialysateTemp + * @details Outputs: none + * @return the latest redundant dialysate temperature + *************************************************************************/ +F32 getRedundantDialysateTemperature( void ) +{ + return dgRedundantDialysateTemp; +} + +/*********************************************************************//** + * @brief * The getHeatDisinfectTemperatureSensorValue function gets the latest * heat disinfect temperature sensor value. * @details Inputs: dgDialysateTemp @@ -503,21 +510,21 @@ /*********************************************************************//** * @brief - * The getDGDisinfectsStates function returns the DG disinfects readings. - * @details Inputs: none + * The getDialysateTemperature function returns the DG dialysate temperature. + * @details Inputs: dgDialysateTemp * @details Outputs: none - * @return the current DG disinfects readings + * @return the latest dialysate temperature *************************************************************************/ -DG_DISINFECT_UI_STATES_T getDGDisinfectsStates( void ) +F32 getDialysateTemperature( void ) { - return disinfectsStatus; + return dgDialysateTemp; } /*********************************************************************//** * @brief * The getDGMixingRatios function returns the DG mixing ratios and the fill * prep time. - * @details Inputs: none + * @details Inputs: dgMixingRatios * @details Outputs: none * @return getDGMixingRatios which is the DG mixing ratios *************************************************************************/ @@ -597,8 +604,7 @@ * The setDGReservoirsData function sets the latest reservoir data * reported by the DG. * @details Inputs: none - * @details Outputs: dgActiveReservoir, dgReservoirFillVolumeTarget, - * dgReservoirDrainVolumeTarget, dgReservoirsDataFreshFlag + * @details Outputs: dgActiveReservoir, dgReservoirsDataFreshFlag * @param resID ID of active reservoir * @param fillVol Reservoir fill to volume reported by DG * @param drainVol Reservoir drain to volume reported by DG @@ -609,8 +615,6 @@ if ( resID < NUM_OF_DG_RESERVOIRS ) { dgActiveReservoir = resID; - dgReservoirFillVolumeTarget = fillVol; - dgReservoirDrainVolumeTarget = drainVol; } else { @@ -908,7 +912,6 @@ void cmdStartDGFill( U32 fillToVolMl, F32 targetFlowLPM ) { dgCmdResp[ DG_CMD_START_FILL ].commandID = DG_CMD_NONE; - dgReservoirFillVolumeTargetSet = fillToVolMl; sendDGFillCommand( DG_CMD_START, fillToVolMl, targetFlowLPM ); } @@ -923,7 +926,6 @@ void cmdStopDGFill( void ) { dgCmdResp[ DG_CMD_STOP_FILL ].commandID = DG_CMD_NONE; - dgReservoirFillVolumeTargetSet = 0; sendDGFillCommand( DG_CMD_STOP, 0, 0 ); } @@ -947,7 +949,6 @@ payload.tareLoadCells = tareLoadCell; payload.rinseConcentrateLines = rinse; payload.cmd = start; - dgReservoirDrainVolumeTargetSet = drainToVolMl; sendDGDrainCommand( &payload ); } Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -re7c4a51e6057f0cc83fabc72f2df9bb5dffee391 -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision e7c4a51e6057f0cc83fabc72f2df9bb5dffee391) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -8,7 +8,7 @@ * @file DialInFlow.c * * @author (last) Sean Nash -* @date (last) 20-Jul-2023 +* @date (last) 17-Jul-2023 * * @author (original) Sean * @date (original) 16-Dec-2019 Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -re7c4a51e6057f0cc83fabc72f2df9bb5dffee391 -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision e7c4a51e6057f0cc83fabc72f2df9bb5dffee391) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -8,7 +8,7 @@ * @file DialOutFlow.c * * @author (last) Sean Nash -* @date (last) 20-Jul-2023 +* @date (last) 17-Jul-2023 * * @author (original) Sean * @date (original) 24-Jan-2020 @@ -22,7 +22,7 @@ #include "mibspi.h" #include "reg_het.h" -#include "Battery.h" +#include "CPLD.h" #include "DialOutFlow.h" #include "FPGA.h" #include "InternalADC.h" Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -re7c4a51e6057f0cc83fabc72f2df9bb5dffee391 -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision e7c4a51e6057f0cc83fabc72f2df9bb5dffee391) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -1201,31 +1201,34 @@ maxDeviation = MAX_DEVIATION_FROM_TRAGET_IN_POS_B; } - // Check if the current position has deviated from the position it is supposed to be in - // For more than a certain amount of time. If it has, raise an alarm - // Absolute value is used for comparison to cover +/- from the commanded position - if ( abs( currentPosition - commandedPosition ) > maxDeviation ) + if ( FALSE == isACPowerLost() ) { - valvesStatus[ valve ].positionOutOfRangeCounter++; - } + // Check if the current position has deviated from the position it is supposed to be in + // For more than a certain amount of time. If it has, raise an alarm + // Absolute value is used for comparison to cover +/- from the commanded position + if ( abs( currentPosition - commandedPosition ) > maxDeviation ) + { + valvesStatus[ valve ].positionOutOfRangeCounter++; + } - if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) - { - // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. - // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here - // because this is a monitor function that is called in the controller function. - valvesStatus[ valve ].execState = VALVE_STATE_IDLE; - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); + if ( valvesStatus[ valve ].positionOutOfRangeCounter > MAX_POS_DEVIATION_TIME_INTERVAL_COUNTER ) + { + // If the valve's deviation from target was more than the counts for the define period of time trigger the alarm. + // Also, set the state to Idle so in the fault mode, the valve can transition to Pos C. The exec state is directly set here + // because this is a monitor function that is called in the controller function. + valvesStatus[ valve ].execState = VALVE_STATE_IDLE; + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_VALVE_POSITION_OUT_OF_RANGE, (U32)valve, currentPosition ); - if ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) + if ( VALVE_POSITION_C_CLOSE == valvesStatus[ valve ].commandedPosition ) + { + activateSafetyShutdown(); + } + } + else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) { - activateSafetyShutdown(); + valvesStatus[ valve ].positionOutOfRangeCounter = 0; } } - else if ( ( TRUE == isValveCloseToCommandedPosition( valve, commandedPositionEnum ) ) && ( valvesStatus[ valve ].positionOutOfRangeCounter > 0 ) ) - { - valvesStatus[ valve ].positionOutOfRangeCounter = 0; - } } else { Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rc010db182189ddd988367e4ce70208ceae17ac62 -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision c010db182189ddd988367e4ce70208ceae17ac62) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -1099,6 +1099,10 @@ handleTreatmentRecircCmd( message ); break; + case MSG_ID_UI_POST_TX_NEXT_REQUEST: + handlePostTxNextCmd( message ); + break; + case MSG_ID_UI_TX_END_CMD_REQUEST: handleTreatmentEndCmd( message ); break; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rfc7328b2b8158c88e11a063204d7e87519f472ca -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision fc7328b2b8158c88e11a063204d7e87519f472ca) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -2108,7 +2108,7 @@ if ( (ALARM_ID_T)alarmID < NUM_OF_ALARM_IDS ) { - activateAlarm2Data( (ALARM_ID_T)alarmID, alm1, alm2 ); + activateAlarm2Data( (ALARM_ID_T)alarmID, alm1, alm2, TRUE ); } } } @@ -5504,6 +5504,7 @@ if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) { memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) { result = testSetBatteryRemainingCapacityOverride( payload.state.f32 ); @@ -8332,11 +8333,8 @@ *************************************************************************/ void handleTestHDDialinCheckIn( MESSAGE_T* message ) { - BOOL status = FALSE; - if ( 0 == message->hdr.payloadLen ) { - status = TRUE; setDialinCheckInTimeStamp(); } } Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rfc7328b2b8158c88e11a063204d7e87519f472ca -r0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision fc7328b2b8158c88e11a063204d7e87519f472ca) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 0772fa437a0f4bcbb58fbad9d6e1f0054efd0e28) @@ -944,9 +944,6 @@ // MSG_ID_HD_SEND_BLOOD_LEAK_EMB_MODE_RESPONSE BOOL sendBloodLeakEmbeddedModeCommandResponse( U08 cmd, U32 responseLen, U08* response ); -// MSG_ID_HD_SEND_ALARMS_COMMAND -void handleResendAllAlarmsCommand( MESSAGE_T* message ); - // MSG_ID_HD_BLOOD_PUMP_SET_PWM void handleTestBloodPumpSetPWM( MESSAGE_T* message );