-
Notifications
You must be signed in to change notification settings - Fork 839
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
Inconsistent decoding for unknown. #264
Comments
Smells like a bug to me. I'll check it out when I get home in several hours.
Thanks for the detailed report.
…On Thu, Jul 6, 2017, 2:03 PM PaulKierstead ***@***.***> wrote:
Version/revison of the library used
Version 2.1.0
Expected behavior
Using IRrecvDumpV2
Point Apple iMac remote at it and press a key. Do the same when the signal
is weak to get some variance.
Actual behavior
Sometimes you get different Code values, but the raw content is very very
close.
Example, here is two decodes:
Encoding : UNKNOWN
Code : 50B12173 (34 bits)
Timing[67]:
+9150, -4650 + 550, - 650 + 550, -1800 + 600, -1750
+ 650, -1800 + 550, - 700 + 550, -1800 + 550, -1750
+ 650, -1750 + 600, -1750 + 600, -1750 + 650, -1700
+ 650, - 600 + 650, - 650 + 550, - 600 + 600, - 600
+ 600, -1750 + 650, -1750 + 650, - 600 + 550, -1800
+ 600, - 650 + 600, - 600 + 650, - 650 + 500, - 700
+ 600, - 600 + 650, - 650 + 600, -1750 + 650, - 600
+ 650, - 550 + 650, - 600 + 650, - 600 + 600, - 650
+ 650, - 550 + 700
uint16_t rawData[67] = {9150,4650, 550,650, 550,1800, 600,1750, 650,1800, 550,700, 550,1800, 550,1750, 650,1750, 600,1750, 600,1750, 650,1700, 650,600, 650,650, 550,600, 600,600, 600,1750, 650,1750, 650,600, 550,1800, 600,650, 600,600, 650,650, 500,700, 600,600, 650,650, 600,1750, 650,600, 650,550, 650,600, 650,600, 600,650, 650,550, 700}; // UNKNOWN 50B12173
.. some other stuff here
Encoding : UNKNOWN
Code : 6CB58446 (34 bits)
Timing[67]:
+9150, -4600 + 650, - 600 + 650, -1650 + 650, -1700
+ 650, -1750 + 650, - 600 + 650, -1700 + 650, -1750
+ 650, -1750 + 650, -1700 + 650, -1700 + 650, -1700
+ 650, - 600 + 650, - 600 + 650, - 600 + 600, - 600
+ 650, -1750 + 650, -1750 + 650, - 600 + 650, -1700
+ 600, - 600 + 700, - 550 + 650, - 550 + 650, - 600
+ 650, - 600 + 650, - 600 + 650, -1750 + 600, - 600
+ 650, - 600 + 650, - 550 + 650, - 600 + 650, - 600
+ 650, - 600 + 600
uint16_t rawData[67] = {9150,4600, 650,600, 650,1650, 650,1700, 650,1750, 650,600, 650,1700, 650,1750, 650,1750, 650,1700, 650,1700, 650,1700, 650,600, 650,600, 650,600, 600,600, 650,1750, 650,1750, 650,600, 650,1700, 600,600, 700,550, 650,550, 650,600, 650,600, 650,600, 650,1750, 600,600, 650,600, 650,550, 650,600, 650,600, 650,600, 600}; // UNKNOWN 6CB58446
The RAW data for those two are extremely close (just a little variance on
timing) yet the codes are different. I've seen some other codes too (for
the same button and raw data). It seems to happen mostly when you get some
garbage (really weak signal) between a couple of decodes.
Am I blind here (it is late...), or should I not trust the code value for
unknown, or is this a bug?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#264>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AMInDJsce6qkWRyVIoC6umT5zKZjvtEzks5sLFyFgaJpZM4OPIp3>
.
|
In the meantime can you please turn on the DEBUG flag in IRremoteESP8266.h
and send me the output.
If I recall correctly, the original Apple remotes (white with black end)
send NEC-like codes.
…On Thu, Jul 6, 2017, 2:26 PM David Conran ***@***.***> wrote:
Smells like a bug to me. I'll check it out when I get home in several
hours.
Thanks for the detailed report.
On Thu, Jul 6, 2017, 2:03 PM PaulKierstead ***@***.***>
wrote:
> Version/revison of the library used
>
> Version 2.1.0
> Expected behavior
>
> Using IRrecvDumpV2
> Point Apple iMac remote at it and press a key. Do the same when the
> signal is weak to get some variance.
> Actual behavior
>
> Sometimes you get different Code values, but the raw content is very very
> close.
>
> Example, here is two decodes:
>
> Encoding : UNKNOWN
> Code : 50B12173 (34 bits)
> Timing[67]:
> +9150, -4650 + 550, - 650 + 550, -1800 + 600, -1750
> + 650, -1800 + 550, - 700 + 550, -1800 + 550, -1750
> + 650, -1750 + 600, -1750 + 600, -1750 + 650, -1700
> + 650, - 600 + 650, - 650 + 550, - 600 + 600, - 600
> + 600, -1750 + 650, -1750 + 650, - 600 + 550, -1800
> + 600, - 650 + 600, - 600 + 650, - 650 + 500, - 700
> + 600, - 600 + 650, - 650 + 600, -1750 + 650, - 600
> + 650, - 550 + 650, - 600 + 650, - 600 + 600, - 650
> + 650, - 550 + 700
> uint16_t rawData[67] = {9150,4650, 550,650, 550,1800, 600,1750, 650,1800, 550,700, 550,1800, 550,1750, 650,1750, 600,1750, 600,1750, 650,1700, 650,600, 650,650, 550,600, 600,600, 600,1750, 650,1750, 650,600, 550,1800, 600,650, 600,600, 650,650, 500,700, 600,600, 650,650, 600,1750, 650,600, 650,550, 650,600, 650,600, 600,650, 650,550, 700}; // UNKNOWN 50B12173
>
> .. some other stuff here
>
> Encoding : UNKNOWN
> Code : 6CB58446 (34 bits)
> Timing[67]:
> +9150, -4600 + 650, - 600 + 650, -1650 + 650, -1700
> + 650, -1750 + 650, - 600 + 650, -1700 + 650, -1750
> + 650, -1750 + 650, -1700 + 650, -1700 + 650, -1700
> + 650, - 600 + 650, - 600 + 650, - 600 + 600, - 600
> + 650, -1750 + 650, -1750 + 650, - 600 + 650, -1700
> + 600, - 600 + 700, - 550 + 650, - 550 + 650, - 600
> + 650, - 600 + 650, - 600 + 650, -1750 + 600, - 600
> + 650, - 600 + 650, - 550 + 650, - 600 + 650, - 600
> + 650, - 600 + 600
> uint16_t rawData[67] = {9150,4600, 650,600, 650,1650, 650,1700, 650,1750, 650,600, 650,1700, 650,1750, 650,1750, 650,1700, 650,1700, 650,1700, 650,600, 650,600, 650,600, 600,600, 650,1750, 650,1750, 650,600, 650,1700, 600,600, 700,550, 650,550, 650,600, 650,600, 650,600, 650,1750, 600,600, 650,600, 650,550, 650,600, 650,600, 650,600, 600}; // UNKNOWN 6CB58446
>
>
> The RAW data for those two are extremely close (just a little variance on
> timing) yet the codes are different. I've seen some other codes too (for
> the same button and raw data). It seems to happen mostly when you get some
> garbage (really weak signal) between a couple of decodes.
>
> Am I blind here (it is late...), or should I not trust the code value for
> unknown, or is this a bug?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#264>, or mute the
> thread
> <https://github.com/notifications/unsubscribe-auth/AMInDJsce6qkWRyVIoC6umT5zKZjvtEzks5sLFyFgaJpZM4OPIp3>
> .
>
|
I've simulated the data you provided. There are a number of issues with your capture etc. I'm right in my memory that Apple use a NEC-like protocol, but don't strictly follow the NEC standard. Thus technically it isn't a NEC code. I'll look at adding something to report that sort of thing in the dump program. However, the main issue is the "SPACE"s in the rawData you captured are a fair way outside of the normal values. I had to turn up the TOLERANCE value in IRrecv.h file to +/-50% (default is +/- 25%) for it to recognise it (mostly) as an NEC-like protocol. That is, the values of '700' are too large for the expected value of approx 560. An alternative is change MARK_EXCESS (again in IRrecv.h) to TL;DR: Your rig for capturing, or the remote itself is to far out of spec for the default code/values. You'll need to customise/tune those parameters or the timings for NEC directly to suit your specific case. Perhaps try a new battery in the apple remote. |
- Apple TV remotes use the NEC protocol, but don't follow the integrity checks. Decode these last and report them separately in the example code. - Addresses Issue #264
FYI, from the Troubleshooting guide.
I've now just updated it further to clarify it's not a reliable value even for receiving too. It's partly based on timing values so it isn't a 100% correlation with the button pressed again. |
Thank very much for the detailed and helpful response! I'll try some of those things tonight and report back. Do the values for space have any 'real-world' correspondence? Edit: I take back the part about spaces. On the scope, for the Adafruit NEC one, the "low" portion was typically around 640 us, and the "high" portion around 560 us. I'm not sure which is considered the space, so I crossed that bit out in favour of this more detailed explanation. I'm pretty sure the Apple one was very similar, but will check again. Note if the remote is close there is no problem, generally. |
Ok, update on timing. The "low" portion of the signal on the scope, which seems to be the constant part after the initial pulse, is about 580us on the Adafruit remote, but 640 us on the apple remote. This is with a strong signal. I swear I buy CR2032's and they magically disappear, I can't find replacement one in the house |
So, I patched in your change on 2.1, and it definitely seems more consistent; now I could just check for 32 bits and NEC-Like, and pretty sure of a decode. Sample output (may not be the same button as before...), with a repeat:
|
Glad the patch works for you.
Yes, as I said, your Apple remote seems a little out of spec for what ever
reason.
It's a balancing game to provide a system with enough slack to accept
signals that are slightly off and not be matched against incorrect
protocols.
It's a lot simpler if you are a device and only expecting one protocol. :-/
…On Fri, Jul 7, 2017, 12:14 PM PaulKierstead ***@***.***> wrote:
So, I patched in your change on 2.1, and it definitely seems more
consistent; now I could just check for 32 bits and NEC-Like, and pretty
sure of a decode. Sample output (may not be the same button as before...),
with a repeat:
Encoding : NEC (non-strict)
Code : 77E1A040 (32 bits)
Timing[67]:
+9200, -4550 + 650, - 600 + 650, -1700 + 650, -1700
+ 650, -1750 + 650, - 600 + 650, -1700 + 650, -1700
+ 650, -1700 + 650, -1700 + 650, -1700 + 700, -1650
+ 650, - 550 + 650, - 550 + 650, - 550 + 650, - 550
+ 650, -1750 + 650, -1700 + 650, - 600 + 700, -1650
+ 650, - 600 + 650, - 550 + 650, - 550 + 650, - 550
+ 650, - 550 + 650, - 550 + 700, -1700 + 650, - 550
+ 700, - 550 + 650, - 600 + 650, - 550 + 700, - 550
+ 650, - 550 + 650
uint16_t rawData[67] = {9200,4550, 650,600, 650,1700, 650,1700, 650,1750, 650,600, 650,1700, 650,1700, 650,1700, 650,1700, 650,1700, 700,1650, 650,550, 650,550, 650,550, 650,550, 650,1750, 650,1700, 650,600, 700,1650, 650,600, 650,550, 650,550, 650,550, 650,550, 650,550, 700,1700, 650,550, 700,550, 650,600, 650,550, 700,550, 650,550, 650}; // NEC (non-strict) 77E1A040
uint32_t address = 0x87EE;
uint32_t command = 0x0;
uint64_t data = 0x77E1A040;
Encoding : NEC (Repeat)
Code : FFFFFFFFFFFFFFFF (0 bits)
Timing[3]:
+9200, -2250 + 650
uint16_t rawData[3] = {9200,2250, 650}; // NEC (Repeat) FFFFFFFFFFFFFFFF
uint64_t data = 0xFFFFFFFFFFFFFFFF;
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#264 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMInDDqFP-nSPQyvk5APme0tfyIstWIxks5sLZRzgaJpZM4OPIp3>
.
|
I've just thought of and implemented a way to auto-calibrate an incoming signal if it is a bit out of spec based on this issue. I've done it for NEC messages, and it seems to work for existing in-spec messages and your slightly askew Apple Remote. See this branch for progress. |
The auto-timing-adjust for incoming signals has been added to master |
Thank you very very much! I'm popping out of country for a bit, but will give it a try when I get back. |
Follow up: Works really really well. I get very consistent decodes even when the signal is quite weak, considerably more stable results then before. As a note to anyone who reads this: Long interrupt routines will pooch your results :) (no fault of this library, it ruins the timing) I fixed it by making my offending code into a poll instead of interrupt driven. |
Good to hear. Yes, You need to do the absolute minimum you can get away with in the interrupt code/routines. |
Version/revison of the library used
Version 2.1.0
Expected behavior
Using IRrecvDumpV2
Point Apple iMac remote at it and press a key. Do the same when the signal is weak to get some variance.
Actual behavior
Sometimes you get different Code values, but the raw content is very very close.
Example, here is two decodes:
The RAW data for those two are extremely close (just a little variance on timing) yet the codes are different. I've seen some other codes too (for the same button and raw data). It seems to happen mostly when you get some garbage (really weak signal) between a couple of decodes.
Am I blind here (it is late...), or should I not trust the code value for unknown, or is this a bug?
The text was updated successfully, but these errors were encountered: