diff --git a/lib/sqnsupgrade/README.md b/lib/sqnsupgrade/README.md index 7646d50..e6ec433 100644 --- a/lib/sqnsupgrade/README.md +++ b/lib/sqnsupgrade/README.md @@ -12,7 +12,7 @@ Please start with the following steps: 1. Upgrade the Pycom Firmware Updater tool to latest version 2. Select Firmware Type `stable` in the communication window to upgrade to latest stable version -You can find the different versions of firmwares available here: http://software.pycom.io/downloads/sequans2.html​ +You can find the different versions of firmwares available here: http://software.pycom.io/downloads/sequans2.html These files are password protected, to download them you should be a forum.pycom.io member and access to: Announcements & News --> Announcements only for members --> Firmware Files for Sequans LTE modem now are secured, or clicking Here diff --git a/pymesh/pymesh_frozen/lib/pymesh_config.py b/pymesh/pymesh_frozen/lib/pymesh_config.py index 798f8f8..74a0292 100644 --- a/pymesh/pymesh_frozen/lib/pymesh_config.py +++ b/pymesh/pymesh_frozen/lib/pymesh_config.py @@ -5,7 +5,6 @@ see the Pycom Licence v1.0 document supplied with this file, or available at https://www.pycom.io/opensource/licensing ''' -import ubinascii import json from network import LoRa @@ -78,10 +77,7 @@ def write_config(pymesh_config, force_restart = False): time.sleep(1) machine.deepsleep(1000) - def check_mac(pymesh_config): - lora = LoRa(mode=LoRa.LORA, region= LoRa.EU868) - MAC = int(str(ubinascii.hexlify(lora.mac()))[2:-1], 16) - + def check_mac(pymesh_config, MAC): if pymesh_config.get('MAC') is None: # if MAC config unspecified, set it to LoRa MAC print_debug(3, "Set MAC in config file as " + str(MAC)) @@ -102,7 +98,7 @@ def check_mac(pymesh_config): print_debug(3, "MAC ok" + str(MAC)) - def read_config(): + def read_config(MAC): file = PymeshConfig.CONFIG_FILENAME pymesh_config = {} error_file = True @@ -138,10 +134,10 @@ def read_config(): pymesh_config['br_ena'] = PymeshConfig.BR_ENABLE pymesh_config['br_prio'] = PymeshConfig.BR_PRIORITY - PymeshConfig.check_mac(pymesh_config) + PymeshConfig.check_mac(pymesh_config, MAC) print_debug(3, "Default settings:" + str(pymesh_config)) PymeshConfig.write_config(pymesh_config, True) - PymeshConfig.check_mac(pymesh_config) + PymeshConfig.check_mac(pymesh_config, MAC) print_debug(3, "Settings:" + str(pymesh_config)) return pymesh_config diff --git a/pymesh/pymesh_frozen/lorawan/main.py b/pymesh/pymesh_frozen/lorawan/main.py index 223cee6..33f33da 100644 --- a/pymesh/pymesh_frozen/lorawan/main.py +++ b/pymesh/pymesh_frozen/lorawan/main.py @@ -1,5 +1,7 @@ -import pycom import time +import ubinascii +import pycom +from network import LoRa try: from pymesh_config import PymeshConfig @@ -28,8 +30,11 @@ def new_message_cb(rcv_ip, rcv_port, rcv_data): pycom.heartbeat(False) +lora = LoRa(mode=LoRa.LORA, region= LoRa.EU868) +lora_mac = int(str(ubinascii.hexlify(lora.mac()))[2:-1], 16) + # read config file, or set default values -pymesh_config = PymeshConfig.read_config() +pymesh_config = PymeshConfig.read_config(lora_mac) #initialize Pymesh pymesh = Pymesh(pymesh_config, new_message_cb) diff --git a/pymesh/pymesh_frozen/main.py b/pymesh/pymesh_frozen/main.py index 4cf6fbd..5d7c17a 100644 --- a/pymesh/pymesh_frozen/main.py +++ b/pymesh/pymesh_frozen/main.py @@ -1,5 +1,7 @@ -import pycom import time +import ubinascii +import pycom +from network import LoRa try: from pymesh_config import PymeshConfig @@ -28,8 +30,11 @@ def new_message_cb(rcv_ip, rcv_port, rcv_data): pycom.heartbeat(False) +lora = LoRa(mode=LoRa.LORA, region= LoRa.EU868) +lora_mac = int(str(ubinascii.hexlify(lora.mac()))[2:-1], 16) + # read config file, or set default values -pymesh_config = PymeshConfig.read_config() +pymesh_config = PymeshConfig.read_config(lora_mac) #initialize Pymesh pymesh = Pymesh(pymesh_config, new_message_cb) diff --git a/pymesh/pymesh_frozen/main_BR.py b/pymesh/pymesh_frozen/main_BR.py index 3c53257..fdb9780 100644 --- a/pymesh/pymesh_frozen/main_BR.py +++ b/pymesh/pymesh_frozen/main_BR.py @@ -1,5 +1,7 @@ import time +import ubinascii import pycom +from network import LoRa # 2 = test pybytes OTA feature # 4 = added device_id (pybytes token) in the packets to BR @@ -66,8 +68,11 @@ def new_br_message_cb(rcv_ip, rcv_port, rcv_data, dest_ip, dest_port): pycom.heartbeat(False) +lora = LoRa(mode=LoRa.LORA, region= LoRa.EU868) +lora_mac = int(str(ubinascii.hexlify(lora.mac()))[2:-1], 16) + # read config file, or set default values -pymesh_config = PymeshConfig.read_config() +pymesh_config = PymeshConfig.read_config(lora_mac) #initialize Pymesh pymesh = Pymesh(pymesh_config, new_message_cb) diff --git a/pymesh/readme.md b/pymesh/readme.md new file mode 100644 index 0000000..0be1a7a --- /dev/null +++ b/pymesh/readme.md @@ -0,0 +1,3 @@ +# For reference only + +This library is the open-source part of the Pymesh LoRa Firmware which can be provisioned through Pybytes and cannot be used as stand-alone on a Pybytes or Pygate type firmware. Please check the [Pycom Documentation](https://docs.pycom.io/pybytes/pymeshintegration/provisioning/) on how to get Pymesh type firmware provisioned to your device. You will not have to use this library in your project or flash it to your device separately, as it is already included in the firmware. diff --git a/shields/lib/MFRC630.py b/shields/lib/MFRC630.py index 574bc40..0d6c2f2 100644 --- a/shields/lib/MFRC630.py +++ b/shields/lib/MFRC630.py @@ -370,7 +370,7 @@ def mfrc630_MF_read_block(self, block_address, dest): buffer_length = self.mfrc630_fifo_length() rx_len = buffer_length if (buffer_length <= 16) else 16 dest = self.mfrc630_read_fifo(rx_len) - return rx_len + return dest def mfrc630_iso14443a_WUPA_REQA(self, instruction): diff --git a/shields/pysense_2.py b/shields/pysense_2.py index 4edcd95..ff793e7 100644 --- a/shields/pysense_2.py +++ b/shields/pysense_2.py @@ -48,7 +48,7 @@ lt = LTR329ALS01(py) -print("Light (channel Blue, channel Red): " + str(lt.light()," Lux: ", str(lt.lux()), "lx")) +print("Light (channel Blue, channel Red): " + str(lt.light())," Lux: ", str(lt.lux()), "lx") li = LIS2HH12(py) print("Acceleration: " + str(li.acceleration())) @@ -69,4 +69,4 @@ pybytes.send_signal(3, lt.light()) pybytes.send_signal(4, li.acceleration()) pybytes.send_battery_level(int(battery_percentage)) - print("Sent data to pybytes") \ No newline at end of file + print("Sent data to pybytes")