Detection of saw tooth or square wave

Thanks, I will try it this week. If you come up with any other ideas let me know.