Changing LoRa parameters - Is necessary to restart device?
-
Hi all,
I'm working with lopy4 in raw LoRa mode. I've implemented methods to change the radio settings (SF, CR, BW, among others) and store the configuration in a JSON file. The fact is that those changes are not visible after I reset both node and gateway (My code is based on LoRa-MAC Nano-Gateway). Is that correct? invoking the method lora.sf([sf]) for example does not make any changes.
Here is my method implementation:def changeLoraSettings(self, lora_conf): # print('Changing LoRa configuration...') [lora_bw, lora_cr] = self.parseData(lora_conf) self.lora.frequency(lora_conf['frequency']) self.lora.tx_power(lora_conf['tx_power']) self.lora.bandwidth(lora_bw) self.lora.sf(lora_conf['sf']) self.lora.preamble(lora_conf['preamble']) self.lora.coding_rate(lora_cr) # print('done') def parseData(self, lora_conf): if(lora_conf['bandwidth'] == '125 KHZ'): lora_bw = LoRa.BW_125KHZ elif(lora_conf['bandwidth'] == '250 KHZ'): lora_bw = LoRa.BW_250KHZ elif(lora_conf['bandwidth'] == '500 KHZ'): lora_bw = LoRa.BW_500KHZ if(lora_conf['coding_rate'] == '4/5'): lora_cr = LoRa.CODING_4_5 if(lora_conf['coding_rate'] == '4/6'): lora_cr = LoRa.CODING_4_6 if(lora_conf['coding_rate'] == '4/7'): lora_cr = LoRa.CODING_4_7 if(lora_conf['coding_rate'] == '4/8'): lora_cr = LoRa.CODING_4_8 return [lora_bw, lora_cr]lora_conf is a dictionary which is stored as a JSON file:
def lora_default_config(): lora_conf = {} lora_conf['region'] = 'AU915' lora_conf['frequency'] = 915000000 lora_conf['tx_power'] = 20 lora_conf['bandwidth'] = '125 KHZ' lora_conf['sf'] = 7 lora_conf['preamble'] = 8 lora_conf['coding_rate'] = '4/5' lora_conf_encoded = ujson.dumps(lora_conf) with open("/flash/lora.json", 'w') as conf_file: conf_file.write(lora_conf_encoded) conf_file.close()I will provide any other information you shall need. Thanks in advance!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login