From 7e768635207257fc3c1b3f5db5f1c72fc58a6cef Mon Sep 17 00:00:00 2001 From: Kattni Date: Wed, 6 Dec 2017 19:11:01 -0500 Subject: [PATCH 1/2] Added error to cpx.shake for incompatible CircuitPython versions --- adafruit_circuitplayground/express.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adafruit_circuitplayground/express.py b/adafruit_circuitplayground/express.py index 5d8d54c..7ffec00 100755 --- a/adafruit_circuitplayground/express.py +++ b/adafruit_circuitplayground/express.py @@ -165,8 +165,10 @@ def shake(self): if cpx.shake(shake_threshold=20): print("Shake detected more easily than before!") """ - return self._lis3dh.shake() - + try: + return self._lis3dh.shake() + except AttributeError: + raise RuntimeError("Oops! You need a newer version of CircuitPython (2.2.0 or greater) to use cpx.shake.") @property def touch_A1(self): # pylint: disable=invalid-name From 5a0607c0f5f69cc5fb55b2dadb11ad0119cd9042 Mon Sep 17 00:00:00 2001 From: Kattni Date: Wed, 6 Dec 2017 19:23:02 -0500 Subject: [PATCH 2/2] Line length error resolved --- adafruit_circuitplayground/express.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_circuitplayground/express.py b/adafruit_circuitplayground/express.py index 7ffec00..f813534 100755 --- a/adafruit_circuitplayground/express.py +++ b/adafruit_circuitplayground/express.py @@ -168,7 +168,8 @@ def shake(self): try: return self._lis3dh.shake() except AttributeError: - raise RuntimeError("Oops! You need a newer version of CircuitPython (2.2.0 or greater) to use cpx.shake.") + raise RuntimeError("Oops! You need a newer version of CircuitPython " + "(2.2.0 or greater) to use cpx.shake.") @property def touch_A1(self): # pylint: disable=invalid-name