decode of advanced RC5 packets from Marantz remotes

Petre Rodan <[email protected]> Tue, 19 Mar 2024 10:11:32 +0200
Newsgroups gmane.comp.hardware.lirc
Message-ID <ZflItM8AYDEGTxT8@sunspire>
Hello!

I'm back to tinkering with this project after about 25 years.
this time I'd like to successfully decode the advanced RC5 codes generated by modern Marantz remote controls, which might require some slight additions to the lirc decoder sourcecode.

these remotes generate, based partly on the PM8006 Service Manual a packet that contains

  a sync pulse
  2 bit pre (a start bit and a toggle bit)
  5 bit system address
  3.5ms space
  6 bit command
  6 bit extension

  in order to support commands above 0x3f (there are 11 of these), if the start bit is 0 then command needs to be OR-ed with 1 << 6.

you can see the captured signal trace that lirc gets when pressing the '5' key here: https://pasteboard.co/BzF1kHFQwVqi.png
highlighted is the 3.5ms gap between the system addr and the command.

# KEY_5 decode
sync
start   1
toggle  0 or 1
system   11001 = 25
3.5ms mid-packet gap
cmd     000101 = 5
ext     000000 = 0

for the time being I have tweaked the get_pre() function to accept a configuration like
    name          RC001PMND
    bits          12
    flags         RC5|CONST_LENGTH
    pre_data_bits 7
    pre_data      0x59
    pre           0   3500
    toggle_bit_mask 0x20000
    [..]

so that the system address is part of pre and the mid-packet gap is defined by the 'pre' option, but I'm not sure this is the way.

maybe a better idea would be to add an extra configuration option, something like

gap_at_bit  8 3500

which would expect a 3.5ms space at bit 8. is this a better solution or do you see a more elegant alternative?
I do intend to contribute this code back into the project, so your feedback is more than welcome.

my very best regards,
peter