Skip to content

Commit

Permalink
update adafruit platformdetect version
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyIvan359 committed Oct 4, 2020
1 parent 2866e97 commit a318185
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ automation setup much in order to interface with this version of MQTTany.
The needed modifications are now available upstream in version 1.4.5.
* **LED** - Move the `fps` option from module config to array config allowing per-array
FPS setting. This is now published when the array is setup also.
* Updated Adafruit Platform Detect version from 1.x to 2.x.

* **Fixed**
* Remove requirements file for old MCP230xx module that was removed in v0.10.0.
Expand Down
10 changes: 5 additions & 5 deletions mqttany/modules/gpio/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

try:
import adafruit_platformdetect
import adafruit_platformdetect.board as board
import adafruit_platformdetect.constants.boards as boards

detector = adafruit_platformdetect.Detector()
board_id = detector.board.id
Expand Down Expand Up @@ -70,10 +70,10 @@ def getGPIO(**kwargs):
gpio_mod = rpiGPIO(mode=CONFIG[CONF_KEY_MODE])

elif is_odroid_xu() or board_id in [
board.ODROID_C1,
board.ODROID_C1_PLUS,
board.ODROID_C2,
board.ODROID_N2,
boards.ODROID_C1,
boards.ODROID_C1_PLUS,
boards.ODROID_C2,
boards.ODROID_N2,
]:
if is_odroid_xu():
log.warn("Detected board Odroid XU3 or XU4 but cannot identify which!")
Expand Down
8 changes: 4 additions & 4 deletions mqttany/modules/gpio/lib/odroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ def is_odroid_xu4():


od_xu = is_odroid_xu3() or is_odroid_xu4()
od_c1 = board == adafruit_platformdetect.board.ODROID_C1
od_c1p = board == adafruit_platformdetect.board.ODROID_C1_PLUS
od_c2 = board == adafruit_platformdetect.board.ODROID_C2
od_n2 = board == adafruit_platformdetect.board.ODROID_N2
od_c1 = board == adafruit_platformdetect.constants.boards.ODROID_C1
od_c1p = board == adafruit_platformdetect.constants.boards.ODROID_C1_PLUS
od_c2 = board == adafruit_platformdetect.constants.boards.ODROID_C2
od_n2 = board == adafruit_platformdetect.constants.boards.ODROID_N2
MAX_GPIO = 0
if od_xu:
MAX_GPIO = len(PINS_XU)
Expand Down
4 changes: 2 additions & 2 deletions mqttany/modules/gpio/lib/rpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
board = detector.board.id
rpi_40 = detector.board.any_raspberry_pi_40_pin
rpi_26_r1 = detector.board.id in [
adafruit_platformdetect.board.RASPBERRY_PI_A,
adafruit_platformdetect.board.RASPBERRY_PI_B_REV1
adafruit_platformdetect.constants.boards.RASPBERRY_PI_A,
adafruit_platformdetect.constants.boards.RASPBERRY_PI_B_REV1
]
MAX_GPIO = 64
def gpioPinToGpio(pin):
Expand Down
34 changes: 17 additions & 17 deletions mqttany/modules/led/array/rpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def validateGPIO(
"""
try:
import adafruit_platformdetect
import adafruit_platformdetect.board as board
import adafruit_platformdetect.constants.boards as boards
except ImportError:
raise ImportError(
"MQTTany's LED module requires 'Adafruit-PlatformDetect' to be installed, "
Expand All @@ -331,30 +331,30 @@ def validateGPIO(
pin_ok = False

if array_config[CONF_KEY_RPI][CONF_KEY_GPIO] in [12, 18] and board_id in [
board.RASPBERRY_PI_B_PLUS,
board.RASPBERRY_PI_2B,
board.RASPBERRY_PI_3B,
board.RASPBERRY_PI_3B_PLUS,
boards.RASPBERRY_PI_B_PLUS,
boards.RASPBERRY_PI_2B,
boards.RASPBERRY_PI_3B,
boards.RASPBERRY_PI_3B_PLUS,
]:
pin_ok = True # PWM0

elif array_config[CONF_KEY_RPI][CONF_KEY_GPIO] in [13] and board_id in [
board.RASPBERRY_PI_B_PLUS,
board.RASPBERRY_PI_2B,
board.RASPBERRY_PI_3B,
board.RASPBERRY_PI_3B_PLUS,
board.RASPBERRY_PI_ZERO,
board.RASPBERRY_PI_ZERO_W,
boards.RASPBERRY_PI_B_PLUS,
boards.RASPBERRY_PI_2B,
boards.RASPBERRY_PI_3B,
boards.RASPBERRY_PI_3B_PLUS,
boards.RASPBERRY_PI_ZERO,
boards.RASPBERRY_PI_ZERO_W,
]:
pin_ok = True # PWM1

elif array_config[CONF_KEY_RPI][CONF_KEY_GPIO] in [21] and board_id in [
board.RASPBERRY_PI_B_PLUS,
board.RASPBERRY_PI_2B,
board.RASPBERRY_PI_3B,
board.RASPBERRY_PI_3B_PLUS,
board.RASPBERRY_PI_ZERO,
board.RASPBERRY_PI_ZERO_W,
boards.RASPBERRY_PI_B_PLUS,
boards.RASPBERRY_PI_2B,
boards.RASPBERRY_PI_3B,
boards.RASPBERRY_PI_3B_PLUS,
boards.RASPBERRY_PI_ZERO,
boards.RASPBERRY_PI_ZERO_W,
]:
pin_ok = True # PCM_DOUT

Expand Down
2 changes: 1 addition & 1 deletion requirements/gpio.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Adafruit-PlatformDetect>=1.3.4,<2.0
Adafruit-PlatformDetect>=2.17,<3.0
2 changes: 1 addition & 1 deletion requirements/led-rpi.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Adafruit-PlatformDetect>=1.3.4,<2.0
Adafruit-PlatformDetect>=2.17,<3.0
rpi-ws281x>=4.2.2,<5.0

0 comments on commit a318185

Please sign in to comment.