PaulStoffregen / FreqMeasure

Measures the elapsed time during each cycle of an input frequency.
http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
70 stars 31 forks source link

Fixed error on first measurement + added averaging parameter #15

Open mrguen opened 6 years ago

mrguen commented 6 years ago

This code fixes

Was tested on Atmega328p . I could not test teensy, since I don't have one.

PaulStoffregen commented 3 years ago

I have multiple concerns about the correctness and CPU usage of this change. Sorry, no time right now to write a lengthy explanation.

PaulStoffregen commented 3 years ago

But briefly, if the issue is merely incorrect output on the 1st measurement, that should be handled in the non-interrupt read() function. Burdening the CPU critical interrupt code with so many extra condition tests isn't the way.