Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r1953056032ff6dd26042e5761453a7a499b09364 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 1953056032ff6dd26042e5761453a7a499b09364) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -37,10 +37,9 @@ */ // ********** private definitions ********** -//Testing -//#define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. -#define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 50 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. +#define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. + /// Payload record structure for balancing chamber switch only request typedef struct { Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r1953056032ff6dd26042e5761453a7a499b09364 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 1953056032ff6dd26042e5761453a7a499b09364) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -69,9 +69,7 @@ /// Volume output per pulse. #define CONCENTRATE_PUMP_VOLUME_PER_PULSE ( CONCENTRATE_PUMP_VOLUME_PER_REV / CONCENTRATE_PUMP_PULSE_PER_REV ) -//Testing -#define CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL ( 50 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is monitored. -//#define CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL ( 1000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is monitored. +#define CONCENTRATE_PUMP_DATA_PUBLISH_INTERVAL ( 1000 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is monitored. #define CONCENTRATE_PUMP_CONTROL_INTERVAL ( 100 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the concentrate pump is controlled. #define CONCENTRATE_PUMP_SPEED_OUT_OF_RANGE_TIMEOUT_MS ( 10 * MS_PER_SECOND ) ///< Concentrate pumps speed out of range timeout in milliseconds. Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r4b09605126f35b80406e95d079f3822c51a3ba25 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -126,7 +126,7 @@ static U32 dataPublicationTimerCounter; ///< Data publication timer counter. static U32 primaryTargetTempAdjCounter; ///< Primary target temperature adjustment counter. static BOOL isTargetTempAdjusted; ///< Flag indicating that target temperature is adjusted -static U32 adjustedTargetTemp; ///< Adjusted primary target temperature +static U32 adjustedPrimaryTargetTemp; ///< Adjusted primary target temperature static const F32 WATER_SPECIFIC_HEAT_DIVIDED_BY_MINUTES = 4184.0F / (F32)SEC_PER_MIN; ///< Water specific heat in J/KgC / 60. static OVERRIDE_U32_T heatersDataPublishInterval = { HEATERS_DATA_PUBLISH_INTERVAL, HEATERS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Heaters data publish time interval. static F32 convertDC; ///< AC Heater converted duty cycle @@ -143,7 +143,7 @@ static HEATERS_STATE_T handleHeaterStateRampToTarget( DD_HEATERS_T heater ); static HEATERS_STATE_T handleHeaterStateControlToTarget( DD_HEATERS_T heater ); static HEATERS_STATE_T handleHeaterStateControlToDisinfectTarget( DD_HEATERS_T heater ); -static void updatePrimaryHeaterTargetTemp( DD_HEATERS_T heater ); +static void updatePrimaryHeaterTargetTemp( void ); static F32 calculateDutyCycle( F32 flowrate, F32 deltaTemp, F32 power, F32 efficiency, F32 min, F32 max ); static void setHeaterControl( DD_HEATERS_T heater ); @@ -195,7 +195,7 @@ startupHeaterControl = TRUE; lastDialTargetTemperatureSet = 0.0F; primaryTargetTempAdjCounter = 0; - adjustedTargetTemp = 0.0F; + adjustedPrimaryTargetTemp = 0.0F; isTargetTempAdjusted = FALSE; for ( heater = DD_HEATERS_FIRST; heater < NUM_OF_DD_HEATERS; heater++ ) @@ -358,19 +358,16 @@ /*********************************************************************//** * @brief - * The signaltoResetAdjustedTargetTemp function resets the flag to - * update/adjust the target dialysate temperature + * The signaltoResetPrimaryHeaterAdjustedTargetTemp function resets the flag to + * update/adjust the primary heater target dialysate temperature * @details \b Inputs: none * @details \b Outputs: isTargetTempAdjusted * @param heater: heater ID to update the heater control. * @return none *************************************************************************/ -void signaltoResetAdjustedTargetTemp( DD_HEATERS_T heater ) +void signaltoResetPrimaryHeaterAdjustedTargetTemp( void ) { - if ( D5_HEAT == heater ) - { - isTargetTempAdjusted = FALSE; - } + isTargetTempAdjusted = FALSE; } /*********************************************************************//** @@ -379,36 +376,32 @@ * target dialysate temperature * @details \b Inputs: Set Target Temperature, D28 Temp * @details \b Outputs: Adjusted target temperature - * @param heater: heater ID to update the heater control. * @return none *************************************************************************/ -static void updatePrimaryHeaterTargetTemp( DD_HEATERS_T heater ) +static void updatePrimaryHeaterTargetTemp( void ) { - if ( D5_HEAT == heater ) + if ( ++primaryTargetTempAdjCounter >= D5_TARGET_TEMP_ADJUST_INTERVAL_MS ) { - if ( ++primaryTargetTempAdjCounter >= D5_TARGET_TEMP_ADJUST_INTERVAL_MS ) + F32 targetTempfromTD = getTDTargetDialysateTemperature(); + F32 measuredTempAtDialyzer = getConductivityTemperatureValue( D27_COND ); + F32 calcTargetTemp = getHeaterTargetTemperature( D5_HEAT ); + F32 deltaTempC = targetTempfromTD - measuredTempAtDialyzer; + F32 capDeltaTempC = MIN( fabs(deltaTempC), MAX_ADJ_DELTA_TEMP_C ); + + if ( deltaTempC > HEATERS_ZERO_DELTA_TEMP_C ) { - F32 targetTempfromTD = getTDTargetDialysateTemperature(); - F32 measuredTempAtDialyzer = getConductivityTemperatureValue( D27_COND ); - F32 calcTargetTemp = getHeaterTargetTemperature( heater ); - F32 deltaTempC = targetTempfromTD - measuredTempAtDialyzer; - F32 capDeltaTempC = MIN( fabs(deltaTempC), MAX_ADJ_DELTA_TEMP_C ); + adjustedPrimaryTargetTemp = calcTargetTemp + capDeltaTempC; + } + else + { + adjustedPrimaryTargetTemp = calcTargetTemp - capDeltaTempC; + } - if ( deltaTempC > HEATERS_ZERO_DELTA_TEMP_C ) - { - adjustedTargetTemp = calcTargetTemp + capDeltaTempC; - } - else - { - adjustedTargetTemp = calcTargetTemp - capDeltaTempC; - } + adjustedPrimaryTargetTemp = MIN(adjustedPrimaryTargetTemp, ( calcTargetTemp + MAX_ADJ_DELTA_TEMP_C ) ); + adjustedPrimaryTargetTemp = MAX(adjustedPrimaryTargetTemp, ( calcTargetTemp - MAX_ADJ_DELTA_TEMP_C ) ); - adjustedTargetTemp = MIN(adjustedTargetTemp, ( calcTargetTemp + MAX_ADJ_DELTA_TEMP_C ) ); - adjustedTargetTemp = MAX(adjustedTargetTemp, ( calcTargetTemp - MAX_ADJ_DELTA_TEMP_C ) ); - - isTargetTempAdjusted = TRUE; - primaryTargetTempAdjCounter = 0; - } + isTargetTempAdjusted = TRUE; + primaryTargetTempAdjCounter = 0; } } @@ -697,7 +690,11 @@ F32 measuredTemperature = 0.0F; F32 ctrl = 0.0F; - updatePrimaryHeaterTargetTemp( heater ); + // Update primary heater target temperature at defined interval + if ( D5_HEAT == heater ) + { + updatePrimaryHeaterTargetTemp(); + } if ( ++heatersStatus[ heater ].controlIntervalCounter >= controlInterval[ heater ] ) { @@ -709,22 +706,24 @@ if ( TRUE == startupHeaterControl ) { - startupHeaterControl = FALSE; F32 deltaTempC = targetTemperature - inletTemperature; F32 capDeltaTempC = MAX( deltaTempC, HEATERS_ZERO_DELTA_TEMP_C ); F32 flowrate = getTDDialysateFlowrate() / LITER_IN_ML ; F32 feedforward = calculateDutyCycle( flowrate, capDeltaTempC, PRIMARY_HEATER_MAX_PWR_WATTS, AC_HEATER_EFFICIENCY, HEATERS_MIN_DUTY_CYCLE, AC_HEATER_TX_MAX_DUTY_CYCLE ); + startupHeaterControl = FALSE; control[ heater ].data = feedforward; resetPIController( PI_CONTROLLER_ID_D5_HEAT, HEATERS_MIN_DUTY_CYCLE, feedforward ); } else { + F32 deltaTempC = 0.0F; + if ( TRUE == isTargetTempAdjusted ) { - targetTemperature = adjustedTargetTemp; + targetTemperature = adjustedPrimaryTargetTemp; } - F32 deltaTempC = fabs( targetTemperature - measuredTemperature ); + deltaTempC = fabs( targetTemperature - measuredTemperature ); if ( deltaTempC >= D5_HEATER_DEADBAND_CONTROL ) { @@ -929,11 +928,9 @@ HEATERS_DATA_T data; data.d5_HeaterDC = getHeaterControl( D5_HEAT ) * HEATERS_DUTY_CYCLE_CONVERSION_FACTOR; - data.d45_HeaterDC = getTDTargetDialysateTemperature(); - //data.d45_HeaterDC = getHeaterControl( D45_HEAT ) * HEATERS_DUTY_CYCLE_CONVERSION_FACTOR; + data.d45_HeaterDC = getHeaterControl( D45_HEAT ) * HEATERS_DUTY_CYCLE_CONVERSION_FACTOR; data.d5_HeaterTargetTemp = getHeaterTargetTemperature( D5_HEAT ); - data.d45_HeaterTargetTemp = adjustedTargetTemp; - //data.d45_HeaterTargetTemp = getHeaterTargetTemperature( D45_HEAT ); + data.d45_HeaterTargetTemp = getHeaterTargetTemperature( D45_HEAT ); data.d5_HeaterState = heatersStatus[ D5_HEAT ].state; data.d45_HeaterState = heatersStatus[ D45_HEAT ].state; #ifndef __HEATERS_DEBUG__ Index: firmware/App/Controllers/Heaters.h =================================================================== diff -u -r4b09605126f35b80406e95d079f3822c51a3ba25 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Controllers/Heaters.h (.../Heaters.h) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) +++ firmware/App/Controllers/Heaters.h (.../Heaters.h) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -74,7 +74,7 @@ void startHeater( DD_HEATERS_T heater ); F32 getHeaterTargetTemperature( DD_HEATERS_T heater ); void signalHeaterControlOnQDUpdate( DD_HEATERS_T heater ); -void signaltoResetAdjustedTargetTemp( DD_HEATERS_T heater ); +void signaltoResetPrimaryHeaterAdjustedTargetTemp( void ); BOOL isHeaterOn( DD_HEATERS_T heater ); void stopHeater( DD_HEATERS_T heater ); void execHeatersControl( void ); Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r1953056032ff6dd26042e5761453a7a499b09364 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 1953056032ff6dd26042e5761453a7a499b09364) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -36,9 +36,7 @@ #define ALL_VALVES_DEENERGIZED 0x0000 ///< 0 in U16 bit field for all valves. #define MAX_VALVE_STATE_MISMATCH_TIMER_COUNT (100 / TASK_PRIORITY_INTERVAL ) ///< Maximum time commanded valves state can fail to match read back valve states in a row. -//Testing -//#define VALVES_STATE_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval ( ms / task time) at which valves states are published on CAN bus. -#define VALVES_STATE_PUB_INTERVAL ( 50 / TASK_PRIORITY_INTERVAL ) ///< Interval ( ms / task time) at which valves states are published on CAN bus. +#define VALVES_STATE_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval ( ms / task time) at which valves states are published on CAN bus. #define DATA_PUBLISH_COUNTER_START_COUNT 50 ///< Data publish counter start count. /// Payload record structure for valve open/close request Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r4b09605126f35b80406e95d079f3822c51a3ba25 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -578,7 +578,7 @@ //targetHydChamberFluidTemp.data = getTDTargetDialysateTemperature(); calculateTargetDialysateTemp(); //Reset flag - signaltoResetAdjustedTargetTemp( D5_HEAT ); + signaltoResetPrimaryHeaterAdjustedTargetTemp(); // Update the target temperature for heater control setHeaterTargetTemperature( D5_HEAT, getGenDialysateTargetTemperature() ); Index: firmware/App/Monitors/Pressure.c =================================================================== diff -u -r1953056032ff6dd26042e5761453a7a499b09364 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision 1953056032ff6dd26042e5761453a7a499b09364) +++ firmware/App/Monitors/Pressure.c (.../Pressure.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -28,9 +28,7 @@ */ // ********** private definitions ********** -//TODO : Increasing the publish interval -//#define PRESSURES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. -#define PRESSURES_DATA_PUB_INTERVAL ( 50 / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. +#define PRESSURES_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Interval (ms/task time) at which the pressures data is published on the CAN bus. #define DATA_PUBLISH_COUNTER_START_COUNT ( 5 ) ///< Data publish counter start count. #define PRESSURE_SAMPLE_FILTER_MS ( 50 ) ///< Filter pressure data for given time #define PRESSURE_TEMP_SAMPLE_FILTER_MS ( 50 ) Index: firmware/App/Services/FPInterface.c =================================================================== diff -u --- firmware/App/Services/FPInterface.c (revision 0) +++ firmware/App/Services/FPInterface.c (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -0,0 +1,228 @@ +/************************************************************************** +* +* Copyright (c) 2024-2024 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 FPInterface.c +* +* @author (last) Vinayakam Mani +* @date (last) 19-Nov-2024 +* +* @author (original) Vinayakam Mani +* @date (original) 19-Nov-2024 +* +***************************************************************************/ + +#include "FPInterface.h" +#include "Messaging.h" +#include "MessagePayloads.h" +#include "ModeInitPOST.h" +#include "ModeStandby.h" +#include "OperationModes.h" +#include "PersistentAlarm.h" +#include "SystemCommDD.h" +#include "TaskGeneral.h" +#include "Timers.h" + +/** + * @addtogroup FPInterface + * @{ + */ + +// ********** private definitions ********** + +#define FP_DATA_FRESHNESS_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< FP data freshness timeout (in ms). +#define MAX_FP_FLOW_RATE ( 700.0F ) ///< Max FP pump flow rate + +// ********** private data ********** + +static FP_OP_MODE_T fpCurrentOpMode; ///< Current TD operation mode. +static U32 fpSubMode; ///< Current state (sub-mode) of current TD operation mode. +static F32 fpFlowRate; ///< FP flow rate + +static BOOL fpOpModeDataFreshFlag = FALSE; ///< Flag to signal/process fresh FP op mode data + +// ********** private function prototypes ********** + +static void checkFPDataFreshness( ALARM_ID_T alarmID, BOOL *fpFreshDataFlag ); + +/*********************************************************************//** + * @brief + * The initFPInterface function initializes the FP Interface unit. + * @details \b Inputs: none + * @details \b Outputs: FP Interface unit initialized. + * @return none + *************************************************************************/ +void initFPInterface( void ) +{ + // Initialize unit variables + fpCurrentOpMode = FP_MODE_INIT; + fpSubMode = 0; + fpFlowRate = MAX_FP_FLOW_RATE; +} + +/**********************************************************************//** + * @brief + * The checkFPDataFreshness function checks the freshness of data coming from + * the FP sub-system. + * @details \b Alarm: Given alarm is triggered if FP is communicating but has + * not published new data for too long. + * @details \b Inputs: FP communicating flag + * @details \b Outputs: none + * @param alarm ID of alarm to check + * @param fpFreshDataFlag Pointer to flag indicating whether new data has been + * received since last time this function has seen it. + * @return None + *************************************************************************/ +static void checkFPDataFreshness( ALARM_ID_T alarmID, BOOL *fpFreshDataFlag ) +{ + if ( TRUE == *fpFreshDataFlag ) + { + *fpFreshDataFlag = FALSE; + checkPersistentAlarm( alarmID, FALSE, 0.0, 0.0 ); + } + else + { // Alarm if not receiving FP fresh data message in timely manner + if ( TRUE == isFPCommunicating() ) + { + checkPersistentAlarm( alarmID, TRUE, 0.0, 0.0 ); + } + else + { + checkPersistentAlarm( alarmID, FALSE, 0.0, 0.0 ); + } + } +} + +/*********************************************************************//** + * @brief + * The execFPInterfaceMonitor function executes the FP Interface monitoring + * function. Ensures FP is sending fresh data in a timely manner. + * @details \b Inputs: none + * @details \b Outputs: none + * @return none + *************************************************************************/ +void execFPInterfaceMonitor( void ) +{ + +} + +/*********************************************************************//** + * @brief + * The cmdFPStartStop function sends a start/stop command to FP for mode + * transition and generate water with commanded flow rate. + * @details Inputs: none + * @details Outputs: start/stop command along with flow rate if applicable. + * @param startStop To start/stop the FP delivery. + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL cmdFPStartStop( BOOL startStop, RO_CMD_ID cmdMode) +{ + FP_WATER_REQ_PAYLOAD_T fpStartRequest; + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Populate FP start message + fpStartRequest.cmdID = (U32)cmdMode; + fpStartRequest.start = startStop; + fpStartRequest.roRate = getFPFlowRate(); + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DD_FP_START_STOP_CMD_REQUEST; + msg.hdr.payloadLen = sizeof( FP_WATER_REQ_PAYLOAD_T ); + + memcpy( payloadPtr, &fpStartRequest, sizeof( FP_WATER_REQ_PAYLOAD_T ) ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DD_2_RO, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The setFPFlowRate function sets the FP pump flow rate to deliver purified + * water. + * @details \b Inputs: none + * @details \b Outputs: fpFlowRate + * @return none. + *************************************************************************/ +void setFPFlowRate( F32 fpFlow ) +{ + fpFlowRate = fpFlow; +} + +/*********************************************************************//** + * @brief + * The getFPFlowRate function gets the FP flow rate. + * @details \b Inputs: Ro flow rate + * @details \b Outputs: none + * @return latest FP pump flow rate. + *************************************************************************/ +F32 getFPFlowRate( void ) +{ + return fpFlowRate; +} + +/*********************************************************************//** + * @brief + * The getFPOpMode function gets the current latest reported FP operating mode. + * @details \b Inputs: fpCurrentOpMode + * @details \b Outputs: none + * @return Latest reported FP operating mode. + *************************************************************************/ +FP_OP_MODE_T getFPOpMode( void ) +{ + return fpCurrentOpMode; +} + +/*********************************************************************//** + * @brief + * The getFPSubMode function gets the latest reported FP operating sub-mode. + * @details \b Inputs: fpSubMode + * @details \b Outputs: none + * @return Latest reported FP operating sub-mode. + *************************************************************************/ +U32 getFPSubMode( void ) +{ + return fpSubMode; +} + +/*********************************************************************//** + * @brief + * The setFPOpMode function sets the latest FP operating mode reported by + * the FP (called by FP published message handler). + * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if reported FP mode is invalid. + * @details \b Inputs: none + * @details \b Outputs: fpCurrentOpMode, fpSubMode, fpOpModeDataFreshFlag + * @param opMode The operating mode reported by FP + * @param subMode The sub-mode of operating mode reported by FP + * @return none + *************************************************************************/ +void setFPOpMode( U32 opMode, U32 subMode ) +{ + if ( opMode < NUM_OF_FP_MODES ) + { + // update FP op mode and sub-mode + fpCurrentOpMode = (FP_OP_MODE_T)opMode; + fpSubMode = subMode; + } + else + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_FP_OPERATING_MODE, opMode ); + } + + fpOpModeDataFreshFlag = TRUE; +} + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/**@}*/ Index: firmware/App/Services/FPInterface.h =================================================================== diff -u --- firmware/App/Services/FPInterface.h (revision 0) +++ firmware/App/Services/FPInterface.h (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -0,0 +1,54 @@ +/************************************************************************** +* +* Copyright (c) 2024-2024 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 FPInterface.h +* +* @author (last) Vinayakam Mani +* @date (last) 19-Nov-2024 +* +* @author (original) Vinayakam Mani +* @date (original) 19-Nov-2024 +* +***************************************************************************/ + +#ifndef __FP_INTERFACE_H__ +#define __FP_INTERFACE_H__ + +#include "DDCommon.h" +#include "MessagePayloads.h" +#include "TDDefs.h" +#include "FPDefs.h" + +/** + * @defgroup FPInterface FPInterface + * @brief FP interface & monitor unit. Interfaces with and monitors the + * FP (Prefilteration and purification or Reverse Osmosis) sub-system. + * + * @addtogroup FPInterface + * @{ + */ + +// ********** public definitions ********** + + + +// ********** public function prototypes ********** + +void initFPInterface( void ); +void execFPInterfaceMonitor( void ); + +BOOL cmdFPStartStop( BOOL startStop, RO_CMD_ID cmdMode); +void setFPFlowRate( F32 fpFlow ); +F32 getFPFlowRate( void ); + +void setFPOpMode( U32 opMode, U32 subMode ); +FP_OP_MODE_T getFPOpMode( void ); +U32 getFPSubMode( void ); + +/**@}*/ + +#endif Fisheye: Tag e0102a0a08c0d83bcc8e959551079063e2e60d9f refers to a dead (removed) revision in file `firmware/App/Services/ROInterface.c'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e0102a0a08c0d83bcc8e959551079063e2e60d9f refers to a dead (removed) revision in file `firmware/App/Services/ROInterface.h'. Fisheye: No comparison available. Pass `N' to diff? Index: firmware/App/Services/SystemCommDD.c =================================================================== diff -u -r4b09605126f35b80406e95d079f3822c51a3ba25 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) +++ firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -74,7 +74,7 @@ static volatile BOOL ddIsOnlyCANNode = TRUE; ///< flag indicating whether DG is alone on CAN bus. static OVERRIDE_U32_T tdCommunicationStatus = {0, 0, 0, 0}; ///< has TD sent a message since last check static volatile U32 timeOfLastTDCheckIn = 0; ///< last time we received an TD broadcast -static OVERRIDE_U32_T roCommunicationStatus = {0, 0, 0, 0}; ///< has RO sent a message since last check +static OVERRIDE_U32_T fpCommunicationStatus = {0, 0, 0, 0}; ///< has RO sent a message since last check static volatile U32 timeOfLastROCheckIn = 0; ///< last time we received an RO broadcast // ********** private function prototypes ********** @@ -122,12 +122,12 @@ * The checkInFromRO function checks in the RO with the DD - indicating that * the RO is communicating. * @details \b Inputs: none - * @details \b Outputs: roCommunicationStatus, timeOfLastROCheckIn + * @details \b Outputs: fpCommunicationStatus, timeOfLastROCheckIn * @return none *************************************************************************/ void checkInFromRO( void ) { - roCommunicationStatus.data = TRUE; + fpCommunicationStatus.data = TRUE; timeOfLastROCheckIn = getMSTimerCount(); // if ( TRUE == isAlarmActive( ALARM_ID_DD_RO_COMM_TIMEOUT ) ) @@ -153,13 +153,13 @@ * @brief * The isFPCommunicating function determines whether the RO is communicating * with the DD. - * @details \b Inputs: roCommunicationStatus + * @details \b Inputs: fpCommunicationStatus * @details \b Outputs: none * @return TRUE if RO has broadcast since last call, FALSE if not *************************************************************************/ BOOL isFPCommunicating( void ) { - return getU32OverrideValue( &roCommunicationStatus ); + return getU32OverrideValue( &fpCommunicationStatus ); } /*********************************************************************//** @@ -223,7 +223,7 @@ if ( TRUE == didTimeout( timeOfLastROCheckIn, RO_COMM_TIMEOUT_IN_MS ) ) { - roCommunicationStatus.data = FALSE; + fpCommunicationStatus.data = FALSE; //setROOperationMode( 0, 0 ); // If RO off or not connected, consider RO mode is fault. } } @@ -344,14 +344,14 @@ * The testROCommunicationStatusOverride function sets the override * of the RO communication status. * @details \b Inputs: none - * @details \b Outputs: roCommunicationStatus + * @details \b Outputs: fpCommunicationStatus * @param message Override message from Dialin which includes the flag * value to override for the RO communication status. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testROCommunicationStatusOverride( MESSAGE_T *message ) { - BOOL result = u32Override( message, &roCommunicationStatus, FALSE, TRUE ); + BOOL result = u32Override( message, &fpCommunicationStatus, FALSE, TRUE ); return result; } Index: firmware/source/sys_main.c =================================================================== diff -u -r4b09605126f35b80406e95d079f3822c51a3ba25 -re0102a0a08c0d83bcc8e959551079063e2e60d9f --- firmware/source/sys_main.c (.../sys_main.c) (revision 4b09605126f35b80406e95d079f3822c51a3ba25) +++ firmware/source/sys_main.c (.../sys_main.c) (revision e0102a0a08c0d83bcc8e959551079063e2e60d9f) @@ -67,6 +67,7 @@ #include "DDCommon.h" #include "DialysatePumps.h" #include "FpgaDD.h" +#include "FPInterface.h" #include "Heaters.h" #include "Interrupts.h" #include "Level.h" @@ -76,7 +77,6 @@ #include "PistonPumpControl.h" #endif #include "Pressure.h" -#include "ROInterface.h" #include "SafetyShutdown.h" #include "SystemCommDD.h" #include "TaskBG.h"