Skip to content

Commit cbbb47e

Browse files
authored
Merge pull request #4 from brentru/version-check-code
Check nina-fw version in code
2 parents 35a4857 + 3a1d494 commit cbbb47e

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

adafruit_aws_iot.py

-6
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ def __init__(self, mmqttclient, keep_alive=30):
6666
else:
6767
raise TypeError("This class requires a preconfigured MiniMQTT object, \
6868
please create one.")
69-
# Verify nina-fw => 1.4.0
70-
fw_semver_maj = bytes(self.client.wifi.esp.firmware_version).decode("utf-8")[2]
71-
assert int(fw_semver_maj) >= 4, "Please update nina-fw to 1.4.0 or above."
7269
# Verify MiniMQTT client object configuration
7370
try:
7471
self.cid = self.client.client_id
@@ -78,9 +75,6 @@ def __init__(self, mmqttclient, keep_alive=30):
7875
as the Client ID.")
7976
# Shadow-interaction topic
8077
self.shadow_topic = "$aws/things/{}/shadow".format(self.cid)
81-
# Ensure set_certificate and set_private_key were run from ESP32SPI
82-
assert self.client.wifi.esp.set_psk and self.client.wifi.esp.set_crt, "Certificate \
83-
and private key must be set to your AWS Device Cert and Private Key."
8478
# keep_alive timer must be between 30 <= keep alive interval <= 1200 seconds
8579
# https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html
8680
assert 30 <= keep_alive <= 1200, "Keep_Alive timer \

examples/aws_iot_shadows.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@
4646

4747
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
4848
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
49-
"""Use below for Most Boards"""
49+
50+
# Verify nina-fw version >= 1.4.0
51+
assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0."
52+
53+
# Use below for Most Boards
5054
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
51-
"""Uncomment below for ItsyBitsy M4"""
55+
# Uncomment below for ItsyBitsy M4
5256
# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
5357
# Uncomment below for an externally defined RGB LED
5458
# import adafruit_rgbled

examples/aws_iot_simpletest.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@
4646

4747
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
4848
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
49-
"""Use below for Most Boards"""
49+
50+
# Verify nina-fw version >= 1.4.0
51+
assert int(bytes(esp.firmware_version).decode("utf-8")[2]) >= 4, "Please update nina-fw to >=1.4.0."
52+
53+
# Use below for Most Boards
5054
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
51-
"""Uncomment below for ItsyBitsy M4"""
55+
# Uncomment below for ItsyBitsy M4
5256
# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
5357
# Uncomment below for an externally defined RGB LED
5458
# import adafruit_rgbled

0 commit comments

Comments
 (0)