mirror of
https://github.com/pimoroni/grow-python
synced 2025-10-25 15:19:23 +00:00
Work around BCM8 edge detect/SPI issue for #1
This commit is contained in:
@@ -34,7 +34,19 @@ class Moisture(object):
|
||||
self._wet_point = wet_point if wet_point is not None else 0.7
|
||||
self._dry_point = dry_point if dry_point is not None else 27.6
|
||||
self._time_last_reading = time.time()
|
||||
GPIO.add_event_detect(self._gpio_pin, GPIO.RISING, callback=self._event_handler, bouncetime=1)
|
||||
try:
|
||||
GPIO.add_event_detect(self._gpio_pin, GPIO.RISING, callback=self._event_handler, bouncetime=1)
|
||||
except RuntimeError as e:
|
||||
if self._gpio_pin == 8:
|
||||
raise RuntimeError("""Unable to set up edge detection on BCM8.
|
||||
|
||||
Please ensure you add the following to /boot/config.txt and reboot:
|
||||
|
||||
dtoverlay=spi0-cs,cs0_pin=14 # Re-assign CS0 from BCM 8 so that Grow can use it
|
||||
|
||||
""")
|
||||
else:
|
||||
raise e
|
||||
|
||||
self._time_start = time.time()
|
||||
self._total_count = 0
|
||||
|
||||
@@ -64,4 +64,7 @@ commands =
|
||||
printf "Setting up i2c and SPI..\n"
|
||||
raspi-config nonint do_spi 0
|
||||
raspi-config nonint do_i2c 0
|
||||
configtxt =
|
||||
dtoverlay=spi0-cs,cs0_pin=14 # Re-assign CS0 from BCM 8 so that Grow can use it
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user