Index: firmware/App/Modes/ModeTreatment.c =================================================================== diff -u -r521a0569bf3097e9f7075d9c0e99dca9af3e6410 -re0e66d4c302c2aa43951ca316689ed4debbff1fb --- firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision 521a0569bf3097e9f7075d9c0e99dca9af3e6410) +++ firmware/App/Modes/ModeTreatment.c (.../ModeTreatment.c) (revision e0e66d4c302c2aa43951ca316689ed4debbff1fb) @@ -1,4 +1,4 @@ -/************************************************************************** +/**********************************************************************//** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * @@ -32,41 +32,46 @@ static U32 start; #endif + /** + * @addtogroup TreatmentMode + * @{ + */ + // ********** private definitions ********** -#define MAX_TREATMENT_TIME_MINUTES ( 8 * MIN_PER_HOUR ) -#define MAX_UF_RATE_ML_MIN ( (F32)2500 / (F32)MIN_PER_HOUR ) -#define MAX_DIALYSATE_VOLUME_ML ( 180 * ML_PER_LITER ) +#define MAX_TREATMENT_TIME_MINUTES ( 8 * MIN_PER_HOUR ) ///< Maximum treatment time (in minutes). +#define MAX_UF_RATE_ML_MIN ( (F32)2500 / (F32)MIN_PER_HOUR ) ///< Maximum ultrafiltration rate (in mL/min). +#define MAX_DIALYSATE_VOLUME_ML ( 180 * ML_PER_LITER ) ///< Maximum dialysate volume (in mL). -#define TREATMENT_TIME_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) // interval (ms/task time) at which the treatment time data is published on the CAN bus +#define TREATMENT_TIME_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the treatment time & state data is published on the CAN bus // ********** private data ********** -static TREATMENT_STATE_T currentTreatmentState; +static TREATMENT_STATE_T currentTreatmentState; ///< Current state (sub-mode) of treatment mode. -static U32 presTreatmentTimeSecs; -static U32 presBloodFlowRate; -static U32 presDialysateFlowRate; -static F32 presMaxUFVolumeML; -static F32 presUFRate; +static U32 presTreatmentTimeSecs; ///< Prescribed treatment time (in minutes). +static U32 presBloodFlowRate; ///< Prescribed blood flow rate (in mL/min). +static U32 presDialysateFlowRate; ///< Prescribed dialysate flow rate (in mL/min). +static F32 presMaxUFVolumeML; ///< Prescribed ultrafiltration volume (in mL). +static F32 presUFRate; ///< Prescribed ultrafiltration rate (in mL/min). -static U32 treatmentTimeMS; -static U32 lastTreatmentTimeStamp; -static U32 treatmentTimeBroadcastTimerCtr; +static U32 treatmentTimeMS; ///< Elapsed treatment time (in ms). +static U32 lastTreatmentTimeStamp; ///< Last time elapsed treatment time was recorded (a timestamp in ms). +static U32 treatmentTimeBroadcastTimerCtr; ///< Treatment data broadcast timer counter used to schedule when to transmit data. -static BUTTON_STATE_T lastOffButtonState = BUTTON_STATE_RELEASED; +static BUTTON_STATE_T lastOffButtonState = BUTTON_STATE_RELEASED; // TODO - test code - remove later -static F32 pendingUFVolumeChange; ///< An ultrafiltration volume change (mL) is pending user confirmation. -static F32 pendingUFRateChange; ///< An ultrafiltration rate change (mL/min) is pending user confirmation. -static U32 pendingTreatmentTimeChange; ///< A treatment time change (min) is pending user confirmation. +static F32 pendingUFVolumeChange; ///< An ultrafiltration volume change (mL) is pending user confirmation. +static F32 pendingUFRateChange; ///< An ultrafiltration rate change (mL/min) is pending user confirmation. +static U32 pendingTreatmentTimeChange; ///< A treatment time change (min) is pending user confirmation. // ********** private function prototypes ********** static TREATMENT_STATE_T handleTreatmentStartState( void ); static TREATMENT_STATE_T handleTreatmentDialysisState( void ); static TREATMENT_STATE_T handleTreatmentStopState( void ); -/************************************************************************* +/*********************************************************************//** * @brief * The initTreatmentMode function initializes the Treatment Mode module. * @details @@ -84,7 +89,7 @@ treatmentTimeBroadcastTimerCtr = 0; } -/************************************************************************* +/*********************************************************************//** * @brief * The transitionToTreatmentMode function prepares for transition to treatment mode. * @details @@ -112,7 +117,7 @@ #endif } -/************************************************************************* +/*********************************************************************//** * @brief * The getTreatmentState function gets the current treatment mode state. * @details @@ -125,7 +130,7 @@ return currentTreatmentState; } -/************************************************************************* +/*********************************************************************//** * @brief * The execTreatmentMode function executes the Treatment Mode state machine. * @details @@ -229,7 +234,7 @@ #endif } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTreatmentStartState function handles the Start state of \n * the Treatment Mode state machine. @@ -261,7 +266,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTreatmentDialysisState function handles the Dialysis state of \n * the Treatment Mode state machine. @@ -302,7 +307,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTreatmentStopState function executes the Stop state of the \n * Treatment Mode state machine. @@ -338,7 +343,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The verifyTreatmentDurationSettingChange function verifies the user treatment \n * duration setting change. @@ -377,7 +382,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The verifyUFSettingsChange function verifies new ultrafiltration settings \n * from the user. @@ -454,7 +459,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The verifyUFSettingsConfirmation function verifies the user confirmed \n * ultrafiltration settings change(s) and, if valid, implements the new settings.