tryna get bluetooth to work

This commit is contained in:
2026-03-07 08:40:56 +11:00
parent 166819acce
commit 7aa331c6d4
2 changed files with 75 additions and 4 deletions

View File

@@ -2,6 +2,10 @@ from sx1262 import SX1262
from _sx126x import *
import time
from bluetooth_handler import BluetoothHandler
LORA_ENABLED = False
def cb(events):
if events & SX1262.RX_DONE:
@@ -11,7 +15,7 @@ def cb(events):
elif events & SX1262.TX_DONE:
print('TX done.')
def main():
def init_lora():
print("Creating class...")
# initialize our radio, im using the HAT SX1262 hat for the pico
radio = SX1262(spi_bus=1, clk=10, mosi=11, miso=12, cs=3, irq=20, rst=15, gpio=2)
@@ -23,9 +27,21 @@ def main():
radio.begin(freq=915, bw=125, power=22)
radio.setBlockingCallback(False, cb)
while True:
print(f"Noise Floor: {radio.getRSSIInst()}")
time.sleep(0.5)
def init_bluetooth():
bluetooth_handler = BluetoothHandler()
def main():
if LORA_ENABLED:
init_lora()
init_bluetooth()
if LORA_ENABLED:
while True:
print(f"Noise Floor: {radio.getRSSIInst()} | SNR: {radio.getSNR()}")
time.sleep(0.5)
if __name__ == "__main__":