Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Adafruit PlatformDetect version #54

Merged
merged 1 commit into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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