Index: firmware/App/Controllers/RinsePump.c =================================================================== diff -u -rcfa8ae21594d3471c37079eb708761fe9a047776 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Controllers/RinsePump.c (.../RinsePump.c) (revision cfa8ae21594d3471c37079eb708761fe9a047776) +++ firmware/App/Controllers/RinsePump.c (.../RinsePump.c) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -15,10 +15,10 @@ * ***************************************************************************/ +#include "AlarmMgmtDD.h" #include "FpgaDD.h" #include "Messaging.h" #include "OperationModes.h" -#include "PersistentAlarm.h" #include "RinsePump.h" #include "TaskGeneral.h" #include "Timers.h" @@ -43,11 +43,17 @@ #define RINSE_PUMP_TURN_OFF_CONTROL_BIT 0xFE ///< Rinse pump turn off control bit. #define RINSE_PUMP_TURN_ON_CONTROL_BIT 0xFF ///< Rinse pump turn on control bit. +#define RINSE_PUMP_PULSE_WIDTH_INVALID_MIN 0U ///< Invalid pulse width minimum (no rotation). +#define RINSE_PUMP_PULSE_WIDTH_INVALID_MAX 0xFFFFU ///< Invalid pulse width maximum (sensor fault). +#define RINSE_PUMP_SPD_OUT_OF_RANGE_TOL_PCT 0.10F ///< Rinse pump commanded vs measured speed tolerance (10%). +#define RINSE_PUMP_MAX_RPM_ESTIMATE 3000U ///< Estimated max rinse pump RPM (for PWM-to-target conversion). + // ********** private data ********** static RINSE_PUMP_STATE_T currentRinsePumpState; ///< Current rinse pump control state. static U32 rinsePumpDataPublicationTimerCounter; ///< Rinse pump data broadcast timer counter. -static U32 rinsePumpMeasuredSpeed; ///< Rinse pump measured speed +static U32 rinsePumpMeasuredSpeed; ///< Rinse pump measured speed (RPM) +static U32 rinsePumpTargetSpeedRPM; ///< Rinse pump commanded target speed (RPM) for monitor static OVERRIDE_F32_T rinsePumpPwmPercentage; ///< Rinse pump PWM percentage. static OVERRIDE_U32_T rinsePumpDataPublishInterval; ///< Rinse pump data broadcast interval (in ms). @@ -79,7 +85,8 @@ rinsePumpPwmPercentage.ovData = RINSE_PUMP_DEFAULT_PWM_PERCENT; rinsePumpPwmPercentage.ovInitData = RINSE_PUMP_DEFAULT_PWM_PERCENT; rinsePumpPwmPercentage.override = OVERRIDE_RESET; - rinsePumpMeasuredSpeed = 0; + rinsePumpMeasuredSpeed = 0U; + rinsePumpTargetSpeedRPM = 0U; } /*********************************************************************//** @@ -117,6 +124,32 @@ /*********************************************************************//** * @brief + * The getRinsePumpMeasuredSpeed function returns the rinse pump measured + * speed from FPGA feedback. + * @details \b Inputs: rinsePumpMeasuredSpeed + * @details \b Outputs: none + * @return Measured rinse pump speed in RPM + *************************************************************************/ +U32 getRinsePumpMeasuredSpeed( void ) +{ + return rinsePumpMeasuredSpeed; +} + +/*********************************************************************//** + * @brief + * The getRinsePumpTargetSpeedRPM function returns the rinse pump commanded + * target speed for monitor tolerance checking. + * @details \b Inputs: rinsePumpTargetSpeedRPM + * @details \b Outputs: none + * @return Target rinse pump speed in RPM + *************************************************************************/ +U32 getRinsePumpTargetSpeedRPM( void ) +{ + return rinsePumpTargetSpeedRPM; +} + +/*********************************************************************//** + * @brief * The calculateRinsePumpSpeed function calculate rinse pump speed based * on FPGA report pulse width value. * @details \b Inputs: fpgaD79PumpSpeed @@ -129,7 +162,7 @@ U16 pumpPulseWidth = getFPGAD79RinsePumpPulseWidth(); U32 pumpSpeedPerSec = 0U; - if ( ( 0U != pumpPulseWidth ) && ( 0xFFFFU != pumpPulseWidth ) ) + if ( ( RINSE_PUMP_PULSE_WIDTH_INVALID_MIN != pumpPulseWidth ) && ( RINSE_PUMP_PULSE_WIDTH_INVALID_MAX != pumpPulseWidth ) ) { pumpSpeedPerSec = US_PER_SECOND / ( pumpPulseWidth * RINSE_PUMP_PWM_PULSE_RESOLUTION_US ); @@ -144,6 +177,43 @@ /*********************************************************************//** * @brief + * The execRinsePumpMonitor function executes the rinse pump monitor. + * @details \b Inputs: none + * @details \b Outputs: publish rinse pump data + * @details \b Alarm: ALARM_ID_DD_D79_RINSE_PUMP_SPEED_OUT_OF_RANGE when + * commanded vs measured speed deviates beyond tolerance. Data1=measured RPM, Data2=target RPM. + * @return none + *************************************************************************/ +void execRinsePumpMonitor( void ) +{ + U08 fpgaConcPumpsFault = getFPGAConcentratePumpsFault(); + BOOL isConcPumpFault = ( fpgaConcPumpsFault > 0 ? TRUE : FALSE ); + + + // Check if a new calibration is available +// if ( TRUE == isNewCalibrationRecordAvailable() ) +// { +// // Get the calibration values of acid and bicarb +// getNVRecord2Driver( GET_CAL_ACID_CONCENTREATES, (U08*)&acidConcentrateCalRecord, sizeof( acidConcentrateCalRecord ), +// NUMBER_OF_ACID_AND_BICARB_NV_DATA_TO_CHECK, ALARM_ID_DD_ACID_CONCENTRATE_INVALID_CAL_RECORD ); +// getNVRecord2Driver( GET_CAL_BICARB_CONCENTRATES, (U08*)&bicarbConcentrateCalRecord, sizeof( bicarbConcentrateCalRecord ), +// NUMBER_OF_ACID_AND_BICARB_NV_DATA_TO_CHECK, ALARM_ID_DD_BICARB_CONCENTRATE_INVALID_CAL_RECORD ); +// } + + // Calculate rinse pump speed + calculateRinsePumpSpeed(); + + + // Monitor pump speed (commanded vs measured tolerance, triggers ALARM_ID_DD_D79_RINSE_PUMP_SPEED_OUT_OF_RANGE) + monitorRinsePumpSpeed(); + + //Publish rinse pump data // TODO should be done in monitor or controller? +// publishRinsePumpData(); +} + + +/*********************************************************************//** + * @brief * The execRinsePumpController function executes the rinse pump state machine. * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT if the current state is invalid. * @details \b Inputs: currentRinsePumpState @@ -152,7 +222,6 @@ *************************************************************************/ void execRinsePumpController( void ) { - calculateRinsePumpSpeed(); switch( currentRinsePumpState ) { @@ -178,6 +247,44 @@ /*********************************************************************//** * @brief + * The monitorRinsePumpSpeed function monitors the rinse pump speed and + * triggers the alarms if they are out of range. + * @details \b Inputs: none + * @details \b Outputs: none + * @return none + *************************************************************************/ +static void monitorRinsePumpSpeed( void ) +{ + F32 rpTargetSpeed = (F32)rinsePumpTargetSpeedRPM; + F32 rpMeasSpeed = (F32)rinsePumpMeasuredSpeed; + F32 rpError = 0.0F; + BOOL isRpSpeedOut = FALSE; + F32 tolerance = RINSE_PUMP_SPD_OUT_OF_RANGE_TOL_PCT; + + if ( RINSE_PUMP_STATE_ON == currentRinsePumpState ) + { + rpError = fabs( rpMeasSpeed - rpTargetSpeed ); + + if ( rpTargetSpeed > 0.0F ) + { + rpError = rpError / rpTargetSpeed; + } + + isRpSpeedOut = ( rpError > tolerance ? TRUE : FALSE ); + } + + if ( TRUE == isRpSpeedOut ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_D79_RINSE_PUMP_SPEED_OUT_OF_RANGE, rinsePumpMeasuredSpeed, rinsePumpTargetSpeedRPM ); + } + else + { + clearAlarmConditionDD( ALARM_ID_DD_D79_RINSE_PUMP_SPEED_OUT_OF_RANGE ); + } +} + +/*********************************************************************//** + * @brief * The handleRinsePumpStartState function starts the rinse pump state machine. * @details \b Inputs: none * @details \b Outputs: none @@ -201,6 +308,8 @@ { RINSE_PUMP_STATE_T state = RINSE_PUMP_STATE_OFF; + rinsePumpTargetSpeedRPM = 0U; + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) ) { // Set PWM count zero to stop the logical rinse pump @@ -227,11 +336,13 @@ if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) ) { - F32 pwmPercent = getF32OverrideValue( &rinsePumpPwmPercentage ); - U32 pwmInCount = (U32)( ( pwmPercent / RINSE_PUMP_MAX_PWM_PERCENT ) * RINSE_PUMP_PWM_IN_COUNT_MAX ); + F32 pwmPercent = getF32OverrideValue( &rinsePumpPwmPercentage ); // TODO should this conversion happen in setPWMCount function? + U08 pwmInCount = (U08)( ( pwmPercent / RINSE_PUMP_MAX_PWM_PERCENT ) * RINSE_PUMP_PWM_IN_COUNT_MAX ); + rinsePumpTargetSpeedRPM = (U32)( ( (F32)pwmInCount / RINSE_PUMP_PWM_IN_COUNT_MAX ) * (F32)RINSE_PUMP_MAX_RPM_ESTIMATE ); + // Turn on logical rinse pump with given PWM value - setRinsePumpPwmCount( D79_RINSE_PUMP, pwmInCount ); + setRinsePumpPwmCount( D79_RINSE_PUMP, (U32)pwmInCount ); } else { Index: firmware/App/Controllers/RinsePump.h =================================================================== diff -u -r9ed40798a5f4779db8a07bb6e256f7de99660108 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Controllers/RinsePump.h (.../RinsePump.h) (revision 9ed40798a5f4779db8a07bb6e256f7de99660108) +++ firmware/App/Controllers/RinsePump.h (.../RinsePump.h) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -42,10 +42,10 @@ } RINSE_PUMP_PAYLOAD_T; #pragma pack(pop) -/// Enumeration of rinse pump +/// Enumeration of rinse pump instances typedef enum RinsePumpIds { - D79_RINSE_PUMP = 0, ///< Rinse pump D79 + D79_RINSE_PUMP = 0, ///< Rinse pump driven by D79 FPGA control NUM_OF_RINSE_PUMPS ///< Number of rinse pumps } RINSE_PUMP_ID_T; @@ -62,6 +62,10 @@ void initRinsePump(void); void execRinsePumpController(void); +void execRinsePumpMonitor( void ); +void monitorRinsePumpSpeed( void ); +U32 getRinsePumpMeasuredSpeed( void ); +U32 getRinsePumpTargetSpeedRPM( void ); void setRinsePumpState( RINSE_PUMP_STATE_T state ); RINSE_PUMP_STATE_T getRinsePumpState( void ); Index: firmware/App/Drivers/GPIO.c =================================================================== diff -u -r9ed40798a5f4779db8a07bb6e256f7de99660108 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Drivers/GPIO.c (.../GPIO.c) (revision 9ed40798a5f4779db8a07bb6e256f7de99660108) +++ firmware/App/Drivers/GPIO.c (.../GPIO.c) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -31,6 +31,9 @@ #define WD_PET_GIO_PORT_PIN 1U ///< Watchdog pet GPIO pin number. #define WD_EXP_GIO_PORT_PIN 0U ///< Watchdog expired GPIO pin number. +#define GPIO_AC_SWITCH_MASK 0x10U ///< AC switch status bit mask (concentrate cap switch per HDD). +#define GPIO_LEAK_SENSOR_MASK 0x04U ///< Leak sensor status bit mask (per HDD - update if different). + #define GET_WD_EXP() ( PIN_SIGNAL_STATE_T )( gioGetBit( gioPORTB, WD_EXP_GIO_PORT_PIN ) ) ///< Get watchdog expired pin state macro. #define TGL_WD_PET() gioToggleBit( gioPORTB, WD_PET_GIO_PORT_PIN ) ///< Macro to toggle watchdog pet signal state. @@ -95,7 +98,7 @@ * @brief * The getGPIOStatusFromFPGA function returns the latest GPIO status register * value reported by the DD FPGA. - * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via FpgaDD service) * @details \b Outputs: none * @return GPIO status register value (bit-mapped per HDD definition) *************************************************************************/ @@ -104,4 +107,37 @@ return getFPGAGPIOStatus(); } +/*********************************************************************//** + * @brief + * The getACSwitchStatus function returns the AC switch (concentrate cap + * switch) status from the FPGA GPIO register. + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via getGPIOStatusFromFPGA) + * @details \b Outputs: none + * @return TRUE if AC switch is asserted, FALSE otherwise + *************************************************************************/ +BOOL getACSwitchStatus( void ) +{ + U08 gpioStatus = getGPIOStatusFromFPGA(); + BOOL isAsserted = ( ( gpioStatus & GPIO_AC_SWITCH_MASK ) != 0U ) ? TRUE : FALSE; + + return isAsserted; +} + +/*********************************************************************//** + * @brief + * The getLeakSensorStatus function returns the leak sensor status from the + * FPGA GPIO register. Application code should trigger an alarm when + * LEAK_SENSOR_DETECTED is returned (e.g. in a monitor task). + * @details \b Inputs: fpgaSensorReadings.fpgaGPIOStatus (via getGPIOStatusFromFPGA) + * @details \b Outputs: none + * @return LEAK_SENSOR_NOT_DETECTED or LEAK_SENSOR_DETECTED + *************************************************************************/ +LEAK_SENSOR_STATUS_T getLeakSensorStatus( void ) +{ + U08 gpioStatus = getGPIOStatusFromFPGA(); + LEAK_SENSOR_STATUS_T status = ( ( gpioStatus & GPIO_LEAK_SENSOR_MASK ) != 0U ) ? LEAK_SENSOR_DETECTED : LEAK_SENSOR_NOT_DETECTED; + + return status; +} + /**@}*/ Index: firmware/App/Drivers/GPIO.h =================================================================== diff -u -r9ed40798a5f4779db8a07bb6e256f7de99660108 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Drivers/GPIO.h (.../GPIO.h) (revision 9ed40798a5f4779db8a07bb6e256f7de99660108) +++ firmware/App/Drivers/GPIO.h (.../GPIO.h) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -29,13 +29,25 @@ * @{ */ +// ********** public definitions ********** + +/// Leak sensor status enumeration (from FPGA GPIO register). +typedef enum LeakSensorStatus +{ + LEAK_SENSOR_NOT_DETECTED = 0, ///< No leak detected + LEAK_SENSOR_DETECTED, ///< Leak detected + NUM_OF_LEAK_SENSOR_STATUS +} LEAK_SENSOR_STATUS_T; + // ********** public function prototypes ********** void toggleWatchdogPetSignal( void ); void setWatchdogPetSignal( void ); void clrWatchdogPetSignal( void ); PIN_SIGNAL_STATE_T getWatchdogExpired( void ); U08 getGPIOStatusFromFPGA( void ); +BOOL getACSwitchStatus( void ); +LEAK_SENSOR_STATUS_T getLeakSensorStatus( void ); /**@}*/ Index: firmware/App/Monitors/Level.c =================================================================== diff -u -rcfa8ae21594d3471c37079eb708761fe9a047776 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Monitors/Level.c (.../Level.c) (revision cfa8ae21594d3471c37079eb708761fe9a047776) +++ firmware/App/Monitors/Level.c (.../Level.c) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -28,6 +28,7 @@ */ // ********** private definitions ********** +#define LEVEL_SENSOR_VALUE_LOW 0U ///< Level sensor digital low value (0 = low, non-zero = high). #define FPGA_B1_HW_LEVEL_LOW 5 ///< Floater low level status for Beta 1.0 #define FPGA_B1_HW_LEVEL_MEDIUM 4 ///< Floater medium level status for Beta 1.0 #define FPGA_B1_HW_LEVEL_HIGH 6 ///< Floater high level status for Beta 1.0 @@ -70,9 +71,6 @@ static void publishLevelsData( void ); static BOOL processLevelCount( U16 count ); static LEVEL_STATE_T readFloaterLevelstatus( LEVEL_T levelId ); -static LEVEL_STATE_T getLevelState( U32 levelStatus ); -static LEVEL_STATE_T getLevelStateBeta19( U32 levelStatus ); -static LEVEL_STATE_T getLevelStateBeta10( U32 levelStatus ); /*********************************************************************//** * @brief @@ -135,33 +133,33 @@ case D63_LEVL: if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) ) { - currentLevelStatus = ( 0U == getFPGAD63LevelSensor() ) ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH; + currentLevelStatus = ( LEVEL_SENSOR_VALUE_LOW == getFPGAD63LevelSensor() ) ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH; } else { - currentLevelStatus = ( processLevelCount( getFPGAD63LevelSensor() ) == 0 ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH ); + currentLevelStatus = ( processLevelCount( getFPGAD63LevelSensor() ) == LEVEL_SENSOR_VALUE_LOW ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH ); } break; case D98_LEVL: if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) ) { - currentLevelStatus = ( 0U == getFPGAD98LevelSensor() ) ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH; + currentLevelStatus = ( LEVEL_SENSOR_VALUE_LOW == getFPGAD98LevelSensor() ) ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH; } else { - currentLevelStatus = ( processLevelCount( getFPGAD98LevelSensor() ) == 0 ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH ); + currentLevelStatus = ( processLevelCount( getFPGAD98LevelSensor() ) == LEVEL_SENSOR_VALUE_LOW ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH ); } break; case D46_LEVL: if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) ) { - currentLevelStatus = ( 0U == getFPGAD46LevelSensor() ) ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH; + currentLevelStatus = ( LEVEL_SENSOR_VALUE_LOW == getFPGAD46LevelSensor() ) ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH; } else { - currentLevelStatus = ( processLevelCount( getFPGAD46LevelSensor() ) == 0 ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH ); + currentLevelStatus = ( processLevelCount( getFPGAD46LevelSensor() ) == LEVEL_SENSOR_VALUE_LOW ? LEVEL_STATE_LOW : LEVEL_STATE_HIGH ); } break; @@ -321,14 +319,14 @@ /*********************************************************************//** * @brief - * The getLevelState function maps the raw floater/level status reported + * The getLevelStateBeta20 function maps the raw floater/level status reported * by FPGA to the corresponding LEVEL_STATE_T for Beta 2.0 hardware. * @details \b Inputs: levelStatus * @details \b Outputs: none * @param levelStatus Raw FPGA level status value * @return mapped level state *************************************************************************/ -static LEVEL_STATE_T getLevelState( U32 levelStatus ) +static LEVEL_STATE_T getLevelStateBeta20( U32 levelStatus ) { LEVEL_STATE_T currentLevelStatus = LEVEL_STATE_ILLEGAL; @@ -417,7 +415,7 @@ else if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { // Beta 2.0 behavior - currentLevelStatus = getLevelState( levelStatus ); + currentLevelStatus = getLevelStateBeta20( levelStatus ); } else { @@ -439,7 +437,7 @@ else if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { // Beta 2.0 behavior - currentLevelStatus = getLevelState( levelStatus ); + currentLevelStatus = getLevelStateBeta20( levelStatus ); } else { Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -rcfa8ae21594d3471c37079eb708761fe9a047776 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision cfa8ae21594d3471c37079eb708761fe9a047776) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -112,9 +112,6 @@ #define FPGA_D12_PUMP_ERROR_BIT 0x01 ///< Fresh dialysate pump error bit mask. #define FPGA_D48_PUMP_ERROR_BIT 0x02 ///< Spent dialysate pump error bit mask. #define FPGA_FLOATER_LEVEL_BIT 0x0F ///< Floater level bit mask(D6 and P25). -#define FPGA_D46_LEVEL_BIT 0x01 ///< D46 conductive level sensor bit mask. -#define FPGA_D63_LEVEL_BIT 0x02 ///< D63 conductive level sensor bit mask. -#define FPGA_D98_LEVEL_BIT 0x04 ///< D98 conductive level sensor bit mask. #define FPGA_D5_HEATER_CNTRL_BIT 0x01 ///< FPGA GIO D5 heater control bit mask #define FPGA_D5_HEATER_PWM_ENABLE_BIT 0x02 ///< FPGA D5 PWM based heater control bit mask @@ -147,7 +144,7 @@ U08 fpgaRevLab; ///< Reg 3. FPGA revision (lab) being reported } FPGA_HEADER_T; // read only on FPGA -// Remove when Beta 1.9 is obsolete +#if 1 // Remove when Beta 1.9 is obsolete /// FPGA sensor readings struct. typedef struct { @@ -286,7 +283,9 @@ U16 fpgaD74CondTemp; ///< Reg 756. D74 Temperature U08 fpgaD74CondReadCnt; ///< Reg 758. D74 successful read count U08 fpgaD74CondErrorCnt; ///< Reg 759. D74 error read count + } DD_FPGA_SENSORS_BETA_1_9_T; +#endif typedef struct { @@ -350,7 +349,7 @@ U16 fpgaAvailableRegister5; ///< Reg 614. Available register 5 U16 fpgaD76PumpStepCountStatus; ///< Reg 616. UF pump revolution down count status U08 fpgaD76PumpFault; ///< Reg 618: UF pump fault - U08 fpgaHallSensorStatus; ///< reg 619: Hall sensor status + U08 fpgaHallSensorStatus; ///< Reg 619: HDF Hall sensor status S16 pressureP46; ///< Reg 620. P46 pressure data. U16 temperatureP46; ///< Reg 622. P46 temperature data. @@ -451,7 +450,7 @@ U08 fpgaP18CalMemCounter; ///< Reg 820. TBD } DD_FPGA_SENSORS_T; -// Remove when Beta 1.9 is obsolete +#if 1 // Remove when Beta 1.9 is obsolete typedef struct { U16 fpgaValveControl; ///< Reg 04. Valve control register @@ -530,6 +529,7 @@ U16 fpgaConSensD43_Addrs; ///< Reg 119. D43 Initialization Address register U32 fpgaConSensD43_Data_In; ///< Reg 121. D43 Initialization data register } FPGA_ACTUATORS_BETA_1_9_T; +#endif typedef struct { @@ -608,7 +608,7 @@ U08 fpgaConSensD43Control; ///< Reg 118. Conductivity/Temperature Sensors D43 Control registers U16 fpgaConSensD43_Addrs; ///< Reg 119. D43 Initialization Address register U32 fpgaConSensD43_Data_In; ///< Reg 121. D43 Initialization data register - U08 unsuedRegister; ///< Reg 125. Unused register. + U08 unusedRegister3; ///< Reg 125. Unused register 3 U32 fpgaD11PumpSpeed; ///< Reg 126. Acid Concentrate Pump Speed/RPM Control U32 fpgaD10PumpSpeed; ///< Reg 130. BiCarb Concentrate Pump Speed/RPM Control U32 fpgaD76PumpSpeed; ///< Reg 134. UF Pump Speed/RPM Control @@ -828,12 +828,15 @@ * @brief * The setFPGASpareValveStates function sets the DD spare valve states with a * 8-bit set of states - one bit per valve, with a 1 meaning "energized" and a 0 - * meaning "de-energized". The bit positions for these bit states are as follows: - * 0 - Not used.\n - * 1 - Not used.\n - * 2 - Not used.\n - * 3 - Not used.\n - * 4..7 - Unused or reserved.\n + * meaning "de-energized". Bit positions per HDD (2.0 valves - beta 1/1.9 to be deprecated): + * 0 - D88 valve (Spare valve 0).\n + * 1 - D83 valve (Spare valve 1).\n + * 2 - D91 valve (Spare valve 2).\n + * 3 - D104 valve (Spare valve 3).\n + * 4 - D95 valve (Spare valve 4).\n + * 5 - Spare valve 5.\n + * 6 - D100 valve (Spare valve 6).\n + * 7 - Spare valve 7.\n * @details \b Inputs: none * @details \b Outputs: fpgaDDSpareValveControl * @param valveStates bit mask for the spare valve states @@ -1068,7 +1071,7 @@ *************************************************************************/ void setFPGAD48PumpSpeed( U16 speed ) { -#ifdef __MAXON_SPEED_UPDATE__ +#ifdef __MAXON_SPEED_UPDATE__ /* Enable for B1.0/B1.9 with Diener Silencer 2000 pumps */ { U16 currentSpeed =(U16)( ( ( speed + PUMP_SPEED_OFFSET ) / PUMP_SPEED_FULL_SCALE ) * MAX_PUMP_SPEED ); SET_FPGA_ACTUATOR_FIELD( fpgaD48PumpSpeed, currentSpeed ); @@ -1091,7 +1094,7 @@ *************************************************************************/ void setFPGAD12PumpSpeed( U16 speed ) { -#ifdef __MAXON_SPEED_UPDATE__ +#ifdef __MAXON_SPEED_UPDATE__ /* Enable for B1.0/B1.9 with Diener Silencer 2000 pumps */ { U16 currentSpeed =(U16)( ( ( speed + PUMP_SPEED_OFFSET ) / PUMP_SPEED_FULL_SCALE ) * MAX_PUMP_SPEED ); SET_FPGA_ACTUATOR_FIELD( fpgaD12PumpSpeed, currentSpeed ); @@ -3072,21 +3075,18 @@ *************************************************************************/ U16 getFPGAD63LevelSensor( void ) { - U08 result; #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { - result = ( fpgaSensorReadings.fpgaConductiveLevelStatus & FPGA_D63_LEVEL_BIT ); + return fpgaSensorReadings.fpgaConductiveLevelStatus; } else { - result = fpgaBeta19SensorReadings.fpgaD63LevelSensor; + return fpgaBeta19SensorReadings.fpgaD63LevelSensor; } #else - result = GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); + return GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); #endif - - return result; } /*********************************************************************//** @@ -3099,21 +3099,18 @@ *************************************************************************/ U16 getFPGAD98LevelSensor( void ) { - U08 result; #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { - result = ( fpgaSensorReadings.fpgaConductiveLevelStatus & FPGA_D98_LEVEL_BIT ); + return fpgaSensorReadings.fpgaConductiveLevelStatus; } else { - result = fpgaBeta19SensorReadings.fpgaD98LevelSensor; + return fpgaBeta19SensorReadings.fpgaD98LevelSensor; } #else - result = GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); + return GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); #endif - - return result; } /*********************************************************************//** @@ -3126,21 +3123,18 @@ *************************************************************************/ U16 getFPGAD46LevelSensor( void ) { - U08 result; #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { - result = ( fpgaSensorReadings.fpgaConductiveLevelStatus & FPGA_D46_LEVEL_BIT ); + return fpgaSensorReadings.fpgaConductiveLevelStatus; } else { - result = fpgaBeta19SensorReadings.fpgaD46LevelSensor; + return fpgaBeta19SensorReadings.fpgaD46LevelSensor; } #else - result = GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); + return GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); #endif - - return result; } /*********************************************************************//** @@ -3166,21 +3160,18 @@ *************************************************************************/ U08 getFPGAFloater2Status( void ) { - U08 result; #if 1 // Remove when Beta 1.9 is obsolete if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_2_0_HW ) == TRUE ) { - result = fpgaSensorReadings.fpgaConductiveLevelStatus; + return fpgaSensorReadings.fpgaConductiveLevelStatus; } else { - result = fpgaBeta19SensorReadings.fpgaFloater2Status; + return fpgaBeta19SensorReadings.fpgaFloater2Status; } #else - result = GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); + return GET_FPGA_SENSOR_FIELD( fpgaConductiveLevelStatus ); #endif - - return result; } /*********************************************************************//** Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -rf66ffb2807dae4ad719d41520bc8c3739210bfd0 --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision f66ffb2807dae4ad719d41520bc8c3739210bfd0) @@ -26,6 +26,7 @@ #include "InternalADC.h" #include "Level.h" #include "ModeGenDialysate.h" +#include "RinsePump.h" #include "Pressure.h" #include "TaskPriority.h" #include "Temperature.h" @@ -102,6 +103,9 @@ // Flow Sensor execFlowMonitor(); + // Monitor rinse pump + execRinsePumpMonitor(); + // Second pass for FPGA execFPGA( FALSE ); #endif