Skip to content
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

Adds sendSignal and emit('message') with tolerances and expected values. #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tcr
Copy link
Member

@tcr tcr commented Dec 6, 2014

We had a very hard time explaining the utility of sendRawSignal and parsing raw message values. Also, IR tolerances are generally +/- 10% for most devices. Solve this using a simple API:

ir.sendSignal([8400, -4400, 640, -320, 1000])

And to parse

ir.tolerance = 0.1 // 10%
ir.expected = [8400, -4400, 640, -320, 1000];
ir.on('message', function (data) {
// packet received where all values were within tolerance of some value in expected
// `data` is an array of values from expected
});

Messages that have values not within tolerance are rejected and not emitted by message.

@johnnyman727
Copy link
Contributor

Looks good but can you add relevant tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants