From d7ff5be7654ececde87be89f32a08986b5c3b5c7 Mon Sep 17 00:00:00 2001 From: Cyril Christin <55538276+cyrilchristin@users.noreply.github.com> Date: Wed, 28 Sep 2022 10:30:56 +0200 Subject: [PATCH] Update IR_TX Samsung32 Address Format Builds different [addr] formats for the NEC or Samsung32 protocol. - NEC: 8 address bits + 8 inverted address bits - Samsung32: 8 address bits + 8 address bits This is based on the logic found in the FlipperZero IR Samsung Encoder: https://github.com/flipperdevices/flipperzero-firmware/blob/052237f8c9bb34bc244abcbf108cdf1ec6ec58ec/lib/infrared/encoder_decoder/samsung/infrared_encoder_samsung.c#L27-L31 --- ir_tx/nec.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ir_tx/nec.py b/ir_tx/nec.py index 807ec68..be9ee28 100644 --- a/ir_tx/nec.py +++ b/ir_tx/nec.py @@ -27,7 +27,10 @@ class NEC(IR): else: self.append(9000, 4500) if addr < 256: # Short address: append complement - addr |= ((addr ^ 0xff) << 8) + if self.samsung: + addr |= addr << 8 + else: + addr |= ((addr ^ 0xff) << 8) for _ in range(16): self._bit(addr & 1) addr >>= 1 -- 2.47.3