-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PulseInput returns incorrect frequency when no pulse is returned. #70
Comments
I don't remember off the top of my head why this logic is there (i.e. 0 On Sat, Nov 2, 2013 at 1:40 PM, Thomas Hermansson
|
Hi Ytai! There is unfortunately no noice on the input. I have measured it with my The blocking part is not an issue, just abit annoying. :-) But it is abit strange that datareceived sometimes returns 1. I will debug //Thomas
|
Dear Ytai!
Many thanks for creating IOIO, Some 6 years ago I built a weatherstation based on the Cinterion TV65 device, but it was horrible unstable so the IOIO will now be used for my next revision of www.surfvind.se.
However when experimenting with the pulseInput api it appears to me as if the getFrequency returns bogus data when no pulses at all are received.
I use:
pulseCounter = ioio.openPulseInput(spec, ClockRate.RATE_62KHz, PulseMode.FREQ, true);
freq = pulseCounter.getFrequency();
First of all, as getFrequency blocks while waiting for pulses, this means that this call blocks a very long time if no pulses arrive. (I have an anemometer connected to this pulsecounter, and if no wind = no pulses). At some point getFrequency returns, and it then returns an incorrect freq.
While debugging IncapImpl.java I see that dataReceived is called with either data[0] = 0 or data[0] = 1.
ByteArrayToLong is then called and at the end of this function we see the following lines:
if (result == 0) {
result = 1 << (size * 8);
}
For data[0] = 0 this results in lastDuration beeing set to 256, 65536 etc which ends up giving a frequency that is incorrect. I have not yet figured out why ByteArrayToLong does this at the end, am I missing any part?
Second issue is that the data[0] = 1 when in fact there is no pulses at all received.
I´m using version 4.00 of the App library.
Kind Regards
Thomas Hermansson
TNA Software AB
Sweden
The text was updated successfully, but these errors were encountered: