Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r2bb447181c2519690441d81f83563d17e0882ef2 -r85bfe5051e4d2bf67be39d394f96c075b4e52836 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 2bb447181c2519690441d81f83563d17e0882ef2) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 85bfe5051e4d2bf67be39d394f96c075b4e52836) @@ -66,13 +66,13 @@ #define DIP_PWM_ZERO_OFFSET 0.1 // 10% PWM duty cycle = zero speed #define DIP_PWM_FROM_ML_PER_MIN(rate) ( (rate) * DIP_ML_PER_MIN_TO_PUMP_RPM_FACTOR * DIP_GEAR_RATIO * DIP_MOTOR_RPM_TO_PWM_DC_FACTOR + DIP_PWM_ZERO_OFFSET ) -#define DIAL_INPUMP_ADC_FULL_SCALE_V 3.0 // BP analog signals are 0-3V (while int. ADC ref V is 3.3V) -#define DIAL_INPUMP_ADC_MID_PT_BITS ( (F32)( INT_ADC_FULL_SCALE_BITS >> 1 ) * ( DIAL_INPUMP_ADC_FULL_SCALE_V / INT_ADC_REF_V ) ) -#define SIGN_FROM_12_BIT_VALUE(v) ( (S16)(v) - (S16)DIAL_INPUMP_ADC_MID_PT_BITS ) +#define DIAL_IN_PUMP_ADC_FULL_SCALE_V 3.0 // BP analog signals are 0-3V (while int. ADC ref V is 3.3V) +#define DIAL_IN_PUMP_ADC_MID_PT_BITS ( (F32)( INT_ADC_FULL_SCALE_BITS >> 1 ) * ( DIAL_IN_PUMP_ADC_FULL_SCALE_V / INT_ADC_REF_V ) ) +#define SIGN_FROM_12_BIT_VALUE(v) ( (S16)(v) - (S16)DIAL_IN_PUMP_ADC_MID_PT_BITS ) -#define DIAL_IN_FLOW_SAMPLE_FREQ ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) -#define SIZE_OF_ROLLING_AVG (U32)( (F32)DIAL_IN_FLOW_SAMPLE_FREQ * 0.8 ) // measured dialIn flow is filtered w/ moving average -#define MAX_FLOW_FILTER_INTERVAL 5 // slowest sample interval for filter is every 5th sample +#define DIAL_IN_FLOW_SAMPLE_FREQ ( MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) +#define SIZE_OF_ROLLING_AVG (U32)( (F32)DIAL_IN_FLOW_SAMPLE_FREQ * 0.8 ) // measured dialIn flow is filtered w/ moving average +#define MAX_FLOW_FILTER_INTERVAL 5 // slowest sample interval for filter is every 5th sample typedef enum DialInPump_States { @@ -658,13 +658,12 @@ /************************************************************************* * @brief resetDialInFlowMovingAverage - * The resetDialInFlowMovingAverage function re-sizes and re-initializes the \n + * The resetDialInFlowMovingAverage function resets the properties of the \n * dialIn flow moving average sample buffer. * @details * Inputs : none * Outputs : flowReadingsTotal, flowReadingsIdx, flowReadingsCount all set to zero. - * @param initFlow : the new dialIn flow set pt. - * @param flowDir : the new set direction + * @param none * @return none *************************************************************************/ static void resetDialInFlowMovingAverage( void ) @@ -753,8 +752,8 @@ * The checkDialInPumpDirection function checks the set direction vs. \n * the direction implied by the sign of the measured MC speed. * @details - * Inputs : - * Outputs : + * Inputs : adcDialInPumpMCSpeedRPM, dialInPumpDirectionSet, dialInPumpState + * Outputs : none * @param none * @return none *************************************************************************/ @@ -778,8 +777,8 @@ * The checkDialInPumpMCCurrent function checks the measured MC current vs. \n * the set state of the dialIn pump (stopped or running). * @details - * Inputs : - * Outputs : + * Inputs : dialInPumpState, dipCurrErrorDurationCtr, adcDialInPumpMCCurrentmA + * Outputs : none * @param none * @return none *************************************************************************/