Confused by oscilloscope - square wave signal to RPM

Please post your latest version of the code.