Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -rcc4f8440e8ad7fa8f2ced2467d922be7422c344c -r9944e4f766d9eb4cdf7a5ca7587e3ceca556e106 --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision cc4f8440e8ad7fa8f2ced2467d922be7422c344c) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 9944e4f766d9eb4cdf7a5ca7587e3ceca556e106) @@ -7,8 +7,8 @@ * * @file ModeTreatment.c * -* @author (last) Dara Navaei -* @date (last) 22-Feb-2022 +* @author (last) Darren Cox +* @date (last) 11-May-2022 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -25,6 +25,7 @@ #include "Dialysis.h" #include "ModeTreatment.h" #include "ModeTreatmentParams.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "Reservoirs.h" #include "Rinseback.h" @@ -244,6 +245,9 @@ initTreatmentRecirc(); initTreatmentEnd(); + // Started the treatment set the start time in epoch + setTxLastStartTimeEpoch( getRTCTimestamp() ); + return currentTreatmentState; } @@ -736,6 +740,7 @@ // Kick dialysis sub-mode off setDialysisParams( getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ), getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ), presMaxUFVolumeML, presUFRate ); + sendTreatmentLogEventData( UF_START_RESUME_EVENT, 0.0, presUFRate ); transitionToDialysis(); result = TREATMENT_DIALYSIS_STATE; } @@ -805,6 +810,7 @@ static TREATMENT_STATE_T handleTreatmentStopState( void ) { TREATMENT_STATE_T result = TREATMENT_STOP_STATE; + BOOL leavingTreatmentStopState = TRUE; // If user requests resumption of treatment, resume treatment if ( TRUE == resumeTreatmentAlarmResponseRequest ) @@ -840,8 +846,19 @@ { execReservoirs(); execTreatmentStop(); + leavingTreatmentStopState = FALSE; } + // If leaving treatment stop state, zero alarm countdown timer for UI + if ( TRUE == leavingTreatmentStopState ) + { + TREATMENT_STOP_PAYLOAD_T data; + + data.timeout = 0; + data.countdown = 0; + broadcastData( MSG_ID_HD_TREATMENT_STOP_TIMER_DATA, COMM_BUFFER_OUT_CAN_HD_BROADCAST, (U08*)&data, sizeof( TREATMENT_STOP_PAYLOAD_T ) ); + } + return result; } @@ -1170,6 +1187,7 @@ } else // Must be adjusting UF rate then { + sendTreatmentLogEventData( UF_RATE_CHANGE_EVENT, presUFRate, pendingUFRateChange ); presUFRate = pendingUFRateChange; } setDialysisParams( getTreatmentParameterU32( TREATMENT_PARAM_BLOOD_FLOW ), getTreatmentParameterU32( TREATMENT_PARAM_DIALYSATE_FLOW ),