raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.61k stars 778 forks source link

ir_nec variable length commands #492

Closed omr-htp closed 2 months ago

omr-htp commented 2 months ago

Regarding ir_nec example. How to send a variable-length command. My AC. for example, has 13 bytes command length. and it's NEC compatible (timing, leading mark and space...).

lurch commented 2 months ago

Pinging @mjcross who was the original author of that example.

mjcross commented 2 months ago

The NEC spec supported by the example (see here) is for a 67.5ms frame comprising:

'Repeat' bursts are also possible but do not contain any data.

Screenshot 2024-04-29 at 15 48 53

mjcross commented 2 months ago

Please bear in mind that these are examples of how to use the PIO, not production code.

It's seems unlikely that your AC requires a 13 byte command length. If you want to investigate the codes sent by your remote, consider modifying your local copy of pio/ir_nec/ir_loopback/ir_loopback.c to comment out the transmit code and display the binary value of rx_frame.

mjcross commented 2 months ago

@omr-htp my original repository https://github.com/mjcross/rpi-pico-nec-ir-transmit-pio (older, and no longer actively maintained) has a little more information on how to use the PIO driver to transmit NEC extended and raw frames.

However you can achieve the same thing by just manually constructing the bits in tx_frame; and the driver always sends exactly 32 bits (including address and command).

omr-htp commented 2 months ago

@mjcross thanks for your reply. I'm using LIRC at raspberry pi to get codes from IR remotes (.NET core app).

when using a standard NEC remote, I got 67 Pulse Space Durations or (Units) starting with 16, 8 then 1 or 3 as you know, by using my AC. remote, I got 211 units contains same leading and bits (16,8,1,3.........) but longer.

by the way I did transmit commands using GPIO (I can share if it helps), but sometimes a timing issue appears. so, I have to use PIO which I didn't use at all.

the tx_frameat the old repo is 32 bits too as I understand.

Thanks.

mjcross commented 2 months ago

@omr-htp good luck with your investigations. @lurch this doesn't seem like an issue with the library. Close?

omr-htp commented 2 months ago

It's not an issue. I think we can tag it as a request

lurch commented 2 months ago

I don't have commit-perms on this repo, but I think @peterharperuk does :slightly_smiling_face: