use correct band

This commit is contained in:
Alessandro Mauri 2026-09-20 12:15:56 +02:00
parent 84f9619f8c
commit 43dffd6884

View File

@ -424,24 +424,24 @@ def main():
print("LoRa module started") print("LoRa module started")
print("Setting LoRa paramters") print("Setting LoRa paramters")
band = "BAND_O" band = "BAND_L"
spreading_factor = 7 spreading_factor = 7
coding_rate = 5 coding_rate = 5
LoRa.setDio2RfSwitch(True) LoRa.setDio2RfSwitch(True)
LoRa.setModem(SX126x.LORA_MODEM) LoRa.setModem(SX126x.LORA_MODEM)
LoRa.setFrequency(int(EU868_BANDS[band].freq_start_mhz*1_000_000 + EU868_BANDS[band].ch_bw_khz*1000/2)) LoRa.setFrequency(int(EU868_BANDS[band].freq_start_mhz*1_000_000 + EU868_BANDS[band].ch_bw_khz*1000/2))
LoRa.setBandwidth(EU868_BANDS[band].ch_bw_khz*1000) #LoRa.setBandwidth(EU868_BANDS[band].ch_bw_khz*1000)
LoRa.setLoRaModulation(spreading_factor,EU868_BANDS[band].ch_bw_khz*1000, coding_rate, False)
LoRa.setTxPower(10, LoRa.TX_POWER_SX1262) LoRa.setTxPower(10, LoRa.TX_POWER_SX1262)
LoRa.setRxGain(LoRa.RX_GAIN_BOOSTED) LoRa.setRxGain(LoRa.RX_GAIN_BOOSTED)
LoRa.setLoRaModulation(spreading_factor,EU868_BANDS[band].ch_bw_khz*1000, coding_rate, False)
LoRa.setHeaderType(LoRa.HEADER_EXPLICIT) LoRa.setHeaderType(LoRa.HEADER_EXPLICIT)
print("LoRa parameters set") print("LoRa parameters set")
state_machine = LoRaGSStateMachine(LORA_GS_ID, LORA_FC_ID) state_machine = LoRaGSStateMachine(LORA_GS_ID, LORA_FC_ID)
while True: while True:
state = state_machine.step() state = state_machine.step()
print(f"State: {state}") print(f"State: {state.name}")
time.sleep(0.001) time.sleep(0.001)
LoRa.end() LoRa.end()