]> vault307.fbx.one Git - micorpython_ir.git/commitdiff
Update IR_TX Samsung32 Address Format
authorCyril Christin <55538276+cyrilchristin@users.noreply.github.com>
Wed, 28 Sep 2022 08:30:56 +0000 (10:30 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Sep 2022 08:30:56 +0000 (10:30 +0200)
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

index 807ec68abb220eeead32a1d98cf0b638000308b7..be9ee28ef7b898534ff3f5a0a0618f61df376827 100644 (file)
@@ -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