update pulse detect function