Added reset condition to findPeaks

Initialize sums and shift register for slope change to 0s