tiny code cleanup

This commit is contained in:
2026-03-07 08:43:54 +11:00
parent 7aa331c6d4
commit b19ad3ce82
3 changed files with 25 additions and 34 deletions

17
relay/lora_handler.py Normal file
View File

@@ -0,0 +1,17 @@
class LoRaHandler:
def __init__(self):
print("Initializing LoRa...")
# initialize our radio, im using the HAT SX1262 hat for the pico
self.radio = SX1262(spi_bus=1, clk=10, mosi=11, miso=12, cs=3, irq=20, rst=15, gpio=2)
self.radio.begin(freq=915, bw=125, power=22)
self.radio.setBlockingCallback(False, self.irq)
def irq(self, events):
print(f"LORA EVENT: {events}")
if events & SX1262.RX_DONE:
msg, err = sx.recv()
error = SX1262.STATUS[err]
print('Receive: {}, {}'.format(msg, error))
elif events & SX1262.TX_DONE:
print('TX done.')