Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r53d6550ebd61a9527cbecd507e326cc3079c05ce -r08fd3b3564f6852dec6d2038d37f66b8692fdf44 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 53d6550ebd61a9527cbecd507e326cc3079c05ce) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 08fd3b3564f6852dec6d2038d37f66b8692fdf44) @@ -40,8 +40,10 @@ // ********** private definitions ********** -#define HEATERS_MAX_DUTY_CYCLE 1.00F ///< Heaters max duty cycle (100%) or ON state -#define HEATERS_MIN_DUTY_CYCLE 0.00F ///< Heaters minimum duty cycle (0.00%) or OFF state +#define HEATERS_MAX_DUTY_CYCLE 1.00F ///< Heater max duty cycle (100%) or ON state +#define HEATERS_MIN_DUTY_CYCLE 0.00F ///< Heater minimum duty cycle (0.00%) or OFF state +#define HEATER_PWM_FULL_SCALE 450 ///< Heater full scale PWM value. +#define HEATER_PWM_OFFSET 25 ///< Heater PWM offset. #define HEATER_ON_CTRL_DUTY_CYCLE 1.00F ///< Heater ON control duty cycle. #define HEATERS_DISINFECT_DUTY_CYCLE 0.80F ///< Heaters disinfect cycle. #define HEATERS_DISINFECT_TRANSFER_DUTY_CYCLE 0.60F ///< Heaters disinfect transfer duty cycle. @@ -455,10 +457,16 @@ *************************************************************************/ static void setHeaterControl( void ) { - F32 ctrl; + F32 ctrl = getHeaterControl(); + BOOL enable = FALSE; + U16 pwm = (U16)( ctrl * (F32)HEATER_PWM_FULL_SCALE + (F32)HEATER_PWM_OFFSET + 0.5F ); - ctrl = getHeaterControl(); -// setFPGACPrimaryHeaterOnOffControl( (BOOL)ctrl ); // TODO ctrl is F32 - why casting as BOOL???? // TODO - implement FPGA set function + if ( ctrl > 0.0F ) + { + enable = TRUE; + } + setFPGAHeaterEnabled( enable ); + setFPGAHeaterPWM( pwm ); } /*********************************************************************//** Index: firmware/App/Drivers/BoostPump.c =================================================================== diff -u -r51d83f99e63d9cb52951097996641cc5b3ddffd7 -r08fd3b3564f6852dec6d2038d37f66b8692fdf44 --- firmware/App/Drivers/BoostPump.c (.../BoostPump.c) (revision 51d83f99e63d9cb52951097996641cc5b3ddffd7) +++ firmware/App/Drivers/BoostPump.c (.../BoostPump.c) (revision 08fd3b3564f6852dec6d2038d37f66b8692fdf44) @@ -74,7 +74,7 @@ } // set RO pump to stop - setROPumpPWMPct( 0 ); + setROPumpPWM( 0 ); // TODO set boost pump to stop } @@ -91,7 +91,7 @@ U32 tach; // get latest RO pump duty cycle read back from FPGA - boostPumpReadDutyCycle[ RO_PUMP ].data = getROPumpPWMPct(); + boostPumpReadDutyCycle[ RO_PUMP ].data = getROPumpPWM(); // get latest RO pump tachometer count from FPGA and convert to RPM tach = (U32)getROPumpTachCount(); @@ -139,7 +139,7 @@ boostPumpCmdDutyCycle[ pumpID ] = pwm; if ( RO_PUMP == pumpID ) { - setROPumpPWMPct( pwm ); + setROPumpPWM( pwm ); } else { Index: firmware/App/Services/FpgaRO.c =================================================================== diff -u -ra1907314deab28c20945cd41d2d167924daf2c08 -r08fd3b3564f6852dec6d2038d37f66b8692fdf44 --- firmware/App/Services/FpgaRO.c (.../FpgaRO.c) (revision a1907314deab28c20945cd41d2d167924daf2c08) +++ firmware/App/Services/FpgaRO.c (.../FpgaRO.c) (revision 08fd3b3564f6852dec6d2038d37f66b8692fdf44) @@ -38,6 +38,9 @@ #define MAX_FPGA_COMM_FAILURES 3 ///< FPGA maximum comm failures per MAX_FPGA_COMM_FAILURES_WINDOW_MS #define MIN_POWER_ON_TIME_FOR_COMM_FAILS ( 1 * MS_PER_SECOND ) ///< Allow FPGA comm errors for first second after power-up +#define HEATER_ENABLED 0x01 ///< Heater enable bit. +#define HEATER_DISABLED 0x00 ///< Heater disabled. + #define FPGA_CONDUCTIVITY_RESET_BIT 0x01 ///< Conductivity Sensor reset bit mask. #define FPGA_CONDUCTIVITY_INIT_ENABLE_BIT 0x02 ///< Conductivity Sensor initialization enable bit mask. #define FPGA_CONDUCTIVITY_WR_ENABLE_BIT 0x04 ///< Conductivity Sensor write enable bit mask. @@ -403,27 +406,29 @@ /*********************************************************************//** * @brief - * The setROPumpPWMPct function sets the RO pump PWM duty cycle. + * The setROPumpPWM function sets the RO 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: fpgaActuatorSetPoints.roPumpPWMDutyCyclePct * @param pwm PWM duty cycle magnitude * @return none *************************************************************************/ -void setROPumpPWMPct( U16 pwm ) +void setROPumpPWM( U16 pwm ) { fpgaActuatorSetPoints.roPumpPWMDutyCyclePct = pwm; } /*********************************************************************//** * @brief - * The getROPumpPWMPct function gets a read back from FPGA of RO pump PWM + * The getROPumpPWM function gets a read back from FPGA of RO pump PWM * duty cycle. * @details \b Inputs: fpgaSensorReadings.roPumpPWMReadback * @details \b Outputs: none * @return measured speed (RPM) of the RO pump *************************************************************************/ -U16 getROPumpPWMPct( void ) +U16 getROPumpPWM( void ) { return fpgaSensorReadings.roPumpPWMReadback; } @@ -443,6 +448,42 @@ /*********************************************************************//** * @brief + * The setFPGAHeaterEnabled function sets the heater enable on or off. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.heaterControl + * @param enable Flag indicating whether to enable or disable the heater. + * @return none + *************************************************************************/ +void setFPGAHeaterEnabled( BOOL enable ) +{ + if ( TRUE == enable ) + { + fpgaActuatorSetPoints.heaterControl = HEATER_ENABLED; + } + else + { + fpgaActuatorSetPoints.heaterControl = HEATER_DISABLED; + } +} + +/*********************************************************************//** + * @brief + * The setFPGAHeaterPWM function sets the heater 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 heater to go off so effective + * range is actually 25..475. + * @details \b Inputs: none + * @details \b Outputs: fpgaActuatorSetPoints.heaterPWMDutyCyclePct + * @param pwm PWM duty cycle magnitude + * @return none + *************************************************************************/ +void setFPGAHeaterPWM( U16 pwm ) +{ + fpgaActuatorSetPoints.heaterPWMDutyCyclePct = pwm; +} + +/*********************************************************************//** + * @brief * The getFPGAPRiRawPressure function gets the PRi pressure reading. * @details \b Inputs: fpgaSensorReadings.pressurePri * @details \b Outputs: none Index: firmware/App/Services/FpgaRO.h =================================================================== diff -u -ra1907314deab28c20945cd41d2d167924daf2c08 -r08fd3b3564f6852dec6d2038d37f66b8692fdf44 --- firmware/App/Services/FpgaRO.h (.../FpgaRO.h) (revision a1907314deab28c20945cd41d2d167924daf2c08) +++ firmware/App/Services/FpgaRO.h (.../FpgaRO.h) (revision 08fd3b3564f6852dec6d2038d37f66b8692fdf44) @@ -45,10 +45,13 @@ U16 getFPGAValveStates( void ); void setROPumpEnable( BOOL enable ); -void setROPumpPWMPct( U16 pwm ); -U16 getROPumpPWMPct( void ); +void setROPumpPWM( U16 pwm ); +U16 getROPumpPWM( void ); U16 getROPumpTachCount( void ); +void setFPGAHeaterEnabled( BOOL enable ); +void setFPGAHeaterPWM( U16 pwm ); + S16 getFPGAPRiRawPressure( void ); S16 getFPGAPRiRawTemperature( void ); U08 getFPGAPRiReadCount( void );