From 63d222d2eee0b4faede6f431a5a644b410d1978f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 23 Sep 2019 23:48:26 +0200 Subject: [PATCH] Slot enum mapping fix --- platypush/plugins/gpio/sensor/motion/pwm3901.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platypush/plugins/gpio/sensor/motion/pwm3901.py b/platypush/plugins/gpio/sensor/motion/pwm3901.py index 5135eb4e..a38fdaef 100644 --- a/platypush/plugins/gpio/sensor/motion/pwm3901.py +++ b/platypush/plugins/gpio/sensor/motion/pwm3901.py @@ -16,7 +16,7 @@ class Rotation(enum.IntEnum): class SPISlot(enum.Enum): - FRONT = 'front', + FRONT = 'front' BACK = 'back' @@ -59,7 +59,10 @@ class GpioSensorMotionPwm3901Plugin(GpioSensorPlugin): if isinstance(spi_slot, str): spi_slot = [s for s in SPISlot if s.value == spi_slot][0] - self.spi_slot = BG_CS_FRONT_BCM if spi_slot == SPISlot.FRONT else BG_CS_BACK_BCM + if spi_slot == SPISlot.FRONT: + self.spi_slot = BG_CS_FRONT_BCM + else: + self.spi_slot = BG_CS_BACK_BCM except IndexError: raise ValueError('{} is not a valid value for spi_slot - possible values: {}'.format( spi_slot, [s.value for s in SPISlot]))