up ir rx callback

This commit is contained in:
Tomas Krejci 2024-05-29 13:40:59 +02:00
parent 53c256556b
commit a4c6cea3ef

18
main.py
View File

@ -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()