Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -re0c45c725884d780b76dd54a617ab6ed333d7ba2 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision e0c45c725884d780b76dd54a617ab6ed333d7ba2) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -6,7 +6,7 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file BalancingChamber.c -* +*f * @author (last) Dara Navaei * @date (last) 18-Mar-2026 * @@ -84,12 +84,16 @@ static F32 lastTdDialysateFlowrate; ///< Previous TD dialysate flow rate static F32 freshDialPressure; ///< Fresh side dialysate pressure static F32 spentDialPressure; ///< Spent side dialysate pressure +static BOOL isBalChamberSwitchingActive; ///< Flag indicating balancing chamber switching is active or not. +static BOOL isBalChamberSwitchingOnRequested; ///< Flag indicating that a request was made to activate balancing chamber switching. +static BOOL isBalChamberSwitchingOffRequested; ///< Flag indicating that a request was made to deactivate balancing chamber switching. + static U32 currentBalChamberFillCounter; ///< Counter (in task interval) to monitor the timing spent for the spent side fill operation. static U32 balChamberFillTimeoutCount; ///< Timeout count (in task interval) to detect BC fill timeout. static S32 diffSpentFillCompleteCount; ///< Difference between spent target fill to actual fill count static BOOL isSpentFillComplete; ///< Flag indicating spent side fill complete. //TODO: remove later once level sensor working -static U32 bicarbChamberPeriodicFillCounter; +static U32 bicarbChamberPeriodicFillCounter; // ********** private function prototypes ********** @@ -100,6 +104,7 @@ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillStart( void ); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2ValvesClose( void ); static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillEnd(void); +static BAL_CHAMBER_EXEC_STATE_T handleBalChamberStateIdle( void ); static void publishBalChamberData( void ); static U32 getBalChamberDataPublishInterval( void ); static void checkSpentFillComplete( F32 spentDialPressure ); @@ -113,7 +118,7 @@ *************************************************************************/ void initBalanceChamber( void ) { - balChamberExecState = BAL_CHAMBER_STATE_START; + balChamberExecState = BAL_CHAMBER_STATE_IDLE; balChamberSWState = BAL_CHAMBER_SW_STATE1; balChamberSwitchingFreq.data = 0.0F; balChamberSwitchingFreq.ovData = 0.0F; @@ -145,12 +150,17 @@ isPressureDroppedDuringFill = FALSE; freshDialPressure = 0.0F; spentDialPressure = 0.0F; + isBalChamberSwitchingActive = FALSE; + isBalChamberSwitchingOnRequested = FALSE; + isBalChamberSwitchingOffRequested = FALSE; + + //TODO:remove once level sensor working + bicarbChamberPeriodicFillCounter = 0; + currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; diffSpentFillCompleteCount = 0; isSpentFillComplete = FALSE; - //TODO:remove once level sensor working - bicarbChamberPeriodicFillCounter = 0; } /*********************************************************************//** @@ -241,8 +251,8 @@ switch ( balChamberExecState ) { - case BAL_CHAMBER_STATE_START: - balChamberExecState = BAL_CHAMBER_STATE1_FILL_START; + case BAL_CHAMBER_STATE_IDLE: + balChamberExecState = handleBalChamberStateIdle(); break; case BAL_CHAMBER_STATE1_FILL_START: @@ -279,7 +289,7 @@ default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_BAL_CHAMBER_INVALID_EXEC_STATE, balChamberExecState ) - balChamberExecState = BAL_CHAMBER_STATE_START; + balChamberExecState = BAL_CHAMBER_STATE_IDLE; break; } @@ -291,6 +301,26 @@ /*********************************************************************//** * @brief + * The requestBalChamberSwitching function activates or deactivates balancing chamber switching. + * @details \b Inputs: none + * @details \b Outputs: isBalChamberSwitchingOnRequested, isBalChamberSwitchingOffRequested + * @param activate - TRUE to activate and FALSE to deactivate. + * @return none. + *************************************************************************/ +void requestBalChamberSwitching( BOOL activate ) +{ + if ( TRUE == activate ) + { + isBalChamberSwitchingOnRequested = TRUE; + } + else + { + isBalChamberSwitchingOffRequested = TRUE; + } +} + +/*********************************************************************//** + * @brief * The valveControlForBCState1FillStart function actuates the valve combination * for state 1 fill/drain process. * @details \b Inputs: none @@ -465,6 +495,17 @@ freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp + setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + } + else + { + //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp + setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + } + // Check fresh dialysate pressure in range or BC switch only flag set or BC pressure alarms are disabled if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) @@ -659,6 +700,22 @@ state = BAL_CHAMBER_STATE2_FILL_START; } + // Keep Clearing the On request flag in case an On request was made while the switching is active + isBalChamberSwitchingOnRequested = FALSE; + + // Check if a request made was to deactivate the balancing chamber switching. + if ( TRUE == isBalChamberSwitchingOffRequested ) + { + //Clear the request flag to indicate that the request was processed. + isBalChamberSwitchingOffRequested = FALSE; + + // Clear the flag to indicate that balancing chamber switching is inactive + isBalChamberSwitchingActive = FALSE; + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; + } + return state; } @@ -689,6 +746,17 @@ freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp + setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + } + else + { + //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp + setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + } + // Check fresh dialysate pressure in range if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) @@ -839,11 +907,57 @@ isFirstCycleBCSwitchingCompleted = TRUE; } + // Keep Clearing the On request flag in case an On request was made while the switching is active + isBalChamberSwitchingOnRequested = FALSE; + + // Check if a request made was to deactivate the balancing chamber switching. + if ( TRUE == isBalChamberSwitchingOffRequested ) + { + // Clear the request flag to indicate that the request was processed. + isBalChamberSwitchingOffRequested = FALSE; + + // Clear flag to indicate that balancing chamber switching is inactive + isBalChamberSwitchingActive = FALSE; + + // Move to the idle state + state = BAL_CHAMBER_STATE_IDLE; + } + return state; } /*********************************************************************//** * @brief + * The handleBalChamberStateIdle function handles balancing chamber idle state. + * @details \b Inputs: isBalChamberSwitchingOnRequested + * @details \b Outputs: isBalChamberSwitchingActive + * @return next balancing chamber state. + *************************************************************************/ +static BAL_CHAMBER_EXEC_STATE_T handleBalChamberStateIdle( void ) +{ + BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE_IDLE; + + // Keep Clearing the off request flag in case an off request was made while we were already in the idle state + isBalChamberSwitchingOffRequested = FALSE; + + // Check if a request made was to activate the balancing chamber switching. + if ( TRUE == isBalChamberSwitchingOnRequested ) + { + //Clear the request flag to indicate that the request was processed. + isBalChamberSwitchingOnRequested = FALSE; + + // Set flag to indicate that balancing chamber switching is active + isBalChamberSwitchingActive = TRUE; + + // Move to the start state1 + state = BAL_CHAMBER_STATE1_FILL_START; + } + + return state; +} + +/*********************************************************************//** + * @brief * The checkSpentFillComplete function checks the pressure difference for * spent side fill completion and adjusts the D48 pump speed to align the * fill timing close to the switching period time. @@ -1050,6 +1164,7 @@ data.currentBalChamberSwitchingCounter = currentBalChamberFillCounter; data.isPressureStabilizedDuringFill = isPressureStabilizedDuringFill; data.balChamberSWOnlyState = balanceChamberSwitchingOnly; + data.isBalChamberSwitchingActive = isBalChamberSwitchingActive; broadcastData( MSG_ID_DD_BAL_CHAMBER_DATA, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&data, sizeof( BAL_CHAMBER_DATA_T ) ); @@ -1137,7 +1252,6 @@ * chamber switching only without dosing delivery and pressure check condition. * @details \b Inputs: tester logged in * @details \b Outputs: tdDialysateFlowrate,balanceChamberSwitchingOnly - * pendingBalanceChamberSwOnlyRequest * @param message set message from Dialin which includes the balancing chamber * to start/stop switching and update switching rate based on the flow rate. * @return TRUE if set request is successful, FALSE if not Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -re0c45c725884d780b76dd54a617ab6ed333d7ba2 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision e0c45c725884d780b76dd54a617ab6ed333d7ba2) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -734,13 +734,13 @@ * @param pumpId concentrate pump id to get target revolution count * @return the target revolution count for the given concentrate pump *************************************************************************/ -U16 getConcPumpTargetRevolutionCount( CONCENTRATE_PUMPS_T pumpId ) +U32 getConcPumpTargetRevolutionCount( CONCENTRATE_PUMPS_T pumpId ) { - U16 result = 0; + U32 result = 0; if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { - result = (U16)getU32OverrideValue( &pumpTargetRevCnt[ pumpId ] ); + result = getU32OverrideValue( &pumpTargetRevCnt[ pumpId ] ); } else { @@ -760,13 +760,13 @@ * @param pumpId concentrate pump id to get current measured revolution count * @return the current revolution count for the given concentrate pump *************************************************************************/ -U16 getConcPumpCurrentMeasuredRevolutionCount( CONCENTRATE_PUMPS_T pumpId ) +U32 getConcPumpCurrentMeasuredRevolutionCount( CONCENTRATE_PUMPS_T pumpId ) { - BOOL result = FALSE; + U32 result = 0; if ( pumpId < NUM_OF_CONCENTRATE_PUMPS ) { - result = (U16)getU32OverrideValue( &pumpMesauredRevCnt[ pumpId ] ); + result = getU32OverrideValue( &pumpMesauredRevCnt[ pumpId ] ); } else { @@ -862,7 +862,7 @@ { setFPGAD76PumpSetStepSpeed( CONCENTRATE_PUMP_ZERO_FLOW_RATE ); } - +#if 0 // Park concentrate pump too if requested if ( TRUE == parkPump ) { @@ -883,6 +883,7 @@ } concentratePumps[ pumpId ].isConcPumpParkInProgress = TRUE; } +#endif } /*********************************************************************//** @@ -1255,10 +1256,10 @@ data.d10_PumpCurrentSetSpeed = ( CONCENTRATE_PUMP_REVERSE_DIR == d10_PumpDirection ? d10_PumpSetSpeed * -1.0F : d10_PumpSetSpeed ); data.d10_PumpMeasuredSpeed = getMeasuredPumpSpeedMLPM( D10_PUMP ); data.d10_PumpTargetSpeed = ( CONCENTRATE_PUMP_REVERSE_DIR == d10_PumpDirection ? d10_PumpTgtSpeed * -1.0F : d10_PumpTgtSpeed ); - data.d11_PumpTargetRevCount = (U32)getConcPumpTargetRevolutionCount( D11_PUMP ); - data.d11_PumpMeasuredRevCount= (U32)getConcPumpCurrentMeasuredRevolutionCount( D11_PUMP ); - data.d10_PumpTargetRevCount = (U32)getConcPumpTargetRevolutionCount( D10_PUMP ); - data.d10_PumpMeasuredRevCount= (U32)getConcPumpCurrentMeasuredRevolutionCount( D10_PUMP ); + data.d11_PumpTargetRevCount = getConcPumpTargetRevolutionCount( D11_PUMP ); + data.d11_PumpMeasuredRevCount= getConcPumpCurrentMeasuredRevolutionCount( D11_PUMP ); + data.d10_PumpTargetRevCount = getConcPumpTargetRevolutionCount( D10_PUMP ); + data.d10_PumpMeasuredRevCount= getConcPumpCurrentMeasuredRevolutionCount( D10_PUMP ); data.d11_PumpState = concentratePumps[ D11_PUMP ].execState; data.d10_PumpState = concentratePumps[ D10_PUMP ].execState; data.d11_PumpPulseUS = concentratePumps[ D11_PUMP ].pulseWidthUS; Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -rb37e7ab88f133b7ba7f9b604e4e164b2855b239e -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision b37e7ab88f133b7ba7f9b604e4e164b2855b239e) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -18,6 +18,7 @@ #include // Used for mathematical operations #include "Conductivity.h" +#include "ConductivityTeensy.h" #include "FpgaDD.h" #include "Heaters.h" #include "Level.h" @@ -56,6 +57,9 @@ #define MAX_ADJ_DELTA_TEMP_C 7.0F ///< Maximum adjusted delta temperature to add/remove from calculated target temperature #define D5_HEAT_TX_INIT_FEED_FORWARD 0.0F ///< Initial Feed forward term for heater control +//#define D5_HEAT_TX_P_COEFFICIENT 0.050F ///< P Term for AC primary heater control during treatment mode. +//#define D5_HEAT_TX_I_COEFFICIENT 0.015F ///< I Term for AC primary heater control during treatment mode. + #define D5_HEAT_TX_P_COEFFICIENT 0.035F ///< P Term for AC primary heater control during treatment mode. #define D5_HEAT_TX_I_COEFFICIENT 0.004F ///< I Term for AC primary heater control during treatment mode. @@ -76,6 +80,7 @@ #define HEATERS_MAX_VOLTAGE_OUT_OF_RANGE_TOL 0.2F ///< Heaters max voltage out of range tolerance. #define D5_HEATER_DEADBAND_CONTROL 0.1F ///< Heater deadband range for conrtol. +//#define D5_HEAT_CONTROL_INTERVAL_MS 30000 /// Primary heater control interval in milli seconds #define D5_HEAT_CONTROL_INTERVAL_MS 3000 /// Primary heater control interval in milli seconds #define D5_HEAT_CONTROL_INTERVAL_COUNT ( D5_HEAT_CONTROL_INTERVAL_MS / TASK_GENERAL_INTERVAL ) ///< Primary heater control interval count. #define D45_HEAT_CONTROL_INTERVAL_MS ( 1 * MS_PER_SECOND ) ///< Trimmer heater control interval in milli seconds @@ -400,11 +405,17 @@ if ( ++primaryTargetTempAdjCounter >= D5_TARGET_TEMP_ADJUST_INTERVAL_MS ) { F32 targetTempfromTD = getTDTargetDialysateTemperature(); -#ifdef __TEENSY_CONDUCTIVITY_DRIVER__ - F32 measuredTempAtDialyzer = getTeensyConductivityTemperatureValue( D27_COND ); -#else - F32 measuredTempAtDialyzer = getConductivityTemperatureValue( D27_COND ); -#endif + F32 measuredTempAtDialyzer = 0.0F; + + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) != TRUE ) + { + measuredTempAtDialyzer = getTeensyConductivityTemperatureValue( D27_COND ); + } + else + { + measuredTempAtDialyzer = getConductivityTemperature( D27_COND ); + } + F32 calcTargetTemp = getHeaterTargetTemperature( D5_HEAT ); F32 dialysateFlowrate = getTDDialysateFlowrate(); F32 deltaTempC = targetTempfromTD - measuredTempAtDialyzer; Index: firmware/App/Controllers/Valves.c =================================================================== diff -u -r046bc2b62cf942b7e846fa5bff698b94238edf24 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Controllers/Valves.c (.../Valves.c) (revision 046bc2b62cf942b7e846fa5bff698b94238edf24) +++ firmware/App/Controllers/Valves.c (.../Valves.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -62,6 +62,7 @@ static U32 valveStateMismatchTimerCounter; ///< Initialize valve state mismatch timer. static U32 pendingValveStateChanges[ DD_NUM_OF_VALVES ]; ///< Delayed (pending) valve state changes. static U32 pendingValveStateChangeCountDowns[ DD_NUM_OF_VALVES ]; ///< Delayed (pending) valve state change count down timers (in task intervals). +static RECOVERY_STATE_T recoveryState; ///< IOFP valve recovery setting. static OVERRIDE_U32_T valveStates[ DD_NUM_OF_VALVES ]; ///< Currently commanded valves states. static OVERRIDE_U32_T valveSensedStates[ DD_NUM_OF_VALVES ]; ///< Valve sensed states override. @@ -97,6 +98,7 @@ fpValveStatesPublishInterval.ovData = VALVES_STATE_PUB_INTERVAL; fpValveStatesPublishInterval.ovInitData = 0; fpValveStatesPublishInterval.override = OVERRIDE_RESET; + recoveryState = MAX_RECOVERY; // Initialize commanded valve states for ( i = 0; i < DD_NUM_OF_VALVES; i++ ) @@ -566,6 +568,18 @@ /*********************************************************************//** * @brief + * The getRecoveryState function gets the current valve recovery state. + * @details \b Inputs: recoveryState + * @details \b Outputs: recoveryState + * @return the current valve recovery state. + *************************************************************************/ +RECOVERY_STATE_T getRecoveryState( void ) +{ + return recoveryState; +} + +/*********************************************************************//** + * @brief * The publishValvesStates function publishes DD valves states at the set interval. * @details \b Inputs: valvesStatesPublicationTimerCounter * @details \b Outputs: valvesStatesPublicationTimerCounter Index: firmware/App/DDCommon.h =================================================================== diff -u -rab5cc1483b02bb7bc0402096f26263e759f9c723 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision ab5cc1483b02bb7bc0402096f26263e759f9c723) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -98,20 +98,6 @@ U32 compatibilityRev; ///< DD compatibility revision. } DD_VERSIONS_T; -/// Payload record structure for an FP versions message. -typedef struct -{ - U08 major; ///< FP version major revision. - U08 minor; ///< FP version minor revision. - U08 micro; ///< FP version micro revision. - U16 build; ///< FP build version. - U08 fpgaId; ///< FP FPGA ID. - U08 fpgaMajor; ///< FP FPGA major revision. - U08 fpgaMinor; ///< FP FPGA minor revision. - U08 fpgaLab; ///< FP FPGA lab revision. - U32 compatibilityRev; ///< FP compatibility revision. -} FP_VERSIONS_T; - /// Record defining the fields in a UI version request message. typedef struct { Index: firmware/App/Drivers/ConductivityTeensy.c =================================================================== diff -u -re0c45c725884d780b76dd54a617ab6ed333d7ba2 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision e0c45c725884d780b76dd54a617ab6ed333d7ba2) +++ firmware/App/Drivers/ConductivityTeensy.c (.../ConductivityTeensy.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -181,13 +181,13 @@ static COND_PARSE_STATUS parseEEPROMdata( const U08 *buffer, U32 len ); static COND_PARSE_STATUS parseConductivityMeasurements( const U08 *buffer ); -static U32 getTeensyCondId( CONDUCTIVITY_SENSORS_T sensorId ); -static void calculateConductivity( TEENSY_SENSOR_INDEX_T sensorNum ); -static void calculateConductivityAly( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); -static void calculateConductivityUpdatedStandard( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); -static void calculateConductivityStandard( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); -static void calculateTemperature( TEENSY_SENSOR_INDEX_T sensorNum ); -static void calculateResistance( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ); +static U32 getTeensyCondId( U32 sensorId ); +static void calculateConductivity( U32 sensorNum ); +static void calculateConductivityAly( U32 sensorNum, BOOL isFPSensor ); +static void calculateConductivityUpdatedStandard( U32 sensorNum, BOOL isFPSensor ); +static void calculateConductivityStandard( U32 sensorNum, BOOL isFPSensor ); +static void calculateTemperature( U32 sensorNum ); +static void calculateResistance( U32 sensorNum, BOOL isFPSensor ); /*********************************************************************//** * @brief @@ -838,16 +838,15 @@ static COND_COMM_STATE_T rxInitSensor( void ) { COND_COMM_STATE_T state = COND_COMM_STATE_RX; - COND_INIT_STATUS_T initStatusInProgress = COND_INIT_STATUS_FAILED; // set to fail for testing COND_INIT_STATUS_T initStatusInitialized = COND_INIT_STATUS_FAILED; // if data populates BOOL recvComplete = rxTeensyReadRsp( TEENSY_CMD_INIT_SENSOR ); if ( TRUE == recvComplete ) { // Reset the timer for next use. condResponseTime = 0; - // Read the data from the receive buffer - initStatusInProgress = ( COND_INIT_STATUS_T )condRxBuffer[ 0 ]; + // Read the data from the receive buffer. Pull 2nd byte as first byte is + // discarded. initStatusInitialized = ( COND_INIT_STATUS_T )condRxBuffer[ 1 ]; // Store the init status @@ -1791,12 +1790,12 @@ // Store Raw value in array index for position ( sensorNum - 1 ) memcpy( &condRawMeasurement[ tempSensor.sensorNum - 1 ], &tempSensor, sizeof( COND_SENSOR_DATA_T ) ); - // Calculate and store Conductivity from raw values - calculateConductivity( tempSensor.sensorNum - 1 ); - // Calculate and store Temperature from raw values. calculateTemperature( tempSensor.sensorNum - 1 ); + // Calculate and store Conductivity from raw values + calculateConductivity( tempSensor.sensorNum - 1 ); + parseStatus = COND_PARSE_SUCCESS; } } @@ -1812,7 +1811,7 @@ * @param sensorId - Id of DD Conductivity Sensors * @return sensorNum - Sensor Index. *************************************************************************/ -static U32 getTeensyCondId( CONDUCTIVITY_SENSORS_T sensorId ) +static U32 getTeensyCondId( U32 sensorId ) { U32 sensorNum = 0; @@ -1854,7 +1853,7 @@ * @param sensorId ID of conductivity sensor to get conductivity. * @return The current conductivity of a given conductivity sensor. *************************************************************************/ -F32 getTeensyConductivityValue( CONDUCTIVITY_SENSORS_T sensorId ) +F32 getTeensyConductivityValue( U32 sensorId ) { U32 sensorNum = getTeensyCondId( sensorId ); F32 result = 0.0F; @@ -1877,7 +1876,7 @@ * @param sensorId ID of conductivity sensor to get temperature. * @return The current temperature of a given conductivity sensor. *************************************************************************/ -F32 getTeensyConductivityTemperatureValue( CONDUCTIVITY_SENSORS_T sensorId ) +F32 getTeensyConductivityTemperatureValue( U32 sensorId ) { U32 sensorNum = getTeensyCondId( sensorId ); F32 result = 0.0F; @@ -1900,7 +1899,7 @@ * @param sensorId ID of conductivity sensor to get temperature. * @return The current temperature of a given conductivity sensor. *************************************************************************/ -F32 getTeensyConductivityResistanceValue( CONDUCTIVITY_SENSORS_T sensorId ) +F32 getTeensyConductivityResistanceValue( U32 sensorId ) { U32 sensorNum = getTeensyCondId( sensorId ); F32 result = 0.0F; @@ -1923,7 +1922,7 @@ * @param isFPSensor - T/F if sensor is on FP hardware. * @return *************************************************************************/ -static void calculateConductivity( TEENSY_SENSOR_INDEX_T sensorNum ) +static void calculateConductivity( U32 sensorNum ) { BOOL isFPSensor = FALSE; @@ -1956,7 +1955,7 @@ * @param isFPSensor - T/F if sensor is on FP hardware. * @return *************************************************************************/ -static void calculateConductivityAly( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ) +static void calculateConductivityAly( U32 sensorNum, BOOL isFPSensor ) { F32 calculatedConductivity = 0.0; F32 B3 = 0.0; @@ -1973,6 +1972,11 @@ { R = COND_INFINITE_R_VALUE; } + // To prevent nan's being thrown into our rolling average by dividing by 0, we set to 1. + else if ( R == 0 ) + { + R = 1; + } if ( TRUE == isFPSensor ) { @@ -2009,7 +2013,7 @@ * @param isFPSensor - T/F if sensor is on FP hardware. * @return *************************************************************************/ -static void calculateConductivityUpdatedStandard( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ) +static void calculateConductivityUpdatedStandard( U32 sensorNum, BOOL isFPSensor ) { F32 calculatedConductivity = 0.0; F64 alpha = 0.0; @@ -2043,20 +2047,25 @@ * @param isFPSensor - T/F if sensor is on FP hardware. * @return *************************************************************************/ -static void calculateConductivityStandard( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ) +static void calculateConductivityStandard( U32 sensorNum, BOOL isFPSensor ) { F32 calculatedConductivity = 0.0; F64 alpha = 0.0; F64 k = 0.0; F32 R = condRawMeasurement[ sensorNum ].impRzMag; - // Aly sensors are known to send the driver INF in unfavorable conditions for impedance. e.g: open air + // Sensors are known to send the driver INF in unfavorable conditions for impedance. e.g: open air // Change it to some high value that can be determined that we are reading INF. // Otherwise we will publish no updated value or 0. if ( R == INFINITY ) { R = COND_INFINITE_R_VALUE; } + // To prevent nan's being thrown into our rolling average by dividing by 0, we set to 1. + else if ( R == 0 ) + { + R = 1; + } if ( TRUE == isFPSensor ) { @@ -2087,7 +2096,7 @@ * @param isFPSensor - T/F if sensor is on FP hardware. * @return *************************************************************************/ -static void calculateResistance( TEENSY_SENSOR_INDEX_T sensorNum, BOOL isFPSensor ) +static void calculateResistance( U32 sensorNum, BOOL isFPSensor ) { F32 calculatedResistance = 0.0; @@ -2126,7 +2135,7 @@ * @param sensorNum - Teensy sensor index value. * @return *************************************************************************/ -static void calculateTemperature( TEENSY_SENSOR_INDEX_T sensorNum ) +static void calculateTemperature( U32 sensorNum ) { F32 calculatedTemperature = 0.0; @@ -2160,7 +2169,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); - if ( payload.index <= LAST_FP_COND_SENSOR ) + if ( payload.index < NUM_OF_CONDUCTIVITY_SENSORS ) { // D74 is not connected to Teensy and does not have a data structure to override. if ( LAST_DD_COND_SENSOR != payload.index ) @@ -2170,13 +2179,13 @@ { F32 value = payload.state.f32; - condCalculatedMeasurement[ payload.index ].Conductivity.ovData = value; - condCalculatedMeasurement[ payload.index ].Conductivity.override = OVERRIDE_KEY; + condCalculatedMeasurement[ getTeensyCondId( payload.index ) ].Conductivity.ovData = value; + condCalculatedMeasurement[ getTeensyCondId( payload.index ) ].Conductivity.override = OVERRIDE_KEY; } else { - condCalculatedMeasurement[ payload.index ].Conductivity.override = OVERRIDE_RESET; - condCalculatedMeasurement[ payload.index ].Conductivity.ovData = condCalculatedMeasurement[ payload.index ].Conductivity.ovInitData; + condCalculatedMeasurement[ getTeensyCondId( payload.index ) ].Conductivity.override = OVERRIDE_RESET; + condCalculatedMeasurement[ getTeensyCondId( payload.index ) ].Conductivity.ovData = condCalculatedMeasurement[ payload.index ].Conductivity.ovInitData; } } } @@ -2199,7 +2208,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); - if ( payload.index <= LAST_FP_COND_SENSOR ) + if ( payload.index < NUM_OF_CONDUCTIVITY_SENSORS ) { // D74 is not connected to Teensy and does not have a data structure to override. if ( LAST_DD_COND_SENSOR != payload.index ) @@ -2239,7 +2248,7 @@ TEST_OVERRIDE_ARRAY_PAYLOAD_T payload; OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &payload ); - if ( payload.index <= LAST_FP_COND_SENSOR ) + if ( payload.index < NUM_OF_CONDUCTIVITY_SENSORS ) { // D74 is not connected to Teensy and does not have a data structure to override. if ( LAST_DD_COND_SENSOR != payload.index ) Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -re0c45c725884d780b76dd54a617ab6ed333d7ba2 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision e0c45c725884d780b76dd54a617ab6ed333d7ba2) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -175,6 +175,8 @@ initGenDialysateMode(); setCurrentSubState( NO_SUB_STATE ); + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); //calculateD48PumpSpeedForBCFill(); initialD48PumpSpeed = getCalculatedD48PumpSpeedForBCFill(); setD48PumpSpeedForBCFill( initialD48PumpSpeed ); @@ -243,6 +245,9 @@ switch( state ) { case DD_GEND_STATE_START: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + // Do nothing break; @@ -272,7 +277,14 @@ startHeater( D5_HEAT ); //Turn on Trimmer heater - setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + } + else + { + setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + } startHeater( D45_HEAT ); //Testing : Enable close loop once testing is complete @@ -285,13 +297,18 @@ setRinsePumpState( RINSE_PUMP_STATE_ON ); transitionToBalChamberFill(); + // Activate Balancing Chamber Switching + requestBalChamberSwitching( TRUE ); //Testing bypassStateDelayStartTimeMS = getMSTimerCount(); delayBypassStateFlag = TRUE; break; case DD_GEND_DIALYSATE_DELIVERY_STATE: + // Activate Balancing Chamber Switching + requestBalChamberSwitching( TRUE ); + //Previous state setValveState( D47_VALV, VALVE_STATE_CLOSED ); // spent chamber purge valve setValveState( D8_VALV, VALVE_STATE_CLOSED ); @@ -309,7 +326,14 @@ startHeater( D5_HEAT ); //Turn on Trimmer heater - setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + } + else + { + setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + } startHeater( D45_HEAT ); //setDialysatePumpTargetRPM( D12_PUMP, FRESH_DIAL_PUMP_INITIAL_RPM, FALSE ); @@ -333,6 +357,9 @@ break; case DD_GEND_SPENT_CHAMBER_FILL_STATE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + //Set valves and actuators setValveState( D35_VALV, VALVE_STATE_CLOSED ); // VDI setValveState( D40_VALV, VALVE_STATE_CLOSED ); // VDO @@ -376,6 +403,9 @@ break; case DD_GEND_BICARB_CHAMBER_FILL_STATE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + requestConcentratePumpOff( D11_PUMP, FALSE ); requestConcentratePumpOff( D10_PUMP, FALSE ); requestConcentratePumpOff( D76_PUMP, FALSE ); @@ -412,6 +442,8 @@ break; case DD_GEND_DIALYSATE_DELIVERY_PAUSE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); setDialysatePumpTargetRPM( D12_PUMP, getFreshDialPumpInitialRpm(), TRUE ); signalDialysatePumpHardStop( D48_PUMP ); requestConcentratePumpOff( D11_PUMP, FALSE ); @@ -453,6 +485,8 @@ break; case DD_GEND_ISOLATED_UF_STATE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); //TODO : define actuators states break; @@ -741,11 +775,6 @@ delayBypassStateFlag = FALSE; } } - else - { - //Execute balancing chamber - execBalancingChamberControl(); - } if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_SPENT_CHAMBER_H_FILL ) == TRUE ) { @@ -822,9 +851,6 @@ #endif else { - //Execute balancing chamber - execBalancingChamberControl(); - //Execute ultrafiltration execUFControl(); } Index: firmware/App/Monitors/Conductivity.h =================================================================== diff -u -r7392f6b2662bbdb91ea4dfcdb788abf64619e10a -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Monitors/Conductivity.h (.../Conductivity.h) (revision 7392f6b2662bbdb91ea4dfcdb788abf64619e10a) +++ firmware/App/Monitors/Conductivity.h (.../Conductivity.h) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -8,7 +8,7 @@ * @file Conductivity.h * * @author (last) Michael Garthwaite -* @date (last) 06-Mar-2026 +* @date (last) 02-Feb-2026 * * @author (original) Vinayakam Mani * @date (original) 13-Sep-2024 Index: firmware/App/Monitors/Temperature.c =================================================================== diff -u -r46a42611591cb92eef5f20c8d39964d406c5c8cc -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Monitors/Temperature.c (.../Temperature.c) (revision 46a42611591cb92eef5f20c8d39964d406c5c8cc) +++ firmware/App/Monitors/Temperature.c (.../Temperature.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -16,11 +16,6 @@ ***************************************************************************/ #include "BalancingChamber.h" -#ifdef __TEENSY_CONDUCTIVITY_DRIVER__ -#include "ConductivityTeensy.h" -#else -#include "ConductivitySensors.h" -#endif #include "Conductivity.h" #include "Flow.h" #include "Messaging.h" @@ -345,7 +340,14 @@ d50TempSampleIntervalCounter = 0; } + F32 d50Temp = getTemperatureValue( D50_TEMP ); + d50TempSamplesC[ d50TempSamplesNextIndex ] = d50Temp; + d50TempRunningSumC += d50Temp; + d50TempSamplesNextIndex = INC_WRAP( d50TempSamplesNextIndex, 0, D50_TEMP_MOVING_AVG_NUM_OF_SAMPLES - 1 ); + d50TempCount = INC_CAP( d50TempCount, D50_TEMP_MOVING_AVG_NUM_OF_SAMPLES ); + d50TempAvgC = d50TempRunningSumC / (F32)d50TempCount; + // Moving average sample collection interval varies based on the dialysate flow rate if ( ++d99TempSampleIntervalCounter >= tempDataCollectionTimeInterval ) { @@ -380,6 +382,8 @@ { DIAL_TEMPERATURE_SENSORS_T i; F32 temperatureC = 0.0F; + U32 currentIndex = 0; + F32 prevSampleToRemoveC = 0.0f; for ( i = DIAL_TEMP_FIRST; i < NUM_OF_DIAL_TEMPS; i++ ) { @@ -392,22 +396,18 @@ { CONDUCTIVITY_SENSORS_T sensor = ( DIAL_TEMP_D28 == i ? D27_COND : D29_COND ); -#ifdef __TEENSY_CONDUCTIVITY_DRIVER__ - - if (sensor != D74_COND) + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) != TRUE ) { temperatureC = getTeensyConductivityTemperatureValue( sensor ); } else { - temperatureC = getConductivityTemperatureValue( sensor ); + temperatureC = getConductivityTemperature( sensor ); } -#else - temperatureC = getConductivityTemperatureValue( sensor ); -#endif - U32 currentIndex = dialTempMovingAvgData[ i ].dialTempSamplesNextIndex; - F32 prevSampleToRemoveC = dialTempMovingAvgData[ i ].dialTempSamplesC[ currentIndex ]; + currentIndex = dialTempMovingAvgData[ i ].dialTempSamplesNextIndex; + prevSampleToRemoveC = dialTempMovingAvgData[ i ].dialTempSamplesC[ currentIndex ]; + dialTempMovingAvgData[ i ].dialTempDataColStartTimeMS = getMSTimerCount(); dialTempMovingAvgData[ i ].dialTempColHasTimerBeenSet = TRUE; dialTempMovingAvgData[ i ].dialTempSamplesC[ currentIndex ] = temperatureC; @@ -535,19 +535,24 @@ data.d50Temp = getTemperatureValue( D50_TEMP ); data.d99Temp = getTemperatureValue( D99_TEMP ); data.boardTemp = getTemperatureValue( BRD_TEMP ); -#ifdef __TEENSY_CONDUCTIVITY_DRIVER__ - data.d16CondTemp = getTeensyConductivityTemperatureValue( D17_COND ); - data.d28CondTemp = getTeensyConductivityTemperatureValue( D27_COND ); - data.d30CondTemp = getTeensyConductivityTemperatureValue( D29_COND ); - data.d44CondTemp = getTeensyConductivityTemperatureValue( D43_COND ); - data.d75CondTemp = getConductivityTemperatureValue( D74_COND ); -#else - data.d16CondTemp = getConductivityTemperatureValue( D17_COND ); - data.d28CondTemp = getConductivityTemperatureValue( D27_COND ); - data.d30CondTemp = getConductivityTemperatureValue( D29_COND ); - data.d44CondTemp = getConductivityTemperatureValue( D43_COND ); - data.d75CondTemp = getConductivityTemperatureValue( D74_COND ); -#endif + + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) != TRUE ) + { + data.d16CondTemp = getTeensyConductivityTemperatureValue( D17_COND ); + data.d28CondTemp = getTeensyConductivityTemperatureValue( D27_COND ); + data.d30CondTemp = getTeensyConductivityTemperatureValue( D29_COND ); + data.d44CondTemp = getTeensyConductivityTemperatureValue( D43_COND ); + data.d75CondTemp = getTeensyConductivityTemperatureValue( D74_COND ); + } + else + { + data.d16CondTemp = getConductivityTemperature( D17_COND ); + data.d28CondTemp = getConductivityTemperature( D27_COND ); + data.d30CondTemp = getConductivityTemperature( D29_COND ); + data.d44CondTemp = getConductivityTemperature( D43_COND ); + data.d75CondTemp = getConductivityTemperature( D74_COND ); + } + data.d4AvgTemp = getD4AverageTemperature(); data.d50AvgTemp = getD50AverageTemperature(); data.d99AvgTemp = getD99AverageTemperature(); Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -rb2e7c9194acd84783d2bbad64c5720410493e199 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision b2e7c9194acd84783d2bbad64c5720410493e199) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -61,7 +61,8 @@ #define FPGA_EXPECTED_ID 0x06 ///< FPGA expected ID for Beta 2 systems. //TODO: Remove once Beta 1.9 is obsolete -#define FPGA_BETA_1_9_EXPECTED_ID 0X04 ///< FPGA expected ID for Beta 1 and 1.9 systems. +#define FPGA_BETA_1_9_EXPECTED_ID 0X08 ///< FPGA expected ID for Beta 1.9 systems. +#define FPGA_BETA_1_0_EXPECTED_ID 0x04 ///< FPGA expected ID for Beta 1.0 systems. #define MAX_COMM_ERROR_RETRIES 5 ///< Maximum number of communication error retries @@ -212,8 +213,7 @@ U08 fpgaValveSpPWMStates; ///< Reg 599. Spare Valves PWM states U08 fpgaD11_D10_PumpFault; ///< Reg 600. Concentrate pump fault register for D11_Pump and D10_Pump U08 fpgaRTDCountErrorCycles; ///< Reg 601. Count of each incomplete seq of reads from RTD ADC. - U16 fpga_UnUsed_4; ///< Reg 602. Not Used - U16 fpga_UnUsed_5; ///< Reg 604. Not Used + U32 fpgaD10PumpStepCountStatus; ///< Reg 602. Bicarb concentrate pump revolution down count status U32 fpgaD78Temp; ///< Reg 606. Outlet heat exchanger temperature U32 fpgaD1Temp; ///< Reg 610. Inlet heat exchanger temperature U32 fpgaD4Temp; ///< Reg 614. Hydraulics primary heater temperature @@ -229,16 +229,14 @@ U08 fpgaD48HallStatus; ///< Reg 635. Spent dialysate pump hall sensor direction status U08 fpgaD6FloaterStatus; ///< Reg 636. Floater 1 level sensor status U08 fpgaFloater2Status; ///< Reg 637. Floater 2 level sensor status - U16 fpgaD11PumpStepCountStatus; ///< Reg 638. Acid concentrate pump revolution down count status - U16 fpgaD10PumpStepCountStatus; ///< Reg 640. Bicarb concentrate pump revolution down count status + U32 fpgaD11PumpStepCountStatus; ///< Reg 638. Acid concentrate pump revolution down count status U16 fpgaAdcTemp; ///< Reg 642. TBD U16 fpgaAdcVccInt; ///< Reg 644. TBD U16 fpgaAdcVccAux; ///< Reg 646. TBD U16 fpgaAdcVpVn; ///< Reg 648. TBD U16 fpgaD12PumpSpeedFeedback; ///< Reg 650. D12 Pump speed feedback U16 fpgaD48PumpSpeedFeedback; ///< Reg 652. D48 Pump Speed feedback - U16 fpga_UnUsed_6; ///< Reg 654. Not used - U16 fpgaD76PumpStepCountStatus; ///< Reg 656. UF pump revolution down count status + U32 fpgaD76PumpStepCountStatus; ///< Reg 654. UF pump revolution down count status U08 fpgaD76PumpFault; ///< Reg 658: UF pump fault U08 fpga_UnUsed_3; ///< Reg 659: Not used @@ -320,8 +318,7 @@ U16 fpgaD18PresTemp; ///< Reg 534. D18 MPM pressure sensor RAW temperature data U16 fpgaD41PresPressure; ///< Reg 536. D41 MPM pressure sensor RAW pressure data U16 fpgaD41PresTemp; ///< Reg 538. D41 MPM pressure sensor RAW temperature data - U16 fpgaAvailableRegister1; ///< Reg 540. Available register 1 - U16 fpgaAvailableRegister2; ///< Reg 542. Available register 2 + U32 fpgaAvailableRegister1; ///< Reg 540. Available register 1 U08 fpgaHallSensInputs; ///< Reg 544. Hall sensor Inputs U08 fpgaD42TxFIFOCnt; ///< Reg 545. Blood leak sensor transmit FIFO count U16 fpgaD42RxErrorCnt; ///< Reg 546. Blood leak sensor Receive error count @@ -336,8 +333,7 @@ U08 fpgaValveSpPWMStates; ///< Reg 559. Spare Valves PWM states U08 fpgaD11_D10_PumpFault; ///< Reg 560. Concentrate pump fault register for D11_Pump and D10_Pump U08 fpgaRTDCountErrorCycles; ///< Reg 561. Count of each incomplete seq of reads from RTD ADC. - U16 fpgaAvailableRegister3; ///< Reg 562. Available register 3 - U16 fpgaAvailableRegister4; ///< Reg 564. Available register 4 + U32 fpgaD10PumpStepCountStatus; ///< Reg 562. Bicarb concentrate pump revolution down count status U32 fpgaD78Temp; ///< Reg 566. Outlet heat exchanger temperature U32 fpgaD1Temp; ///< Reg 570. Inlet heat exchanger temperature U32 fpgaD4Temp; ///< Reg 574. Hydraulics primary heater temperature @@ -354,16 +350,14 @@ U08 fpgaD48HallStatus; ///< Reg 595. Spent dialysate pump hall sensor direction status U08 fpgaD6FloaterStatus; ///< Reg 596. Floater 1 level sensor status U08 fpgaConductiveLevelStatus; ///< Reg 597. Conductive level sensor status - U16 fpgaD11PumpStepCountStatus; ///< Reg 598. Acid concentrate pump revolution down count status - U16 fpgaD10PumpStepCountStatus; ///< Reg 600. Bicarb concentrate pump revolution down count status + U32 fpgaD11PumpStepCountStatus; ///< Reg 598. Acid concentrate pump revolution down count status U16 fpgaAdcTemp; ///< Reg 602. TBD U16 fpgaAdcVccInt; ///< Reg 604. TBD U16 fpgaAdcVccAux; ///< Reg 606. TBD U16 fpgaAdcVpVn; ///< Reg 608. TBD U16 fpgaD12PumpSpeedFeedback; ///< Reg 610. D12 Pump speed feedback U16 fpgaD48PumpSpeedFeedback; ///< Reg 612. D48 Pump Speed feedback - U16 fpgaAvailableRegister5; ///< Reg 614. Available register 5 - U16 fpgaD76PumpStepCountStatus; ///< Reg 616. UF pump revolution down count status + U32 fpgaD76PumpStepCountStatus; ///< Reg 614. UF pump revolution down count status U08 fpgaD76PumpFault; ///< Reg 618: UF pump fault U08 fpgaHallSensorStatus; ///< Reg 619: HDF Hall sensor status @@ -408,59 +402,59 @@ U32 fpgaD11PumpHallSense; ///< Reg 690. Concentrate pump D11_Pump hall sensor pulse width U32 fpgaD10PumpHallSense; ///< Reg 694. Concentrate pump D10_Pump hall sensor pulse width U32 fpgaD76PumpHallSense; ///< Reg 698. Concentrate pump D76_Pump hall sensor pulse width - U32 fpgaD17CondDataCal; ///< Reg 702. D17 CAL word update - U32 fpgaD17CondCond; ///< Reg 706. D17 conductivity - U32 fpgaD17CondTemp; ///< Reg 710. D17 Temperature + U32 fpgaD17DataCal; ///< Reg 702. D17 CAL word update + F32 fpgaD17CondResistance; ///< Reg 706. D17 conductivity resistance + F32 fpgaD17TempResistance; ///< Reg 710. D17 Temperature resistance U08 fpgaD17CondReadCnt; ///< Reg 714. D17 successful read count U08 fpgaD17CondErrorCnt; ///< Reg 715. D17 error read count U08 fpgaD17TempReadCount; ///< Reg 716. D17 temperature successful read count U08 fpgaD17TempErrorCount; ///< Reg 717. D17 Temperature error read count U08 fpgaD17CalMemCounter; ///< Reg 718. D17 CAL counter U08 fpgaD74CalMemCounter; ///< Reg 719. D74 CAL counter - U32 fpgaD74CondDataCal; ///< Reg 720. D74 CAL word update - U32 fpgaD74CondCond; ///< Reg 724. D74 conductivity - U32 fpgaD74CondTemp; ///< Reg 728. D74 Temperature + U32 fpgaD74DataCal; ///< Reg 720. D74 CAL word update + F32 fpgaD74CondResistance; ///< Reg 724. D74 conductivity resistance + F32 fpgaD74TempResistance; ///< Reg 728. D74 Temperature resistance U08 fpgaD74CondReadCnt; ///< Reg 732. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 733. D74 error read count U08 fpgaD74TempReadCount; ///< Reg 734. D74 temperature successful read count U08 fpgaD74TempErrorCount; ///< Reg 735. D74 Temperature error read count - U32 fpgaD27CondDataCal; ///< Reg 736. D27 CAL word update - U32 fpgaD27CondCond; ///< Reg 740. D27 conductivity - U32 fpgaD27CondTemp; ///< Reg 744. D27 Temperature + U32 fpgaD27DataCal; ///< Reg 736. D27 CAL word update + F32 fpgaD27CondResistance; ///< Reg 740. D27 conductivity resistance + F32 fpgaD27TempResistance; ///< Reg 744. D27 Temperature reistance U08 fpgaD27CondReadCnt; ///< Reg 748. D27 successful read count U08 fpgaD27CondErrorCnt; ///< Reg 749. D27 error read count U08 fpgaD27TempReadCount; ///< Reg 750. D27 temperature successful read count U08 fpgaD27TempErrorCount; ///< Reg 751. D27 Temperature error read count U08 fpgaD27CalMemCounter; ///< Reg 752. D27 CAL counter U08 fpgaD29CalMemCounter; ///< Reg 753. D29 CAL counter - U32 fpgaD29CondDataCal; ///< Reg 754. D29 CAL word update - U32 fpgaD29CondCond; ///< Reg 758. D29 conductivity - U32 fpgaD29CondTemp; ///< Reg 762. D29 Temperature + U32 fpgaD29DataCal; ///< Reg 754. D29 CAL word update + F32 fpgaD29CondResistance; ///< Reg 758. D29 conductivity resistance + F32 fpgaD29TempResistance; ///< Reg 762. D29 Temperature resistance U08 fpgaD29CondReadCnt; ///< Reg 766. D29 successful read count U08 fpgaD29CondErrorCnt; ///< Reg 767. D29 error read count U08 fpgaD29TempReadCount; ///< Reg 768. D29 temperature successful read count U08 fpgaD29TempErrorCount; ///< Reg 769. D29 Temperature error read count - U32 fpgaD43CondDataCal; ///< Reg 770. D43 CAL word update - U32 fpgaD43CondCond; ///< Reg 774. D43 conductivity - U32 fpgaD43CondTemp; ///< Reg 778. D43 Temperature + U32 fpgaD43DataCal; ///< Reg 770. D43 CAL word update + F32 fpgaD43CondResistance; ///< Reg 774. D43 conductivity resistance + F32 fpgaD43TempResistance; ///< Reg 778. D43 Temperature resistance U08 fpgaD43CondReadCnt; ///< Reg 782. D43 successful read count U08 fpgaD43CondErrorCnt; ///< Reg 783. D43 error read count U08 fpgaD43TempReadCount; ///< Reg 784. D43 temperature successful read count U08 fpgaD43TempErrorCount; ///< Reg 785. D43 Temperature error read count U08 fpgaD43CalMemCounter; ///< Reg 786. D43 CAL counter U08 fpgaP9CalMemCounter; ///< Reg 787. P9 CAL counter - U32 conductivityP9Data; ///< Reg 788. P9 CAL word update - U32 conductivityP9Cond; ///< Reg 792. P9 Conductivity - U32 conductivityP9Temp; ///< Reg 796. P9 Temperature - U08 conductivityP9ReadCount; ///< Reg 800. P9 successful read count - U08 conductivityP9ErrorCount; ///< Reg 801. P9 error read count + U32 fpgaP9CalData; ///< Reg 788. P9 CAL word update + F32 fpgaP9CondResistance; ///< Reg 792. P9 Conductivity resistance + F32 fpgaP9TempResistance; ///< Reg 796. P9 Temperature resistance + U08 fpgaP9CondReadCount; ///< Reg 800. P9 successful read count + U08 fpgaP9CondErrorCount; ///< Reg 801. P9 error read count U08 fpgaP9TempReadCount; ///< Reg 802. P9 temperature successful read count U08 fpgaP9TempErrorCount; ///< Reg 803. P9 Temperature error read count - U32 conductivityP18Data; ///< Reg 804. P18 CAL word update - U32 conductivityP18Cond; ///< Reg 808. P18 Conductivity - U32 conductivityP18Temp; ///< Reg 812. P18 Temperature - U08 conductivityP18ReadCount; ///< Reg 816. P18 successful read count - U08 conductivityP18ErrorCount; ///< Reg 817. P18 error read count + U32 fpgaP18CalData; ///< Reg 804. P18 CAL word update + F32 fpgaP18CondResistance; ///< Reg 808. P18 Conductivity resistance + F32 fpgaP18TempReistance; ///< Reg 812. P18 Temperature resistance + U08 fpgaP18CondReadCount; ///< Reg 816. P18 successful read count + U08 fpgaP18CondErrorCount; ///< Reg 817. P18 error read count U08 fpgaP18TempReadCount; ///< Reg 818. P18 temperature successful read count U08 fpgaP18TempErrorCount; ///< Reg 819. P18 Temperature error read count U08 fpgaP18CalMemCounter; ///< Reg 820. P18 CAL counter @@ -489,10 +483,9 @@ U08 fpgaD12PumpControl; ///< Reg 36. DGP Control U08 fpgaD48PumpControl; ///< Reg 37. SDP Control U16 fpgaD48PumpSpeed; ///< Reg 38. SDP Speed/RPM Control - U16 fpgaNotUsed_1; ///< Reg 40. Not used - U08 fpgaD11PumpControl; ///< Reg 42. Acid Concentrate Pump Control - U08 fpgaD10PumpControl; ///< Reg 43. BiCarb Concentrate Pump Control - U16 fpgaNotUsed_2; ///< Reg 44. Not used + U32 fpgaD10PumpRevCount; ///< Reg 40. Bicarb Concentrate pump revolution count + U08 fpgaD11PumpControl; ///< Reg 44. Acid Concentrate Pump Control + U08 fpgaD10PumpControl; ///< Reg 45. BiCarb Concentrate Pump Control U08 fpgaD42SensorTest; ///< Reg 46. Blood leak sensor test U08 fpgaD42UARTControl; ///< Reg 47. Blood leak sensor UART control U08 fpgaD42FIFOTx; ///< Reg 48. Blood leak sensor FIFO transmit control @@ -505,14 +498,12 @@ U16 fpgaVSPPWMLow; ///< Reg 58. VSP PWM low ( Spare valves ) U16 fpgaVSPPWMPeriod; ///< Reg 60. VSP PWM period U16 fpgaVSPPWMPullIn; ///< Reg 62. VSP PWM pull in - U16 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count - U16 fpgaD10PumpRevCount; ///< Reg 66. Bicarb Concentrate pump revolution count + U32 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count U08 fpgaADCControl; ///< Reg 68. FPGA internal ADC Control register for debugging U08 fpgaGPIOControl; ///< Reg 69. FPGA GPIO control interface U16 fpgaACRelayPWMLow; ///< Reg 70. Length of time in 10us resoultion that PWM output stays low. U16 fpgaACRelayPWMPeriod; ///< Reg 72. PWM period for AC relay/heater. - U16 fpgaNotUsed_3; ///< Reg 74. Not Used - U16 fpgaD76PumpRevCount; ///< Reg 76. UF pump revolution count + U32 fpgaD76PumpRevCount; ///< Reg 74. UF pump revolution count U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control U08 notused; ///< Reg 79. Not used @@ -567,15 +558,14 @@ U32 fpgaConSensD17D74_Data_In; ///< Reg 22. D17,D74 Initialization data register U16 fpgaConSensD27D29_Addrs; ///< Reg 26. D27,D29 Initialization Address register U32 fpgaConSensD27D29_Data_In; ///< Reg 28. D27,D29 Initialization data register - U16 fpgaRemoteUpdate_Write; ///< Reg 32.Register for Remote update used by SW. + U16 fpgaRemoteUpdate_Write; ///< Reg 32. Register for Remote update used by SW. U16 fpgaD12PumpSpeed; ///< Reg 34. D48 Speed/RPM Control U08 fpgaD12PumpControl; ///< Reg 36. DGP Control U08 fpgaD48PumpControl; ///< Reg 37. SDP Control U16 fpgaD48PumpSpeed; ///< Reg 38. SDP Speed/RPM Control - U16 unusedRegister; ///< Reg 40. Unused register - U08 fpgaD11PumpControl; ///< Reg 42. Acid Concentrate Pump Control - U08 fpgaD10PumpControl; ///< Reg 43. BiCarb Concentrate Pump Control - U16 unusedRegister1; ///< Reg 44. Unused register1 + U32 fpgaD10PumpRevCount; ///< Reg 40. Bicarb Concentrate pump revolution count + U08 fpgaD11PumpControl; ///< Reg 44. Acid Concentrate Pump Control + U08 fpgaD10PumpControl; ///< Reg 45. BiCarb Concentrate Pump Control U08 fpgaD42SensorTest; ///< Reg 46. Blood leak sensor test U08 fpgaD42UARTControl; ///< Reg 47. Blood leak sensor UART control U08 fpgaD42FIFOTx; ///< Reg 48. Blood leak sensor FIFO transmit control @@ -588,14 +578,12 @@ U16 fpgaVSPPWMLow; ///< Reg 58. VSP PWM low ( Spare valves ) U16 fpgaVSPPWMPeriod; ///< Reg 60. VSP PWM period U16 fpgaVSPPWMPullIn; ///< Reg 62. VSP PWM pull in - U16 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count - U16 fpgaD10PumpRevCount; ///< Reg 66. Bicarb Concentrate pump revolution count + U32 fpgaD11PumpRevCount; ///< Reg 64. Acid Concentrate pump revolution count U08 fpgaADCControl; ///< Reg 68. FPGA internal ADC Control register for debugging U08 fpgaGPIOControl; ///< Reg 69. FPGA GPIO control interface U16 fpgaACRelayPWMLow; ///< Reg 70. Length of time in 10us resoultion that PWM output stays low. U16 fpgaACRelayPWMPeriod; ///< Reg 72. PWM period for AC relay/heater. - U16 unusedRegister2; ///< Reg 74. Unsed register2 - U16 fpgaD76PumpRevCount; ///< Reg 76. UF pump revolution count + U32 fpgaD76PumpRevCount; ///< Reg 74. UF pump revolution count U08 fpgaD76PumpControl; ///< Reg 78. UF Pump Control U08 notused; ///< Reg 79. Not used @@ -730,7 +718,8 @@ // check FPGA reported correct ID // TODO: Remove beta 1.9 expected ID once Beta 1.9 is obsolete - if ( ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) || ( FPGA_BETA_1_9_EXPECTED_ID == fpgaHeader.fpgaId ) ) + if ( ( FPGA_EXPECTED_ID == fpgaHeader.fpgaId ) || ( FPGA_BETA_1_9_EXPECTED_ID == fpgaHeader.fpgaId ) || + ( FPGA_BETA_1_0_EXPECTED_ID == fpgaHeader.fpgaId ) ) { // Check FPGA compatibility w/ firmware if ( DD_FPGA_COMPATIBILITY_REV == GET_FPGA_SENSOR_FIELD( fpgaCompatibilityRev ) ) @@ -1315,744 +1304,6 @@ /*********************************************************************//** * @brief - * The setFPGAD17CondReset function resets the FPGA Conductivity - * Sensor D17. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD17CondReset( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D17_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD17CondReset function clears the reset of FPGA Conductivity - * Sensor D17. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD17CondReset( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D17_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD17CondInitEnable function enables the FPGA Conductivity - * Sensor D17 initialzation procedure. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD17CondInitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D17_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD17CondInitEnable function clears the init process of FPGA Conductivity - * Sensor D17. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD17CondInitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D17_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD17CondWriteEnable function enables the FPGA Conductivity - * Sensor D17 write transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @warning: The address (setFPGAD17D74Address) and data (setFPGACD12Data) register - * must be populated before invoking this write enable function to initiate - * write transaction with the sensor. - * @return none - *************************************************************************/ -void setFPGAD17CondWriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D17_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD17CondWriteEnable function clears the write enable of FPGA Conductivity - * Sensor D17. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD17CondWriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D17_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD17CondReadEnable function enables the FPGA Conductivity - * Sensor D17 read transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @warning: The address (setFPGAD17D74Address) register must be populated - * before invoking this read enable function to initiate read transaction - * with the sensor. - * @return none - *************************************************************************/ -void setFPGAD17CondReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D17_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD17CondReadEnable function clears the read enable of FPGA Conductivity - * Sensor D17. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD17CondReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D17_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD27CondReset function resets the FPGA Conductivity - * Sensor D27. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD27CondReset( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D27_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD27CondReset function clears the reset of FPGA Conductivity - * Sensor D27. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD27CondReset( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D27_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD27CondInitEnable function enables the FPGA Conductivity - * Sensor D27 initialzation procedure. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD27CondInitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D27_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD27CondInitEnable function clears the init process of FPGA Conductivity - * Sensor D27. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD27CondInitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D27_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD27CondWriteEnable function enables the FPGA Conductivity - * Sensor D27 write transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register - * must be populated before invoking this write enable function to initiate - * write transaction with the sensor. - * @return none - *************************************************************************/ -void setFPGAD27CondWriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D27_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD27CondWriteEnable function clears the write enable of FPGA Conductivity - * Sensor D27. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD27CondWriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D27_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD27CondReadEnable function enables the FPGA Conductivity - * Sensor D27 read transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @warning: The address (setFPGACD12Address) register must be populated - * before invoking this read enable function to initiate read transaction - * with the sensor. - * @return none - *************************************************************************/ -void setFPGAD27CondReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D27_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD27CondReadEnable function clears the read enable of FPGA Conductivity - * Sensor D27. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD27CondReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D27_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGD29CondReset function resets the FPGA Conductivity - * Sensor D29. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD29CondReset( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D29_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD29CondReset function clears the reset of FPGA Conductivity - * Sensor D29. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD29CondReset( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D29_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD29CondInitEnable function enables the FPGA Conductivity - * Sensor D29 initialzation procedure. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD29CondInitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D29_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD29CondInitEnable function clears the init process of FPGA Conductivity - * Sensor D29. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD29CondInitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D29_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD29CondWriteEnable function enables the FPGA Conductivity - * Sensor D29 write transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register - * must be populated before invoking this write enable function to initiate - * write transaction with the sensor. - * @return none - *************************************************************************/ -void setFPGAD29CondWriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D29_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD29CondWriteEnable function clears the write enable of FPGA Conductivity - * Sensor D29. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD29CondWriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D29_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD29CondReadEnable function enables the FPGA Conductivity - * Sensor D29 read transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @warning: The address (setFPGACD12Address) register must be populated - * before invoking this read enable function to initiate read transaction - * with the sensor. - * @return none - *************************************************************************/ -void setFPGAD29CondReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, FPGA_D29_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD29CondReadEnable function clears the read enable of FPGA Conductivity - * Sensor D29. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD29CondReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD27D29Control, ~FPGA_D29_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD43CondReset function resets the FPGA Conductivity - * Sensor D43. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD43CondReset( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, FPGA_D43_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD43CondReset function clears the reset of FPGA Conductivity - * Sensor D43. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD43CondReset( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, ~FPGA_D43_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD43CondInitEnable function enables the FPGA Conductivity - * Sensor D43 initialzation procedure. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD43CondInitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, FPGA_D43_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD43CondInitEnable function clears the init process of FPGA Conductivity - * Sensor D43. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD43CondInitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, ~FPGA_D43_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD43CondWriteEnable function enables the FPGA Conductivity - * Sensor D43 write transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @warning: The address (setFPGACD12Address) and data (setFPGACD12Data) register - * must be populated before invoking this write enable function to initiate - * write transaction with the sensor. - * @return none - *************************************************************************/ -void setFPGAD43CondWriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, FPGA_D43_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD43CondWriteEnable function clears the write enable of FPGA Conductivity - * Sensor D43. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD43CondWriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, ~FPGA_D43_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD43CondReadEnable function enables the FPGA Conductivity - * Sensor D43 read transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @warning: The address (setFPGACD12Address) register must be populated - * before invoking this read enable function to initiate read transaction - * with the sensor. - * @return none - *************************************************************************/ -void setFPGAD43CondReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, FPGA_D43_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD43CondReadEnable function clears the read enable of FPGA Conductivity - * Sensor D43. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD43CondReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD43Control, ~FPGA_D43_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD74CondReset function resets the FPGA Conductivity - * Sensor D74. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD74CondReset( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D74_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD74CondReset function clears the reset of FPGA Conductivity - * Sensor D74. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD74CondReset( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D74_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD74CondInitEnable function enables the FPGA Conductivity - * Sensor D74 initialzation procedure. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void setFPGAD74CondInitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D74_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD74CondInitEnable function clears the init process of FPGA Conductivity - * Sensor D74. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD74CondInitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D74_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD74CondWriteEnable function enables the FPGA Conductivity - * Sensor D74 write transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @warning: The address (setFPGACD74Address) and data (setFPGACD74Data) register - * must be populated before invoking this write enable function to initiate - * write transaction with the sensor. - * @return none - *************************************************************************/ -void setFPGAD74CondWriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D74_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD74CondWriteEnable function clears the write enable of FPGA Conductivity - * Sensor D74. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD74CondWriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D74_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD74CondReadEnable function enables the FPGA Conductivity - * Sensor D74 read transaction. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @warning: The address (setFPGACD74Address) register must be populated - * before invoking this read enable function to initiate read transaction - * with the sensor. - * @return none - *************************************************************************/ -void setFPGAD74CondReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, FPGA_D74_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAD74CondReadEnable function clears the read enable of FPGA Conductivity - * Sensor D74. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param none - * @return none - *************************************************************************/ -void clearFPGAD74CondReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( fpgaConSensD17D74Control, ~FPGA_D74_RD_ENABLE_BIT ); -} - - -/*********************************************************************//** - * @brief - * The setFPGAD17D74Control function sets the FPGA Conductivity - * Sensor control register for D17 and D74. - * bit 7: Enables D74 read transaction (1), address needed - * bit 6: Enables D74 write transaction (1), address and data needs to be set - * bit 5: Enable D74 Init procedure (1) - * bit 4: reset D74 Conduct sensor (1) - * bit 3: Enables D17 read transaction (1), address needed - * bit 2: Enables D17 write transaction (1), address and data needs to be set - * bit 1: Enable D17 Init procedure (1) - * bit 0: reset D17 Conduct sensor (1) - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74Control - * @param control Conductivity Sensor control set - * @return none - *************************************************************************/ -void setFPGAD17D74Control( U08 control ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD17D74Control, control ); -} - -/*********************************************************************//** - * @brief - * The setFpgaCD34Control function sets the FPGA Conductivity - * Sensor control register for D27 and D29. - * bit 7: Enables D29 read transaction (1), address needed - * bit 6: Enables D29 write transaction (1), address and data needs to be set - * bit 5: Enable D29 Init procedure (1) - * bit 4: reset D29 Conduct sensor (1) - * bit 3: Enables D27 read transaction (1), address needed - * bit 2: Enables D27 write transaction (1), address and data needs to be set - * bit 1: Enable D27 Init procedure (1) - * bit 0: reset D27 Conduct sensor (1) - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensTD34Control - * @param control Conductivity sensor control set - * @return none - *************************************************************************/ -void setFPGAD27D29Control( U08 control ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD27D29Control, control ); -} - -/*********************************************************************//** - * @brief - * The setFpgaCD5Control function sets the FPGA Conductivity - * Sensor control register for D43. - * bit 4- 7: Reserved. - * bit 3: Enables D43 read transaction (1), address needed - * bit 2: Enables D43 write transaction (1), address and data needs to be set - * bit 1: Enable D43 Init procedure (1) - * bit 0: reset D43 Conduct sensor (1) - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD74Control - * @param control Conductivity sensor control set - * @return none - *************************************************************************/ -void setFPGAD43Control( U08 control ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD43Control, control ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD17D74Address function sets the conductivity sensor - * CD12 address register to perform read and write operations. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74_Addrs - * @param address The conductivity sensor D17 and D74 address - * @return none - *************************************************************************/ -void setFPGAD17D74Address( U16 address ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD17D74_Addrs, address ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD27D29Address function sets the conductivity sensor - * CD34 address register to perform read and write operations. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29_Addrs - * @param address The conductivity sensor CD34 address - * @return none - *************************************************************************/ -void setFPGAD27D29Address( U16 address ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD27D29_Addrs, address ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD43Address function sets the conductivity sensor - * D74 address register to perform read and write operations. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43_Addrs - * @param address The conductivity sensor D43 address - * @return none - *************************************************************************/ -void setFPGAD43Address( U16 address ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD43_Addrs, address ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD17D74Data function sets the conductivity sensor - * CD12 data outputfor write operations. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD17D74_Data_In - * @param data The conductivity sensor D17 and D74 Data - * @return none - *************************************************************************/ -void setFPGAD17D74Data( U32 data ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD17D74_Data_In, data ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD27D29Data function sets the conductivity sensor - * CD34 data outputfor write operations. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD27D29_Data_In - * @param data The conductivity sensor D27 and D29 Data - * @return none - *************************************************************************/ -void setFPGAD27D29Data( U32 data ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD27D29_Data_In, data ); -} - -/*********************************************************************//** - * @brief - * The setFPGAD43Data function sets the conductivity sensor - * D43 data output for write operations. - * @details \b Inputs: none - * @details \b Outputs: fpgaConSensD43_Data_In - * @param data The conductivity sensor D43 Data - * @return none - *************************************************************************/ -void setFPGAD43Data( U32 data ) -{ - SET_FPGA_ACTUATOR_FIELD( fpgaConSensD43_Data_In, data ); -} - -/*********************************************************************//** - * @brief * The setFPGAD5HeaterPWMControl function sets the primary heater * PWM input. * @details \b Inputs: none @@ -2088,7 +1339,7 @@ * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ -void setFPGAD11PumpRevolutionCount( U16 count ) +void setFPGAD11PumpRevolutionCount( U32 count ) { SET_FPGA_ACTUATOR_FIELD( fpgaD11PumpRevCount, count ); } @@ -2102,7 +1353,7 @@ * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ -void setFPGAD10PumpRevolutionCount( U16 count ) +void setFPGAD10PumpRevolutionCount( U32 count ) { SET_FPGA_ACTUATOR_FIELD( fpgaD10PumpRevCount, count ); } @@ -2116,7 +1367,7 @@ * @param count the number of revolution to be rotated for the pump. * @return none *************************************************************************/ -void setFPGAD76PumpRevolutionCount( U16 count ) +void setFPGAD76PumpRevolutionCount( U32 count ) { SET_FPGA_ACTUATOR_FIELD( fpgaD76PumpRevCount, count ); } @@ -2786,7 +2037,7 @@ *************************************************************************/ U08 getFPGAD17CondReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD17CondReadCnt ); + return fpgaSensorReadings.fpgaD17CondReadCnt; } /*********************************************************************//** @@ -2798,31 +2049,43 @@ *************************************************************************/ U08 getFPGAD17CondErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD17CondErrorCnt ); + return fpgaSensorReadings.fpgaD17CondErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAD17Cond function gets D17 conductivity sensor value. - * @details \b Inputs: fpgaCD1 + * The getFPGAD17TempReadCount function gets the D17 (D16) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaD17TempReadCount * @details \b Outputs: none - * @return Latest D17 conductivity sensor value + * @return D17 (D16) Temperature sensor read count *************************************************************************/ -U16 getFPGAD17Cond( void ) +U08 getFPGAD17TempReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD17CondCond ); + return fpgaSensorReadings.fpgaD17TempReadCount; } /*********************************************************************//** * @brief + * The getFPGAD17TempErrorCount function gets the D17 (D16) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaD17TempErrorCount + * @details \b Outputs: none + * @return D17 (D16) Temperature sensor error count + *************************************************************************/ +U08 getFPGAD17TempErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD17TempErrorCount; +} + +/*********************************************************************//** + * @brief * The getFPGAD17CondTemp function gets D17 conductivity sensor temperature value. * @details \b Inputs: fpgaCD1Temp * @details \b Outputs: none * @return Latest D17 conductivity sensor temperature value *************************************************************************/ -U16 getFPGAD17CondTemp( void ) +F32 getFPGAD17CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD17CondTemp ); + return fpgaSensorReadings.fpgaD17TempResistance; } /*********************************************************************//** @@ -2832,21 +2095,44 @@ * @details \b Outputs: none * @return Latest D17 conductivity sensor register data value *************************************************************************/ -U32 getFPGAD17CondData( void ) +F32 getFPGAD17CondData( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD17CondCond ); + return fpgaSensorReadings.fpgaD17CondResistance; } /*********************************************************************//** * @brief + * The getFPGAD17CondData function gets the D17 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaD17DataCal + * @details \b Outputs: none + * @return D17 calibration data + *************************************************************************/ +U32 getFPGAD17CondCalData( void ) +{ + return fpgaSensorReadings.fpgaD17DataCal; +} + +/*********************************************************************//** + * @brief + * The getFPGAD17CalMemCounter function gets the D17 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaD17CalMemCounter + * @details \b Outputs: none + * @return D17 memory count + *************************************************************************/ +U08 getFPGAD17CalMemCounter( void ) +{ + return fpgaSensorReadings.fpgaD17CalMemCounter; +} +/*********************************************************************//** + * @brief * The getFPGAD27CondReadCount function gets D27 conductivity sensor read count. * @details \b Inputs: fpgaD27CondReadCnt * @details \b Outputs: none * @return Latest D27 conductivity sensor read count *************************************************************************/ U08 getFPGAD27CondReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD27CondReadCnt ); + return fpgaSensorReadings.fpgaD27CondReadCnt; } /*********************************************************************//** @@ -2858,19 +2144,43 @@ *************************************************************************/ U08 getFPGAD27CondErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD27CondErrorCnt ); + return fpgaSensorReadings.fpgaD27CondErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAD27Cond function gets D27 conductivity sensor value. - * @details \b Inputs: fpgaD27Cond + * The getFPGAD27TempReadCount function gets the D27 (D28) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaD27TempReadCount * @details \b Outputs: none + * @return D27 (D28) Temperature sensor read count + *************************************************************************/ +U08 getFPGAD27TempReadCount( void ) +{ + return fpgaSensorReadings.fpgaD27TempReadCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAD27TempErrorCount function gets the D27 (D28) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaD27TempErrorCount + * @details \b Outputs: none + * @return D27 (D28) Temperature sensor error count + *************************************************************************/ +U08 getFPGAD27TempErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD27TempErrorCount; +} + +/*********************************************************************//** + * @brief + * The getFPGAD27CondData function gets D27 conductivity sensor value. + * @details \b Inputs: fpgaD27CondResistance + * @details \b Outputs: none * @return Latest D27 conductivity sensor value *************************************************************************/ -U16 getFPGAD27Cond( void ) +F32 getFPGAD27CondData( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD27CondCond ); + return fpgaSensorReadings.fpgaD27CondResistance; } /*********************************************************************//** @@ -2880,33 +2190,45 @@ * @details \b Outputs: none * @return Latest D27 conductivity sensor temperature value *************************************************************************/ -U16 getFPGAD27CondTemp( void ) +F32 getFPGAD27CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD27CondTemp ); + return fpgaSensorReadings.fpgaD27TempResistance; } /*********************************************************************//** * @brief - * The getFPGAD27CondData function gets D27 conductivity sensor register value. - * @details \b Inputs: fpgaD27CondDataOut + * The getFPGAD27CondCalData function gets the D27 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaD27DataCal * @details \b Outputs: none - * @return Latest D27 conductivity sensor register data value + * @return D27 calibration data *************************************************************************/ -U32 getFPGAD27CondData( void ) +U32 getFPGAD27CondCalData( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD27CondCond ); + return fpgaSensorReadings.fpgaD27DataCal; } /*********************************************************************//** * @brief + * The getFPGAD27CalMemCounter function gets the D27 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaD27CalMemCounter + * @details \b Outputs: none + * @return D27 memory count + *************************************************************************/ +U08 getFPGAD27CalMemCounter( void ) +{ + return fpgaSensorReadings.fpgaD27CalMemCounter; +} + +/*********************************************************************//** + * @brief * The getFPGAD29CondReadCount function gets D29 conductivity sensor read count. * @details \b Inputs: fpgaD29CondReadCnt * @details \b Outputs: none * @return Latest D29 conductivity sensor read count *************************************************************************/ U08 getFPGAD29CondReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD29CondReadCnt ); + return fpgaSensorReadings.fpgaD29CondReadCnt; } /*********************************************************************//** @@ -2918,55 +2240,90 @@ *************************************************************************/ U08 getFPGAD29CondErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD29CondErrorCnt ); + return fpgaSensorReadings.fpgaD29CondErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAD29Cond function gets D29 conductivity sensor value. - * @details \b Inputs: fpgaD29Cond + * The getFPGAD29TempReadCount function gets the D29 (D28) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaD29TempReadCount * @details \b Outputs: none - * @return Latest D29 conductivity sensor value + * @return D29 (D28) Temperature sensor read count *************************************************************************/ -U16 getFPGAD29Cond( void ) +U08 getFPGAD29TempReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD29CondCond ); + return fpgaSensorReadings.fpgaD29TempReadCount; } /*********************************************************************//** * @brief + * The getFPGAD29TempErrorCount function gets the D29 (D28) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaD29TempErrorCount + * @details \b Outputs: none + * @return D29 (D28) Temperature sensor error count + *************************************************************************/ +U08 getFPGAD29TempErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD29TempErrorCount; +} +/*********************************************************************//** + * @brief * The getFPGAD29CondTemp function gets D29 conductivity sensor temperature value. - * @details \b Inputs: fpgaD29CondTemp + * @details \b Inputs: fpgaD29TempResistance * @details \b Outputs: none * @return Latest D29 conductivity sensor temperature value *************************************************************************/ -U16 getFPGAD29CondTemp( void ) +F32 getFPGAD29CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD29CondTemp ); + return fpgaSensorReadings.fpgaD29TempResistance; } /*********************************************************************//** * @brief * The getFPGAD29CondData function gets D29 conductivity sensor register value. - * @details \b Inputs: fpgaD29CondDataOut + * @details \b Inputs: fpgaD29CondResistance * @details \b Outputs: none * @return Latest D29 conductivity sensor register data value *************************************************************************/ -U32 getFPGAD29CondData( void ) +F32 getFPGAD29CondData( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD29CondCond ); + return fpgaSensorReadings.fpgaD29CondResistance; } /*********************************************************************//** * @brief + * The getFPGAD29CondCalData function gets the D29 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaD29DataCal + * @details \b Outputs: none + * @return D29 calibration data + *************************************************************************/ +U32 getFPGAD29CondCalData( void ) +{ + return fpgaSensorReadings.fpgaD29DataCal; +} + +/*********************************************************************//** + * @brief + * The getFPGAD29CalMemCounter function gets the D29 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaD29CalMemCounter + * @details \b Outputs: none + * @return D29 memory count + *************************************************************************/ +U08 getFPGAD29CalMemCounter( void ) +{ + return fpgaSensorReadings.fpgaD29CalMemCounter; +} + +/*********************************************************************//** + * @brief * The getFPGAD43CondReadCount function gets D43 conductivity sensor read count. * @details \b Inputs: fpgaD43CondReadCnt * @details \b Outputs: none * @return Latest D43 conductivity sensor read count *************************************************************************/ U08 getFPGAD43CondReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD43CondReadCnt ); + return fpgaSensorReadings.fpgaD43CondReadCnt; } /*********************************************************************//** @@ -2978,31 +2335,43 @@ *************************************************************************/ U08 getFPGAD43CondErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD43CondErrorCnt ); + return fpgaSensorReadings.fpgaD43CondErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAD43Cond function gets D43 conductivity sensor value. - * @details \b Inputs: fpgaD43Cond + * The getFPGAD43TempReadCount function gets the D43 (D44) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaD43TempReadCount * @details \b Outputs: none - * @return Latest D43 conductivity sensor value + * @return D43 (D44) Temperature sensor read count *************************************************************************/ -U16 getFPGAD43Cond( void ) +U08 getFPGAD43TempReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD43CondCond ); + return fpgaSensorReadings.fpgaD43TempReadCount; } /*********************************************************************//** * @brief + * The getFPGAD43TempErrorCount function gets the D43 (D44) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaD43TempErrorCount + * @details \b Outputs: none + * @return D43 (D44) Temperature sensor error count + *************************************************************************/ +U08 getFPGAD43TempErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD43TempErrorCount; +} + +/*********************************************************************//** + * @brief * The getFPGAD43CondTemp function gets D43 conductivity sensor temperature value. * @details \b Inputs: fpgaD43CondTemp * @details \b Outputs: none * @return Latest D43 conductivity sensor temperature value *************************************************************************/ -U16 getFPGAD43CondTemp( void ) +F32 getFPGAD43CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD43CondTemp ); + return fpgaSensorReadings.fpgaD43TempResistance; } /*********************************************************************//** @@ -3012,21 +2381,45 @@ * @details \b Outputs: none * @return Latest D43 conductivity sensor register data value *************************************************************************/ -U32 getFPGAD43CondData( void ) +F32 getFPGAD43CondData( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD43CondCond ); + return fpgaSensorReadings.fpgaD43CondResistance; } /*********************************************************************//** * @brief + * The getFPGAD43CondCalData function gets the D43 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaD43DataCal + * @details \b Outputs: none + * @return D43 calibration data + *************************************************************************/ +U32 getFPGAD43CondCalData( void ) +{ + return fpgaSensorReadings.fpgaD43DataCal; +} + +/*********************************************************************//** + * @brief + * The getFPGAD43CalMemCounter function gets the D43 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaD43CalMemCounter + * @details \b Outputs: none + * @return D43 memory count + *************************************************************************/ +U08 getFPGAD43CalMemCounter( void ) +{ + return fpgaSensorReadings.fpgaD43CalMemCounter; +} + +/*********************************************************************//** + * @brief * The getFPGAD74CondReadCount function gets D74 conductivity sensor read count. * @details \b Inputs: fpgaD74CondReadCnt * @details \b Outputs: none * @return Latest D74 conductivity sensor read count *************************************************************************/ U08 getFPGAD74CondReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD74CondReadCnt ); + return fpgaSensorReadings.fpgaD74CondReadCnt; } /*********************************************************************//** @@ -3038,31 +2431,43 @@ *************************************************************************/ U08 getFPGAD74CondErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD74CondErrorCnt ); + return fpgaSensorReadings.fpgaD74CondErrorCnt; } /*********************************************************************//** * @brief - * The getFPGAD74Cond function gets D74 conductivity sensor value. - * @details \b Inputs: fpgaD74Cond + * The getFPGAD74TempReadCount function gets the D74 (D75) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaD74TempReadCount * @details \b Outputs: none - * @return Latest D74 conductivity sensor value + * @return D74 (D75) Temperature sensor read count *************************************************************************/ -U16 getFPGAD74Cond( void ) +U08 getFPGAD74TempReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD74CondCond ); + return fpgaSensorReadings.fpgaD74TempReadCount; } /*********************************************************************//** * @brief + * The getFPGAD74TempErrorCount function gets the D74 (D75) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaD74TempErrorCount + * @details \b Outputs: none + * @return D74 (D75) Temperature sensor error count + *************************************************************************/ +U08 getFPGAD74TempErrorCount( void ) +{ + return fpgaSensorReadings.fpgaD74TempErrorCount; +} + +/*********************************************************************//** + * @brief * The getFPGAD74CondTemp function gets D74 conductivity sensor temperature value. * @details \b Inputs: fpgaD74CondTemp * @details \b Outputs: none * @return Latest D74 conductivity sensor temperature value *************************************************************************/ -U16 getFPGAD74CondTemp( void ) +F32 getFPGAD74CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD74CondTemp ); + return fpgaSensorReadings.fpgaD74TempResistance; } /*********************************************************************//** @@ -3072,13 +2477,36 @@ * @details \b Outputs: none * @return Latest D74 conductivity sensor register data value *************************************************************************/ -U32 getFPGAD74CondData( void ) +F32 getFPGAD74CondData( void ) { - return GET_FPGA_SENSOR_FIELD( fpgaD74CondCond ); + return fpgaSensorReadings.fpgaD74CondResistance; } +/*********************************************************************//** + * @brief + * The getFPGAD74CondCalData function gets the D74 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaD74DataCal + * @details \b Outputs: none + * @return D74 calibration data + *************************************************************************/ +U32 getFPGAD74CondCalData( void ) +{ + return fpgaSensorReadings.fpgaD74DataCal; +} /*********************************************************************//** * @brief + * The getFPGAD74CalMemCounter function gets the D74 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaD74CalMemCounter + * @details \b Outputs: none + * @return D74 memory count + *************************************************************************/ +U08 getFPGAD74CalMemCounter( void ) +{ + return fpgaSensorReadings.fpgaD74CalMemCounter; +} + +/*********************************************************************//** + * @brief * The getFPGAD63LevelSensor function gets the latest FPGA D63 upper level * sensor reading. * @details \b Inputs: fpgaD63LevelSensor @@ -3519,7 +2947,7 @@ * @details \b Outputs: none * @return the current revolution of the acid concentrate pump *************************************************************************/ -U16 getFPGAD11PumpRevolutionCountStatus( void ) +U32 getFPGAD11PumpRevolutionCountStatus( void ) { return GET_FPGA_SENSOR_FIELD( fpgaD11PumpStepCountStatus ); } @@ -3532,7 +2960,7 @@ * @details \b Outputs: none * @return the current revolution of the bicarb concentrate pump *************************************************************************/ -U16 getFPGAD10PumpRevolutionCountStatus( void ) +U32 getFPGAD10PumpRevolutionCountStatus( void ) { return GET_FPGA_SENSOR_FIELD( fpgaD10PumpStepCountStatus ); } @@ -3545,7 +2973,7 @@ * @details \b Outputs: none * @return the current revolution of the UF pump *************************************************************************/ -U16 getFPGAD76PumpRevolutionCountStatus( void ) +U32 getFPGAD76PumpRevolutionCountStatus( void ) { return GET_FPGA_SENSOR_FIELD( fpgaD76PumpStepCountStatus ); } @@ -4260,479 +3688,248 @@ /*********************************************************************//** * @brief - * The setFPGAP9Control function sets the FPGA P9 sensor control register - * to perform a given action. - * bit 4..7: unused - * bit 3: Enable P9 read transaction; address needed - * bit 2: Enable P9 write transaction; address and data needs to be set - * bit 1: Enable P9 initialization procedure - * bit 0: reset P9 sensor + * The setFPGAP40PumpEnable function enables or disables the P40 pump. * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @param control bits indicating control action to take + * @details \b Outputs: p40PumpControl + * @param enable flag indicating whether to enable or disable the P40 pump. * @return none *************************************************************************/ -void setFPGAP9Control( U08 control ) +void setFPGAP40PumpEnable( BOOL enable ) { - SET_FPGA_ACTUATOR_FIELD( conductivityP9Control, control ); + SET_FPGA_ACTUATOR_FIELD( p40PumpControl, ( TRUE == enable ? 0x1 : 0x0 ) ); } /*********************************************************************//** * @brief - * The setFPGAP9Address function sets the read/write address for a read/write - * action on the P9 sensor. + * The setFPGAP40PumpPWM function sets the P40 pump PWM duty cycle. + * The higher the PWM duty cycle (0..500), the faster the pump will go. + * @note PWM values < 5% or > 95% will cause pump to stop so effective + * range is actually 25..475. * @details \b Inputs: none - * @details \b Outputs: conductivityP9Address - * @param address The P9 sensor address to read from or write to + * @details \b Outputs: p40PumpPWMDutyCyclePct + * @param pwm PWM duty cycle magnitude * @return none *************************************************************************/ -void setFPGAP9Address( U16 address ) +void setFPGAP40PumpPWM( U16 pwm ) { - SET_FPGA_ACTUATOR_FIELD( conductivityP9Address, address ); + SET_FPGA_ACTUATOR_FIELD( p40PumpPWMDutyCyclePct, pwm ); } /*********************************************************************//** * @brief - * The setFPGAP9Data function sets the write data for a write action on - * the P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Data - * @param data The 32-bit data to write to the P9 sensor - * @return none + * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM + * duty cycle. + * @details \b Inputs: p40PumpPWMReadback + * @details \b Outputs: none + * @return measured speed (RPM) of the P40 pump *************************************************************************/ -void setFPGAP9Data( U32 data ) +U16 getFPGAP40PumpPWM( void ) { - SET_FPGA_ACTUATOR_FIELD( conductivityP9Data, data ); + return GET_FPGA_SENSOR_FIELD( p40PumpPWMReadback ); } /*********************************************************************//** * @brief - * The setFPGAP18Control function sets the FPGA P18 sensor control register - * to perform a given action. - * bit 4..7: unused - * bit 3: Enable P18 read transaction; address needed - * bit 2: Enable P18 write transaction; address and data needs to be set - * bit 1: Enable P18 initialization procedure - * bit 0: reset P18 sensor - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @param control bits indicating control action to take - * @return none + * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count + * from the P40 pump hall sensor. + * @details \b Inputs: p40PumpTachCount + * @details \b Outputs: none + * @return P40 pump tachometer count *************************************************************************/ -void setFPGAP18Control( U08 control ) +U16 getFPGAP40PumpTachCount( void ) { - SET_FPGA_ACTUATOR_FIELD( conductivityP18Control, control ); + return GET_FPGA_SENSOR_FIELD( p40PumpTachCount ); } /*********************************************************************//** * @brief - * The setFPGAP18Address function sets the read/write address for a read/write - * action on the P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Address - * @param address The P18 sensor address to read from or write to - * @return none + * The getFPGAP9CondReadCount function gets the P9 conductivity read count. + * @details \b Inputs: fpgaSensorReadings.fpgaP9CondReadCount + * @details \b Outputs: none + * @return P9 Conductivity sensor read count *************************************************************************/ -void setFPGAP18Address( U16 address ) +U08 getFPGAP9CondReadCount( void ) { - SET_FPGA_ACTUATOR_FIELD( conductivityP18Address, address ); + return fpgaSensorReadings.fpgaP9CondReadCount; } /*********************************************************************//** * @brief - * The setFPGAP18Data function sets the write data for a write action on - * the P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Data - * @param data The 32-bit data to write to the P18 sensor - * @return none + * The getFPGAP9CondErrorCount function gets the P9 conductivity error count. + * @details \b Inputs: fpgaSensorReadings.fpgaP9CondErrorCount + * @details \b Outputs: none + * @return P9 Conductivity sensor error count *************************************************************************/ -void setFPGAP18Data( U32 data ) +U08 getFPGAP9CondErrorCount( void ) { - SET_FPGA_ACTUATOR_FIELD( conductivityP18Data, data ); + return fpgaSensorReadings.fpgaP9CondErrorCount; } /*********************************************************************//** * @brief - * The setFPGAP9Reset function sets the reset command bit for P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none + * The getFPGAP9TempReadCount function gets the P9 (P10) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaP9TempReadCount + * @details \b Outputs: none + * @return P9 (P10) Temperature sensor read count *************************************************************************/ -void setFPGAP9Reset( void ) +U08 getFPGAP9TempReadCount( void ) { - SET_FPGA_ACTUATOR_BITS( conductivityP9Control, FPGA_CONDUCTIVITY_RESET_BIT ); + return fpgaSensorReadings.fpgaP9TempReadCount; } /*********************************************************************//** * @brief - * The clearFPGAP9Reset function clears the reset command bit for P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none + * The getFPGAP9TempErrorCount function gets the P9 (P10) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaP9TempErrorCount + * @details \b Outputs: none + * @return P9 (P10) Temperature sensor error count *************************************************************************/ -void clearFPGAP9Reset( void ) +U08 getFPGAP9TempErrorCount( void ) { - CLEAR_FPGA_ACTUATOR_BITS( conductivityP9Control, ~FPGA_CONDUCTIVITY_RESET_BIT ); + return fpgaSensorReadings.fpgaP9TempErrorCount; } /*********************************************************************//** * @brief - * The setFPGAP9InitEnable function sets the initialize command bit for - * P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none - *************************************************************************/ -void setFPGAP9InitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP9Control, FPGA_CONDUCTIVITY_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP9InitEnable function clears the initialize command bit for - * P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none - *************************************************************************/ -void clearFPGAP9InitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP9Control, ~FPGA_CONDUCTIVITY_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP9WriteEnable function sets the write enable command bit for - * P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none - *************************************************************************/ -void setFPGAP9WriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP9Control, FPGA_CONDUCTIVITY_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP9WriteEnable function clears the write enable command bit - * for P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none - *************************************************************************/ -void clearFPGAP9WriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP9Control, ~FPGA_CONDUCTIVITY_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP9ReadEnable function sets the read enable command bit for - * P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none - *************************************************************************/ -void setFPGAP9ReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP9Control, FPGA_CONDUCTIVITY_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP9ReadEnable function clears the read enable command bit - * for P9 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP9Control - * @return none - *************************************************************************/ -void clearFPGAP9ReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP9Control, ~FPGA_CONDUCTIVITY_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP18Reset function sets the reset command bit for P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void setFPGAP18Reset( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP18Control, FPGA_CONDUCTIVITY_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP18Reset function clears the reset command bit for P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void clearFPGAP18Reset( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP18Control, ~FPGA_CONDUCTIVITY_RESET_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP18InitEnable function sets the initialize command bit for - * P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void setFPGAP18InitEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP18Control, FPGA_CONDUCTIVITY_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP18InitEnable function clears the initialize command bit for - * P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void clearFPGAP18InitEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP18Control, ~FPGA_CONDUCTIVITY_INIT_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP18WriteEnable function sets the write enable command bit for - * P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void setFPGAP18WriteEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP18Control, FPGA_CONDUCTIVITY_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP18WriteEnable function clears the write enable command bit - * for P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void clearFPGAP18WriteEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP18Control, ~FPGA_CONDUCTIVITY_WR_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP18ReadEnable function sets the read enable command bit for - * P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void setFPGAP18ReadEnable( void ) -{ - SET_FPGA_ACTUATOR_BITS( conductivityP18Control, FPGA_CONDUCTIVITY_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The clearFPGAP18ReadEnable function clears the read enable command bit - * for P18 sensor. - * @details \b Inputs: none - * @details \b Outputs: conductivityP18Control - * @return none - *************************************************************************/ -void clearFPGAP18ReadEnable( void ) -{ - CLEAR_FPGA_ACTUATOR_BITS( conductivityP18Control, ~FPGA_CONDUCTIVITY_RD_ENABLE_BIT ); -} - -/*********************************************************************//** - * @brief - * The getFPGAP9ReadCount function gets the latest P9 sensor read count. - * @details \b Inputs: conductivityP9ReadCount + * The getFPGAP9CondData function gets the P9 conductivity data. + * @details \b Inputs: fpgaSensorReadings.fpgaP9CondResistance * @details \b Outputs: none - * @return Current read count for P9 sensor. + * @return P9 Conductivity data *************************************************************************/ -U08 getFPGAP9ReadCount( void ) +F32 getFPGAP9CondData( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP9ReadCount ); + return fpgaSensorReadings.fpgaP9CondResistance; } /*********************************************************************//** * @brief - * The getFPGAP9ErrorCount function gets the latest P9 sensor error count. - * @details \b Inputs: conductivityP9ErrorCount + * The getFPGAP9CondTemp function gets the P9 (P10) temperature data. + * @details \b Inputs: fpgaSensorReadings.fpgaP9TempResistance * @details \b Outputs: none - * @return Current error count for P9 sensor. + * @return P9 (P10) Temperature data *************************************************************************/ -U08 getFPGAP9ErrorCount( void ) +F32 getFPGAP9CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP9ErrorCount ); + return fpgaSensorReadings.fpgaP9TempResistance; } /*********************************************************************//** * @brief - * The getFPGAP9Conductivity function gets the latest P9 sensor conductivity - * reading. - * @details \b Inputs: conductivityP9Cond + * The getFPGAP9CondCalData function gets the P9 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaP9CalData * @details \b Outputs: none - * @return Current conductivity reading from P9 sensor. + * @return P9 calibration data *************************************************************************/ -U16 getFPGAP9Conductivity( void ) +U32 getFPGAP9CondCalData( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP9Cond ); + return fpgaSensorReadings.fpgaP9CalData; } /*********************************************************************//** * @brief - * The getFPGAP9Temperature function gets the latest P9 sensor temperature. - * @details \b Inputs: conductivityP9Temp + * The getFPGAP9CalMemCounter function gets the P9 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaP9CalMemCounter * @details \b Outputs: none - * @return Current temperature from P9 sensor. + * @return P9 memory count *************************************************************************/ -U16 getFPGAP9Temperature( void ) +U08 getFPGAP9CalMemCounter( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP9Temp ); + return fpgaSensorReadings.fpgaP9CalMemCounter; } /*********************************************************************//** * @brief - * The getFPGAP9Data function gets the latest P9 sensor data from a read - * action. - * @details \b Inputs: conductivityP9Data + * The getFPGAP18CondReadCount function gets the P18 conductivity read count. + * @details \b Inputs: fpgaSensorReadings.fpgaP18CondReadCount * @details \b Outputs: none - * @return Latest data read from P9 sensor. + * @return P18 Conductivity sensor read count *************************************************************************/ -U32 getFPGAP9Data( void ) +U08 getFPGAP18CondReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP9Data ); + return fpgaSensorReadings.fpgaP18CondReadCount; } /*********************************************************************//** * @brief - * The getFPGAP18ReadCount function gets the latest P18 sensor read count. - * @details \b Inputs: conductivityP18ReadCount + * The getFPGAP18CondErrorCount function gets the P18 conductivity error count. + * @details \b Inputs: fpgaSensorReadings.fpgaP18CondErrorCount * @details \b Outputs: none - * @return Current read count for P18 sensor. + * @return P18 Conductivity sensor error count *************************************************************************/ -U08 getFPGAP18ReadCount( void ) +U08 getFPGAP18CondErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP18ReadCount ); + return fpgaSensorReadings.fpgaP18CondErrorCount; } /*********************************************************************//** * @brief - * The getFPGAP18ErrorCount function gets the latest P18 sensor error count. - * @details \b Inputs: conductivityP18ErrorCount + * The getFPGAP18TempReadCount function gets the P18 (P19) temperature read count. + * @details \b Inputs: fpgaSensorReadings.fpgaP18TempReadCount * @details \b Outputs: none - * @return Current error count for P18 sensor. + * @return P18 (P19) Temperature sensor read count *************************************************************************/ -U08 getFPGAP18ErrorCount( void ) +U08 getFPGAP18TempReadCount( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP18ErrorCount ); + return fpgaSensorReadings.fpgaP18TempReadCount; } /*********************************************************************//** * @brief - * The getFPGAP18Conductivity function gets the latest P18 sensor conductivity - * reading. - * @details \b Inputs: conductivityP18Cond + * The getFPGAP18TempErrorCount function gets the P18 (P19) temperature error count. + * @details \b Inputs: fpgaSensorReadings.fpgaP18TempErrorCount * @details \b Outputs: none - * @return Current conductivity reading from P18 sensor. + * @return P18 (P19) Temperature sensor error count *************************************************************************/ -U16 getFPGAP18Conductivity( void ) +U08 getFPGAP18TempErrorCount( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP18Cond ); + return fpgaSensorReadings.fpgaP18TempErrorCount; } /*********************************************************************//** * @brief - * The getFPGAP18Temperature function gets the latest P18 sensor temperature. - * @details \b Inputs: conductivityP18Temp + * The getFPGAP18CondData function gets the P18 conductivity data. + * @details \b Inputs: fpgaSensorReadings.fpgaP18CondResistance * @details \b Outputs: none - * @return Current temperature from P18 sensor. + * @return P18 Conductivity data *************************************************************************/ -U16 getFPGAP18Temperature( void ) +F32 getFPGAP18CondData( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP18Temp ); + return fpgaSensorReadings.fpgaP18CondResistance; } /*********************************************************************//** * @brief - * The getFPGAP18Data function gets the latest P18 sensor data from a read - * action. - * @details \b Inputs: conductivityP18Data + * The getFPGAP18CondTemp function gets the P18 (P19) temperature data. + * @details \b Inputs: fpgaSensorReadings.fpgaP18TempReistance * @details \b Outputs: none - * @return Latest data read from P18 sensor. + * @return P18 (P19) Temperature data *************************************************************************/ -U32 getFPGAP18Data( void ) +F32 getFPGAP18CondTemp( void ) { - return GET_FPGA_SENSOR_FIELD( conductivityP18Data ); + return fpgaSensorReadings.fpgaP18TempReistance; } /*********************************************************************//** * @brief - * The setFPGAP40PumpEnable function enables or disables the P40 pump. - * @details \b Inputs: none - * @details \b Outputs: p40PumpControl - * @param enable flag indicating whether to enable or disable the P40 pump. - * @return none - *************************************************************************/ -void setFPGAP40PumpEnable( BOOL enable ) -{ - SET_FPGA_ACTUATOR_FIELD( p40PumpControl, ( TRUE == enable ? 0x1 : 0x0 ) ); -} - -/*********************************************************************//** - * @brief - * The setFPGAP40PumpPWM function sets the P40 pump PWM duty cycle. - * The higher the PWM duty cycle (0..500), the faster the pump will go. - * @note PWM values < 5% or > 95% will cause pump to stop so effective - * range is actually 25..475. - * @details \b Inputs: none - * @details \b Outputs: p40PumpPWMDutyCyclePct - * @param pwm PWM duty cycle magnitude - * @return none - *************************************************************************/ -void setFPGAP40PumpPWM( U16 pwm ) -{ - SET_FPGA_ACTUATOR_FIELD( p40PumpPWMDutyCyclePct, pwm ); -} - -/*********************************************************************//** - * @brief - * The getFPGAP12PumpPWM function gets a read back from FPGA of RO pump PWM - * duty cycle. - * @details \b Inputs: p40PumpPWMReadback + * The getFPGAP18CondCalData function gets the P18 cal data. + * @details \b Inputs: fpgaSensorReadings.fpgaP18CalData * @details \b Outputs: none - * @return measured speed (RPM) of the P40 pump + * @return P18 calibration data *************************************************************************/ -U16 getFPGAP40PumpPWM( void ) +U32 getFPGAP18CondCalData( void ) { - return GET_FPGA_SENSOR_FIELD( p40PumpPWMReadback ); + return fpgaSensorReadings.fpgaP18CalData; } /*********************************************************************//** * @brief - * The getFPGAP12PumpTachCount function gets the running 16-bit tachometer count - * from the P40 pump hall sensor. - * @details \b Inputs: p40PumpTachCount + * The getFPGAP18CalMemCounter function gets the P18 memory count. + * @details \b Inputs: fpgaSensorReadings.fpgaP18CalMemCounter * @details \b Outputs: none - * @return P40 pump tachometer count + * @return P18 memory count *************************************************************************/ -U16 getFPGAP40PumpTachCount( void ) +U08 getFPGAP18CalMemCounter( void ) { - return GET_FPGA_SENSOR_FIELD( p40PumpTachCount ); + return fpgaSensorReadings.fpgaP18CalMemCounter; } - /**@}*/ Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r290cac3c0557c978647cef2972800dfe137dd662 -rae31b4c999dccae70fb40fb9d98a4380ce2c7415 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 290cac3c0557c978647cef2972800dfe137dd662) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision ae31b4c999dccae70fb40fb9d98a4380ce2c7415) @@ -129,28 +129,21 @@ { MSG_ID_DD_PRESSURE_SENSOR_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testDDPressureSensorDataPublishIntervalOverride }, { MSG_ID_DD_PRESSURE_SENSOR_FILTER_READINGS_OVERRIDE_REQUEST, &testDDPressureSensorFilteredReadingsOverride }, { MSG_ID_DD_PRESSURE_SENSOR_FILTER_TEMPERATURE_OVERRIDE_REQUEST, &testDDPressureSensorFilteredTemperatureReadingsOverride }, -#ifdef __TEENSY_CONDUCTIVITY_DRIVER__ + { MSG_ID_DD_CONDUCTIVITY_SENSOR_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testDDConductivitySensorDataPublishIntervalOverride }, { MSG_ID_FP_CONDUCTIVITY_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testFPConductivitySensorDataPublishIntervalOverride }, + { MSG_ID_DD_CONDUCTIVITY_SENSOR_READINGS_OVERRIDE_REQUEST, &testConductivitySensorReadingsOverride }, + { MSG_ID_DD_CONDUCTIVITY_SENSOR_TEMPERATURE_OVERRIDE_REQUEST, &testConductivitySensorTemperatureOverride }, + { MSG_ID_FP_CONDUCTIVITY_SENSOR_READINGS_OVERRIDE_REQUEST, &testConductivitySensorReadingsOverride }, + { MSG_ID_FP_CONDUCTIVITY_SENSOR_TEMPERATURE_OVERRIDE_REQUEST, &testConductivitySensorTemperatureOverride }, { MSG_ID_DD_SET_CONDUCTIVITY_MODEL_REQUEST, &testSetTeenyConductivityModel }, - { MSG_ID_DD_CONDUCTIVITY_SENSOR_READINGS_OVERRIDE_REQUEST, &testTeensyConductivitySensorReadingsOverride }, - { MSG_ID_DD_CONDUCTIVITY_SENSOR_TEMPERATURE_OVERRIDE_REQUEST, &testTeensyConductivitySensorTemperatureReadingsOverride }, { MSG_ID_DD_CONDUCTIVITY_SENSOR_RESISTANCE_OVERRIDE_REQUEST, &testTeensyConductivitySensorResistanceReadingsOverride }, - { MSG_ID_FP_CONDUCTIVITY_OVERRIDE_REQUEST, &testTeensyConductivitySensorReadingsOverride }, - { MSG_ID_FP_CONDUCTIVITY_TEMP_OVERRIDE_REQUEST, &testTeensyConductivitySensorTemperatureReadingsOverride }, { MSG_ID_FP_CONDUCTIVITY_SENSOR_RESISTANCE_OVERRIDE_REQUEST, &testTeensyConductivitySensorResistanceReadingsOverride }, -#else - { MSG_ID_DD_CONDUCTIVITY_SENSOR_READINGS_OVERRIDE_REQUEST, &testDDConductivitySensorReadingsOverride }, - { MSG_ID_DD_CONDUCTIVITY_SENSOR_TEMPERATURE_OVERRIDE_REQUEST, &testDDConductivitySensorTemperatureReadingsOverride }, - { MSG_ID_DD_CONDUCTIVITY_SENSOR_READ_COUNTER_OVERRIDE_REQUEST, &testDDConductivitySensorReadCounterOverride }, - { MSG_ID_DD_CONDUCTIVITY_SENSOR_ERROR_COUNTER_OVERRIDE_REQUEST, &testDDConductivitySensorErrorCounterOverride }, - { MSG_ID_DD_CONDUCTIVITY_SENSOR_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testDDConductivitySensorDataPublishIntervalOverride }, - { MSG_ID_FP_CONDUCTIVITY_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testFPConductivitySensorDataPublishIntervalOverride }, - { MSG_ID_FP_CONDUCTIVITY_OVERRIDE_REQUEST, &testFPConductivitySensorReadingsOverride }, - { MSG_ID_FP_CONDUCTIVITY_TEMP_OVERRIDE_REQUEST, &testFPConductivitySensorTemperatureReadingsOverride }, - { MSG_ID_FP_CONDUCTIVITY_READ_COUNT_OVERRIDE_REQUEST, &testFPConductivitySensorReadCounterOverride }, - { MSG_ID_FP_CONDUCTIVITY_ERROR_COUNT_OVERRIDE_REQUEST, &testFPConductivitySensorErrorCounterOverride }, -#endif + { MSG_ID_DD_CONDUCTIVITY_SENSOR_CONDUCTIVITY_READ_COUNTER_OVERRIDE_REQUEST, &testConductivitySensorConductivityReadCounterOverride }, + { MSG_ID_DD_CONDUCTIVITY_SENSOR_CONDUCTIVITY_ERROR_COUNTER_OVERRIDE_REQUEST, &testConductivitySensorConductivityErrorCounterOverride }, + { MSG_ID_FP_CONDUCTIVITY_SENSOR_CONDUCTIVITY_READ_COUNT_OVERRIDE_REQUEST, &testConductivitySensorConductivityReadCounterOverride }, + { MSG_ID_FP_CONDUCTIVITY_SENSOR_CONDUCTIVITY_ERROR_COUNT_OVERRIDE_REQUEST, &testConductivitySensorConductivityErrorCounterOverride }, + { MSG_ID_DD_CONCENTRATE_PUMP_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testConcentratePumpDataPublishIntervalOverride }, { MSG_ID_DD_CONCENTRATE_PUMP_TARGET_SPEED_OVERRIDE_REQUEST, &testConcentratePumpTargetSpeedOverride }, { MSG_ID_DD_CONCENTRATE_PUMP_MEASURED_SPEED_OVERRIDE_REQUEST, &testConcentratePumpMeasuredSpeedOverride }, @@ -260,6 +253,12 @@ { MSG_ID_DD_RINSE_PUMP_PWM_PERCENT_OVERRIDE_REQUEST, &testRinsePumpPWMPercentOverride }, { MSG_ID_DD_RINSE_PUMP_TURN_ON_OFF_REQUEST, &testRinsePumpTurnOnOffRequest }, { MSG_ID_FP_SET_START_STOP_OVERRIDE_REQUEST, &testSetGeneratePermeateSignal }, + { MSG_ID_DD_DRY_BICART_DATA_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testDryBiCartDataPublishIntervalOverride }, + { MSG_ID_DD_DRY_BICART_FILL_CYCLE_MAX_OVERRIDE_REQUEST, &testDryBiCartFillCycleMaxCountOverride }, + { MSG_ID_DD_DRY_BICART_FILL_REQUEST_OVERRIDE_REQUEST, &testDryBiCartFillRequestOverride }, + { MSG_ID_DD_BICARB_CHAMBER_FILL_REQUEST_OVERRIDE_REQUEST, &testBiCarbChamberFillRequestOverride }, + { MSG_ID_DD_BICART_DRAIN_REQUEST_OVERRIDE_REQUEST, &testDryBiCartDrainRequestOverride }, + { MSG_ID_DD_BICART_CARTRIDGE_SELECT_OVERRIDE_REQUEST, &testDryBiCartTypeOverride }, { MSG_ID_FP_RO_REJECTION_RATIO_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testRORejectionRatioDataPublishIntervalOverride }, { MSG_ID_FP_RO_FILTERED_REJECTION_RATIO_OVERRIDE_REQUEST, &testRORejectionRatioFilteredOverride }, { MSG_ID_FP_SET_TEST_CONFIGURATION, &testSetTestConfiguration }, @@ -278,12 +277,7 @@ { MSG_ID_FP_DEF_PRE_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testPreGenPermeateDefDataPublishIntervalOverride}, { MSG_ID_FP_DEF_GEN_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testGenPermeateDefDataPublishIntervalOverride}, { MSG_ID_FP_DEF_STATUS_REQUEST, &testGetFPDefeaturedStatus }, - { MSG_ID_DD_DRY_BICART_DATA_PUBLISH_INTERVAL_OVERRIDE_REQUEST, &testDryBiCartDataPublishIntervalOverride }, - { MSG_ID_DD_DRY_BICART_FILL_CYCLE_MAX_OVERRIDE_REQUEST, &testDryBiCartFillCycleMaxCountOverride }, - { MSG_ID_DD_DRY_BICART_FILL_REQUEST_OVERRIDE_REQUEST, &testDryBiCartFillRequestOverride }, { MSG_ID_FP_RO_FILTERED_REJECTION_RATIO_OVERRIDE_REQUEST, &testRORejectionRatioFilteredOverride }, - { MSG_ID_DD_BICART_DRAIN_REQUEST_OVERRIDE_REQUEST, &testDryBiCartDrainRequestOverride }, - { MSG_ID_DD_BICART_CARTRIDGE_SELECT_OVERRIDE_REQUEST, &testDryBiCartTypeOverride }, }; /// Calculation for number of entries in the incoming message function handler look-up table. @@ -576,7 +570,7 @@ * @param alarm ID of alarm triggered * @param almData1 1st data associated with alarm * @param almData2 2nd data associated with alarm - * @return TRUE if msg successfully queued for transmit, FALSE if not + * @return TRUE if msg successfully queued for transmit, FALSE if not. *************************************************************************/ BOOL broadcastAlarmTriggered( U32 alarm, ALARM_DATA_T almData1, ALARM_DATA_T almData2, ALARM_SOURCE_T almSource ) {