-
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
Question . Generic protocol decode #406
Comments
Good question. At quick glance, https://github.com/markszabo/IRremoteESP8266/blob/master/src/ir_Nikai.cpp is probably a good place to start/copy from. You don't need to do the TICK stuff, that's just to try to auto-calibrate the decode signal. It's a bonus thing, not a requirement. The 4d8f74e commit which introduced it is a good "example" of what needs to be changed etc in other parts of the library. Obviously, the testing stuff is not required, but I do recommend it. It really helps me when I'm debugging & developing stuff for a new protocol. Also, for the LARGE banner text, I use: http://asciiset.com/figletserver.html with the "letters" font. ;-) Hope that helps. |
thanks for the hints , I'm on the way to add my mpx_decode : , the define is MPX_DECODE and this class of errors that i don't know how to solve because they have no line numbers , etc . for example so , my question is , how should i organize the files , to be able to modify and make use of the library , without rearranging all the files .? just to help on what I'm trying to accomplish and may help for clarity , this is the signal to decode are 16 bits , starting with a space 1400 us , a zero = 1400 us mark and 2800 us space in this case , the code is : 1100 1001 0010 1011 (C92B) |
I'll try to clone your repository and see if I can work out what is going on. Those errors are typically something failing in the linking phase. Something likely didn't get compiled and/or referenced correctly. That is the linker doesn't seem to be able to find the IRrecv object definitions/code etc. Going by the error messages, I'm assuming you are using PlatformIO. That's not a problem. I'm just basing my answers/assumptions around that. Oh, given you've got nice round numbers for the marks/spaces etc at present, I'd suggest using a tick size of 100 instead of 1, and reduce accordingly etc. |
Oh, another massive tip. You are MUCH better off doing this as a branch in your existing fork of IRremoteESP8266. This will save you a heap of effort when it comes to merging the code back upstream as well as any other updates from the upstream library down to yours. You can do this by:
That will maintain all the change/commit history and allow you to do a simple See https://help.github.com/articles/configuring-a-remote-for-a-fork/ & https://help.github.com/articles/syncing-a-fork/ |
Here is a
You should be able to apply the patch using: |
i have corrected the differences , but on a separate repo installing all the relevant files in one directory , but still errors
i don't get the error, by looking at the function on IRrecv.cpp and .h , it seams ok . |
Answering some of your questions. i.e.
Use/modify the following lines in the
for example examples/IRrecvDumpV2/platformio.ini:
Tells PlatformIO to search for the libraries it needs (e.g. IRremoteESP8266) in the lib_extra_dirs "../../" directory which is two directories up from where the file is. ".." means the parent directory. |
re:
|
Apologies. You have updated github. My bad. You didn't include the changes from the patch file for |
getting better , but not there yet this is the error i have now test/IRsend_test.cpp:5:25: fatal error: gtest/gtest.h: No such file or directory |
yes, i was working with two file sets at the same time, one for the example only, and one with the complete library , so some of your finding were included on the other ... |
yes this line is on irrecv.h , but still getting the error
|
re:
Try:
You only need to worry about gtest etc if you want to run the unit test suite under If you are getting it in "PlatformIO" when editing/saving the file(s) it's safe to ignore. I can't seem work out how to get it to ignore/fix that issue. It doesn't affect the unit tests or the rest of the library/code etc. It's a PlatformIO-only issue as far as I can tell. As for your |
Yes I’m using platformio, I like it but is complicated to me understand what is doing some times . I have not used test , and I have not selected the option in platformio , those files were just included on the compile list , but no idea why . And for the error , yes I have included all fixes , but still same error , for sure I’m still missing something , probably send mpx but the error is on the recev... |
I hear you, platformio is very complicated. I only understand about 10% of it, and have to google a lot to work it out. I find it a lot more powerful than the Arduino IDE, and makes life easier maintaining this large library. I too, have no idea why it (platformio) is trying to compile the unit test files. I've never tried to use them with platformio. I just edit them with platformio. In theory it's possible etc. As for your error(s), I re-cloned and put the latest mpx_testing branch into my platformio config, and here are the minimum required changes I needed to do to get it to successfully compile and link a firmware for IRrecvDumpV2.ino
|
i can't make it to compile,
|
I've said this multiple times previously in the patches I've suggested.
You need to change the line it is referring to from "decodeMpx" to
"decodeMPX"
…On Wed., 31 Jan. 2018, 8:43 am gus, ***@***.***> wrote:
i can't make it to compile,
still with this error , and with no ideas on what else to try ...
src/IRrecv.cpp: In member function 'bool IRrecv::decode(decode_results*,
irparams_t*)':
src/IRrecv.cpp:274:44: error: 'decodeMpx' was not declared in this scope
if (decodeMpx(results,MPX_BITS, false))
^
*** [.pioenvs/nodemcuv2/lib851/src/IRrecv.o] Error 1
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#406 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMInDGQD84imQvDH5rhNSF6dPPE-PKW3ks5tP5sfgaJpZM4RwCBI>
.
|
men, i will need to change my glasses , or pay more attention , haven't realized the caps difference , |
DAvid , it is working now . first question , is about header : In this case i don't have a defined "header" , it is just a long mark between each data , as the data begins on the first high to low edge , then this first space ( 1400 us) detection is what indicates the "frame" beginning .
|
this is what I'm getting as raw timing so far
i think i need to fix those , very short pulses ( two digits) , and it will detect the 16 bits ( 32 timings) the rest looks fine .. |
i think the problem may be on the m_tick calculation as my header is not the way the original decode is looking for, will try making m_tick = s_tick .. |
is not detecting the signal in compliance with the MPX decode definition , so i may have something wrong there .. |
That raw data doesn't seem to marry up to what you showed on your oscilloscope earlier. i.e. There appears to be 17 pulses on that image, which should equate to ~33 entries in a raw capture. Just to be sure, if you are capturing that "raw" signal with a clean copy of the library (or an arduino etc) then I'd strongly suspect that the modulation frequency the remote is transmitting at is incompatible with the modulation freq of the IR detector module. In short, in my experience, if a raw capture has values in the teens, then it's a bad capture. Something is wrong. If it happens frequently (i.e. in most captures etc) and you have the remote about 1+ meter away, it's probably a frequency mis-match problem. Try a different frequency IR module. As you have access to an oscilloscope, you should be able to work out what that freq is if you measure the voltage/current etc across the transmitting IR LED in the remote. i.e. Calculate the period of each modulation during a "mark" signal. |
David, probably i wasn't clear enough on my initial post , the signal i posted "is not" the result of any IR protocol , it is just plain direct electrical signal going to the Node mcc Pin D2 . The shape of the signal is exactly what i showed , and yes the results I'm getting are far from being equal to the the received signal . so those sort pulses do not exists on the signal, they are introduced by the decoder , but at present i was unable for the MPX decode to recognize the signal, so it is being decoded as the "unknown" , and then it is very different from the real one . i need to find the proper combination of parameters , for the irRecv recognize the protocol ( my signal has no header , and the footer is just a regular space ) ... makes sense? |
I'm trying to make this parallelism with an IR code : |
I get what you are saying about how the protocol works. I've seen similar protocols. I am however, confused in a lot of other areas with what you are saying. To get myself on the same page as toy, I have a bunch of questions I'd like you to answer if you can. I'll explain why I'm asking after them. If you could answer them all, that'd be great.
Looking at your oscilloscope output and your description, it seems that what ever circuit you are using, it sounds like the module/connection to the ESP's GPIO is being dragged LOW when it's detecting a pulse (mark) and HIGH when its detecting nothing (space/gap/idle). If that is the case, the library is not designed to really operate under that condition. It's expecting the opposite. It may work. It may not, I don't know. I haven't tested it in that situation. I think it could be part of your problem. Every IR receiver I've come across so far creates a HIGH signal when it detects something, and LOW the rest of the time. If I understand what you are saying, your circuit/module seems to be behaving opposite to what's expected. I'd also like to eliminate any of your changes/tinkering with the library to make sure, mainly due to your comments/feedback. The changes I think you've made should NOT change the "raw" output, but I just want to rule it out. Now, answering some of your other question(s): You don't need to match a header if there is none. There are other protocols that don't have a header, but it sounds like from what you described earlier it does have a header. I can't really comment until I can see a clean raw dump from something we can trust. If I can see a clean capture, I can tell with a lot more certainty what the protocol looks like from the library's perspective. There are other equal total data bit time protocols supported by the library, so what you are trying to do isn't something totally new. You should be able to get rid of all the TICK stuff if you want, just use the totals. i.e. Don't use the s_tick & m_tick stuff. Just the final values, not the dynamic/calculated ones. e.g. just MPX_HDR_MARK, MPX_ZERO_SPACE, etc...
Can you explain in gory detail what you mean here? |
thank you for your comments . will try to bring more detail : the signal do not come from IR , it comes directly from my alarm system digital data bus . I'm quite close to have the decoder working Raw Timing[33]:
|
what haven't made myself clear is why I'm using your library for this purpose ( non IR decoding) ?? |
the yellow are the raw timings for the 16 bits low and high states in between tho long high time ( just middle between frames) ,and then the last low space before idle |
I think i found the problem : match_result_t IRrecv::matchData( else if (onespace == zerospace) { // Is this mark encoded data format? and in this protocol non of them matches , it is the type of mark1+space1 = mark0+space0 i was expecting to concentrate the peculiarities of the protocol inside decodeMpx , but it not be enough ... |
will include a special match data function inside decodeMpx |
* Give up on specific cpu-time optimised for matching data to save on overall code space/usage. * Improves readablity & simplicty of the function. * Now supports two more protocol types. More generic now. e.g. equal total data bit time, and arbitary mark/space timing for bit values. * Unit tests to cover those cases & supported protocol types. Ref #406
@gnkarn I had forgotten about some optimisations I had put in |
thank you , i will try that ! |
i understood your mod, and it looks good , better than mine . my last modification throws a decode , that is "almost right" , but instead of signing the 1 or zero , by looking at the mark , it is decoding by looking at the space ( even when in the code of course that is not the intention). then the output , is for example
uint16_t rawData[33] = {1580, 2994, 1588, 2992, 1594, 1454, 3128, 1462, 3132, 2982, 1586, 2994, 1594, THE RawData is OK may be i have some "offset" problem on top of everything ? i will look into it with more fresh head tomorrow , 1AM here now , tks |
I concur. The data looks like it shifted over one slot. First comment out: Try that, first. Then I'd suggest tweaking this line: OFFSET_START is usually 1. So try values of You might want to comment out the |
* Give up on specific cpu-time optimised for matching data to save on overall code space/usage. * Improves readablity & simplicty of the function. * Now supports two more protocol types. More generic now. e.g. equal total data bit time, and arbitary mark/space timing for bit values. * Unit tests to cover those cases & supported protocol types. Ref #406
Friendly ping. How are you going on this? Any progress? |
Very well , almost there , I already have a working version included on my tasmota fork , will add here the link later . Still need to complete some checks , and of course lots of cleanup and some doc . |
Friendly ping. |
Have started to do some homework, https://github.com/gnkarn/Sonoff-Tasmota/wiki/Organization-del-codigo-para-decodificador-MPX Will get there , ASAP ( before I forget ...) .. |
How is it going? |
Marking this closed for now, due to inactivity. Feel free to reply/reopen etc. |
Hi David , me again now with different question , I need to decode an alarm system protocol , I already have this mapped so I do know how it works , and I’m considering to use the library to decode it .
It is 16 bits with a mark space code very similar to the NEC , a bit one is aprox 3000 us mark and a bit zero is aprox 1400 us mark.
My question what is the best example and decode function in your opinion that i could base my modifications ( if needed as I see the functions are very flexible ) ,
Thanks in advance
Gus
The text was updated successfully, but these errors were encountered: