Skip to content

Commit ecb6eaa

Browse files
committed
Check for compatible fw version.
1 parent a0a7c70 commit ecb6eaa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,10 @@ def set_digital_read(self, pin):
792792
793793
:param int pin: ESP32 GPIO pin to read from.
794794
"""
795+
# Verify nina-fw => 1.5.0
796+
fw_semver_maj = bytes(self.firmware_version).decode("utf-8")[2]
797+
assert int(fw_semver_maj) >= 5, "Please update nina-fw to 1.5.0 or above."
798+
795799
resp = self._send_command_get_response(_SET_DIGITAL_READ_CMD,
796800
((pin,),))[0]
797801
if resp[0] == 0:
@@ -808,6 +812,10 @@ def set_analog_read(self, pin, atten=ADC_ATTEN_DB_11):
808812
:param int pin: ESP32 GPIO pin to read from.
809813
:param int atten: attenuation constant
810814
"""
815+
# Verify nina-fw => 1.5.0
816+
fw_semver_maj = bytes(self.firmware_version).decode("utf-8")[2]
817+
assert int(fw_semver_maj) >= 5, "Please update nina-fw to 1.5.0 or above."
818+
811819
resp = self._send_command_get_response(_SET_ANALOG_READ_CMD,
812820
((pin,), (atten,)))
813821
resp_analog = struct.unpack('<i', resp[0])

0 commit comments

Comments
 (0)