Giter Club home page Giter Club logo

Comments (2)

ytai avatar ytai commented on August 22, 2024

I don't remember off the top of my head why this logic is there (i.e. 0
being considered the longest period), and it might as well be wrong, but I
don't think this would fix your problem.
Chances are that your input signal is noisy, causing you to get bogus
pulses.
The blocking behaviour is intentional. If you want to time out, you can use
a TimerTask to interrupt you. See the forum for more details - this is a
recurring question.

On Sat, Nov 2, 2013 at 1:40 PM, Thomas Hermansson
[email protected]:

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 looking in IncapImpl.java I see that dataReceived is called with all
data array =0. ByteArrayToLong is then called and at the end of this
function we see the following lines:

if (result == 0) {
result = 1 << (size * 8);
}

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?

Kind Regards
Thomas Hermansson
TNA Software AB
Sweden


Reply to this email directly or view it on GitHubhttps://github.com//issues/70
.

from ioio.

edarn avatar edarn commented on August 22, 2024

Hi Ytai!

There is unfortunately no noice on the input. I have measured it with my
Rigol 20MHz oscilloscope and the signal shows only small noice between
3.3-3.2Volt. I've run it for a long time with a trigger at around 1.5V
without any hit. So I think that part can be ruled out.

The blocking part is not an issue, just abit annoying. :-)

But it is abit strange that datareceived sometimes returns 1. I will debug
this abit more once I get the time, but I became a father yesterday, so
chances are that my spare time gets reduced. ;-)

//Thomas
Den 3 nov 2013 00:12 skrev "Ytai Ben-Tsvi" [email protected]:

I don't remember off the top of my head why this logic is there (i.e. 0
being considered the longest period), and it might as well be wrong, but I
don't think this would fix your problem.
Chances are that your input signal is noisy, causing you to get bogus
pulses.
The blocking behaviour is intentional. If you want to time out, you can
use
a TimerTask to interrupt you. See the forum for more details - this is a
recurring question.

On Sat, Nov 2, 2013 at 1:40 PM, Thomas Hermansson
[email protected]:

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 looking in IncapImpl.java I see that dataReceived is called with
all
data array =0. ByteArrayToLong is then called and at the end of this
function we see the following lines:

if (result == 0) {
result = 1 << (size * 8);
}

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?

Kind Regards
Thomas Hermansson
TNA Software AB
Sweden


Reply to this email directly or view it on GitHub<
https://github.com/ytai/ioio/issues/70>
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/70#issuecomment-27634868
.

from ioio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.