From a4c6cea3efa981e90ea6d8eadcd3298babab7efc Mon Sep 17 00:00:00 2001 From: Tomas Krejci Date: Wed, 29 May 2024 13:40:59 +0200 Subject: [PATCH] up ir rx callback --- main.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index b41fcf2..8de4514 100644 --- a/main.py +++ b/main.py @@ -145,10 +145,20 @@ async def olt_command(cmd, btn, rgb, ir_tx, tx1, tx2, tx3): # IR RX callback async def cb(byte1, byte2, byte3, packet): - print( - f"byte1 0x{byte1:02x} byte2 0x{byte2:02x} byte3 0x{byte3:02x} packet 0x{packet:06x}" - ) - uart.write(f"IR RX 0x{packet:06x}\n") + # logger.debug(f"{(packet & 0x800000):0X}") + if packet & 0x800000: + logger.debug("Command packet") + print( + f"byte1 0x{byte1:02x} byte2 0x{byte2:02x} byte3 0x{byte3:02x} packet 0x{packet:06x}" + ) + uart.write(f"IR RX Command 0x{packet:06x}\n") + else: + logger.debug("Shot packet") + print( + f"byte1 0x{byte1:02x} byte2 0x{byte2:02x} byte3 0x{byte3:02x} packet 0x{packet:06x}" + ) + uart.write(f"IR RX Shot 0x{packet:06x}\n") + await rgb1.set_blue() await asyncio.sleep_ms(200) await rgb1.set_red()