needRefresh is a flag that should be set whenever you changed anything inside the pxBuffer (aka dirty flag or new data to display).
canRefresh is a flag which indicates whether it’s safe to start a new background transfer (==true) or not due to an active transfer being performed in the background (==false).
While msRefresh (which was in your original code already and you should have undestood that then already) is a millisecond (hence ms...) value to provide some means to slow down the animation refresh rate (if needed).