Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -re56a0b7c6fcae8ee61d247b3d89ea1874782eb0d -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision e56a0b7c6fcae8ee61d247b3d89ea1874782eb0d) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -72,8 +72,6 @@ /// Initial conversion factor from target flow rate to PWM duty cycle estimate. #define ROP_FLOW_TO_PWM_DC(flow) ( ROP_FLOW_TO_PWM_SLOPE * flow + ROP_FLOW_TO_PWM_INTERCEPT ) -#define FLOW_SENSOR_ZERO_READING 0xFFFF ///< Flow sensor reading indicates zero flow (or flow lower than can be detected by sensor). - #define MAX_ALLOWED_FLOW_DEVIATION 0.1 ///< Max allowed deviation from target flow. #define FLOW_OUT_OF_RANGE_PERSISTENT_INTERVAL ( 12 * MS_PER_SECOND ) ///< Flow out of range time out in counts. #define MAX_PRESSURE_TARGET_TOLERANCE 5 ///< Pressure tolerance from maximum set pressure by user in psi. Index: firmware/App/Services/FPGA.c =================================================================== diff -u -re6f3a632890f96a5aa282922d11df148bdd06587 -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision e6f3a632890f96a5aa282922d11df148bdd06587) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -185,7 +185,15 @@ U16 fpgaFanOut2Pulse; ///< Reg 398. Fan outlet 2 pulse time in 2.5 resolution U16 fpgaFanIn3Pulse; ///< Reg 400. Fan inlet 3 pulse time in 2.5 resolution U16 fpgaFanOut3Pulse; ///< Reg 402. Fan outlet 3 pulse time in 2.5 resolution - U16 fpgaTimerCount_ms; ///< Reg 404. Internal FPGA timer count in ms. + U16 fpgaTimerCount_ms; ///< Reg 404. Internal FPGA timer count in ms. + U16 fpgaVccIntVoltage; ///< Req 406. Internal FPGA Vcc Int voltage + U16 fpgaVccAuxVoltage; ///< Req 408. Internal FPGA Vcc Aux voltage + U16 fpgaVpvnVoltage; ///< Req 410. Internal FPGA VPVN voltage + U16 fpgaRoPumpFeedBack; ///< Req 412. Internal FPGA RO pump feedback register + U16 fpgaDrainPumpSpeedMeasure; ///< Req 414. Drain pump speed measurement + U16 fpgaDrainPumpCurrent; ///< Req 416. Drain pump electrical current measurement + U16 fpgaDialysateFlowRate; ///< Req 418. Dialysate flow rate measurement + } DG_FPGA_SENSORS_T; typedef struct @@ -1180,6 +1188,18 @@ /*********************************************************************//** * @brief + * The getFPGAROPumpFlowRate function gets the latest RO flow rate. + * @details Inputs: fpgaSensorReadings.fpgaROFlowRate + * @details Outputs: none + * @return last RO flow rate reading + *************************************************************************/ +U16 getFPGADialysateMeterFlowRate( void ) +{ + return fpgaSensorReadings.fpgaDialysateFlowRate; +} + +/*********************************************************************//** + * @brief * The getFPGADrainPumpSpeed function gets the latest sensed drain pump speed. * @details Inputs: fpgaSensorReadings.fpgaDrainPumpSpeed * @details Outputs: none Index: firmware/App/Services/FPGA.h =================================================================== diff -u -re6f3a632890f96a5aa282922d11df148bdd06587 -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision e6f3a632890f96a5aa282922d11df148bdd06587) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -53,6 +53,7 @@ void getFPGAVersions( U08 *Id, U08 *Maj, U08 *Min, U08 *Lab ); U16 getFPGAValveStates( void ); U16 getFPGAROPumpFlowRate( void ); +U16 getFPGADialysateMeterFlowRate( void ); U16 getFPGADrainPumpSpeed( void ); U32 getFPGALoadCellA1( void ); U32 getFPGALoadCellA2( void ); Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r667b78a4ba1b948d4977b9b55234acf8d670f2d9 -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 667b78a4ba1b948d4977b9b55234acf8d670f2d9) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -616,6 +616,35 @@ /*********************************************************************//** * @brief + * The broadcastROPumpData function sends out RO pump data. + * @details Inputs: none + * @details Outputs: RO pump data msg constructed and queued + * @param tgtPressure target pressure for RO pump in PSI + * @param measFlow measure RO flow rate in LPM + * @param setPWM set PWM duty cycle in % + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL broadcastDialysateFlowData( const DIALYSATE_FLOW_METER_DATA_T * const flowData ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_DIALYSATE_FLOW_METER_DATA; + msg.hdr.payloadLen = sizeof( DIALYSATE_FLOW_METER_DATA_T ); + + memcpy( payloadPtr, flowData, sizeof( DIALYSATE_FLOW_METER_DATA_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_DG_BROADCAST, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief * The broadcastConcentratePumpData function sends out concentrate pumps' data. * @details Inputs: none * @details Outputs: concentrate pump data msg constructed and queued Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r799b1f2e7a128ce670e7c4cdfd60f7991534b699 -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 799b1f2e7a128ce670e7c4cdfd60f7991534b699) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -33,6 +33,7 @@ #include "NVDataMgmt.h" #include "Reservoirs.h" #include "ROPump.h" +#include "DialysateFlow.h" #include "Switches.h" #include "TemperatureSensors.h" #include "Thermistors.h" @@ -86,6 +87,9 @@ // MSG_ID_DG_VALVES_STATES BOOL broadcastValvesStates( U16 valvesStates ); +// MSG_ID_DG_DIALYSATE_FLOW_METER_DATA +BOOL broadcastDialysateFlowData( const DIALYSATE_FLOW_METER_DATA_T * const flowData ); + // MSG_ID_RO_PUMP_DATA BOOL broadcastROPumpData( RO_PUMP_DATA_T *pumpData ); Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -rbbd5ac2589c8093f681f2284367975ddd220b553 -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision bbd5ac2589c8093f681f2284367975ddd220b553) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -27,6 +27,7 @@ #include "LoadCell.h" #include "Pressures.h" #include "ROPump.h" +#include "DialysateFlow.h" #include "TaskPriority.h" #include "TemperatureSensors.h" #include "Valves.h" @@ -110,6 +111,14 @@ #ifdef TASK_TIMING_OUTPUT_ENABLED // SET_TASK_OFF(); // TODO - uncomment and define TASK_TIMING_OUTPUT_ENABLED to monitor this tasks timing #endif + +#ifdef DIALYSATE_FLOW_METER_ENABLED + // Monitor dialysate flow meter + execDialysateFlowMeterMonitor(); +#endif + + + } /**@}*/ Index: firmware/source/sys_main.c =================================================================== diff -u -r67021fbc633259e8e1bce76749dbef7d0cb51998 -r52763239a17119a1ffab1fb53e8eedf992ae800c --- firmware/source/sys_main.c (.../sys_main.c) (revision 67021fbc633259e8e1bce76749dbef7d0cb51998) +++ firmware/source/sys_main.c (.../sys_main.c) (revision 52763239a17119a1ffab1fb53e8eedf992ae800c) @@ -68,6 +68,7 @@ #include "ConductivitySensors.h" #include "ConcentratePumps.h" #include "CPLD.h" +#include "DialysateFlow.h" #include "DrainPump.h" #include "Fans.h" #include "FluidLeak.h" @@ -201,6 +202,7 @@ initFluidLeak(); initOperationModes(); initIntegrity(); + initDialysateFlowMeter(); } /*************************************************************************