How can I convert from uint16_t rawData to uint8_t state? #1885
-
I'm trying to develop a custom component for esphome. The data from esphome are in the same format that IRrecvDumpV2 print out as IRremoteESP8266/src/ir_Fujitsu.h Line 212 in 726b219 uint8_t state (I think).How I can convert the data? (I tried to search how it's done in the source code but I can't figured out) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
There is no direct method to convert a "RAW" message representation into a It does this by simulating sending the raw data, and capturing it, and then decoding it. With a little bit more data massaging, you could directly call the specific decode you want. e.g. I'd strongly suggest against using "RAW" data format if you can avoid it. It's long, huge, and as you're finding out, needs to be decoded if you want to do anything with it. |
Beta Was this translation helpful? Give feedback.
There is no direct method to convert a "RAW" message representation into a
state[]
for a given protocol.You can have a look at code that does this in the tools directory. i.e. gc_decode.cpp
It does this by simulating sending the raw data, and capturing it, and then decoding it.
i.e. it prepares all the data the way
IRrecv::decode()
expects, and thendecode()
does the rest, and provides thestate[]
array in the result.With a little bit more data massaging, you could directly call the specific decode you want. e.g.
IRrecv::decodeFujitsuAC()
I'd strongly suggest against using "RAW" data format if you can avoid it. It's long, huge, and as you're finding out, needs to be decoded if you want …