Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r16d6398acc1c6cf604d9dc993b27c94d895132e9 -ra6b123cfdbca851389cfd5cc1b753386e156e960 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 16d6398acc1c6cf604d9dc993b27c94d895132e9) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision a6b123cfdbca851389cfd5cc1b753386e156e960) @@ -1234,6 +1234,7 @@ } // Calculate target FPGA rate from set rate in mL/hr converted to microstep toggle interval in uSec calcStepperToggleTimeForTargetRate( syringePumpSetRate ); + // Update the FPGA rate to intial ramp up speed setFPGASyringePumpStepToggleTime( syringePumpRampUpToggleTime ); // Reset stall detect variables syringePumpStallRetryCount = 0; @@ -1986,6 +1987,10 @@ /*********************************************************************//** * @brief * The rampSyringePump function handles the ramp-up for the syringe pump. + * This function calculates the new toggle time every 10 ms and updates FPGA + * with the new toggle. + * Motor speed is inversely proportional to the toggle time. + * Smaller the toggle time, faster the speed of the motor. * @details \b Inputs: syringePumpRampTimerCtr, syringePumpSetToggleTime * @details \b Outputs: syringePumpRampUpToggleTime * @return none @@ -1994,11 +1999,15 @@ { // Ramp up syringe pump toward target speed syringePumpRampTimerCtr++; + + // Check if current toggle time is larger than the target toggle time. if ( syringePumpRampUpToggleTime > syringePumpSetToggleTime ) { + // Calculate the new toggle time and update the FPGA with the new speed. syringePumpRampUpToggleTime = (U32)( (F32)SYRINGE_PUMP_START_RAMP_SPEED / ( (F32)( syringePumpRampTimerCtr * syringePumpRampTimerCtr * syringePumpRampTimerCtr ) / (F32)SYRINGE_PUMP_RAMP_DIVISOR ) ); syringePumpRampUpPct = (F32)syringePumpSetToggleTime / (F32)syringePumpRampUpToggleTime; + if ( syringePumpRampUpToggleTime > syringePumpSetToggleTime ) { setFPGASyringePumpStepToggleTime( syringePumpRampUpToggleTime );