From 4c56aa36751cb8981dd6512315ff9d3761cc3a14 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 21 Oct 2019 10:09:58 -0400 Subject: [PATCH 1/2] remove version and method check in aws_iot, move to examples instead --- adafruit_aws_iot.py | 6 ------ examples/aws_iot_shadows.py | 4 ++++ examples/aws_iot_simpletest.py | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/adafruit_aws_iot.py b/adafruit_aws_iot.py index f8fa392..861abb5 100644 --- a/adafruit_aws_iot.py +++ b/adafruit_aws_iot.py @@ -66,9 +66,6 @@ def __init__(self, mmqttclient, keep_alive=30): else: raise TypeError("This class requires a preconfigured MiniMQTT object, \ please create one.") - # Verify nina-fw => 1.4.0 - fw_semver_maj = bytes(self.client.wifi.esp.firmware_version).decode("utf-8")[2] - assert int(fw_semver_maj) >= 4, "Please update nina-fw to 1.4.0 or above." # Verify MiniMQTT client object configuration try: self.cid = self.client.client_id @@ -78,9 +75,6 @@ def __init__(self, mmqttclient, keep_alive=30): as the Client ID.") # Shadow-interaction topic self.shadow_topic = "$aws/things/{}/shadow".format(self.cid) - # Ensure set_certificate and set_private_key were run from ESP32SPI - assert self.client.wifi.esp.set_psk and self.client.wifi.esp.set_crt, "Certificate \ - and private key must be set to your AWS Device Cert and Private Key." # keep_alive timer must be between 30 <= keep alive interval <= 1200 seconds # https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html assert 30 <= keep_alive <= 1200, "Keep_Alive timer \ diff --git a/examples/aws_iot_shadows.py b/examples/aws_iot_shadows.py index 12069ea..5267e5d 100644 --- a/examples/aws_iot_shadows.py +++ b/examples/aws_iot_shadows.py @@ -46,6 +46,10 @@ spi = busio.SPI(board.SCK, board.MOSI, board.MISO) esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) + +# Verify nina-fw version >= 1.4.0 +assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0." + """Use below for Most Boards""" status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" diff --git a/examples/aws_iot_simpletest.py b/examples/aws_iot_simpletest.py index 09d41a4..13bcb23 100644 --- a/examples/aws_iot_simpletest.py +++ b/examples/aws_iot_simpletest.py @@ -46,6 +46,10 @@ spi = busio.SPI(board.SCK, board.MOSI, board.MISO) esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset) + +# Verify nina-fw version >= 1.4.0 +assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0." + """Use below for Most Boards""" status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards """Uncomment below for ItsyBitsy M4""" From 3a1d49420153d89255cd7a7b3d85ff22cd82c7d5 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 21 Oct 2019 10:13:51 -0400 Subject: [PATCH 2/2] fix pointless string statement --- examples/aws_iot_shadows.py | 4 ++-- examples/aws_iot_simpletest.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/aws_iot_shadows.py b/examples/aws_iot_shadows.py index 5267e5d..7690f67 100644 --- a/examples/aws_iot_shadows.py +++ b/examples/aws_iot_shadows.py @@ -50,9 +50,9 @@ # Verify nina-fw version >= 1.4.0 assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0." -"""Use below for Most Boards""" +# Use below for Most Boards status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards -"""Uncomment below for ItsyBitsy M4""" +# Uncomment below for ItsyBitsy M4 # status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) # Uncomment below for an externally defined RGB LED # import adafruit_rgbled diff --git a/examples/aws_iot_simpletest.py b/examples/aws_iot_simpletest.py index 13bcb23..3d7dd67 100644 --- a/examples/aws_iot_simpletest.py +++ b/examples/aws_iot_simpletest.py @@ -50,9 +50,9 @@ # Verify nina-fw version >= 1.4.0 assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0." -"""Use below for Most Boards""" +# Use below for Most Boards status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards -"""Uncomment below for ItsyBitsy M4""" +# Uncomment below for ItsyBitsy M4 # status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2) # Uncomment below for an externally defined RGB LED # import adafruit_rgbled