summaryrefslogtreecommitdiff
path: root/wasp/boards/simulator/watch.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-06-24 20:16:46 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-06-24 20:20:47 (GMT)
commitb1faec667db4520c45d98dee7ea772e31825111a (patch)
treee98f67e0fafc6df5608ec6d9a7737ad270ef0463 /wasp/boards/simulator/watch.py
parentadcc67cd6115efef07291bd071c55542bca9ef54 (diff)
simulator: Reverse the simulated PPG waveform
This avoids an implusive change in base value and makes the waveform a little more interesting. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/boards/simulator/watch.py')
-rw-r--r--wasp/boards/simulator/watch.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/wasp/boards/simulator/watch.py b/wasp/boards/simulator/watch.py
index 9f9920c..abdf571 100644
--- a/wasp/boards/simulator/watch.py
+++ b/wasp/boards/simulator/watch.py
@@ -140,11 +140,11 @@ class HRS():
9186,9182,9182,9193,9193,9193,9197,9197,9188,9204,9204,9212,9212,9212,9223,9223,
9228,9228,9228,9235,9235,9215,9215,9215,9217,9217,9225,9225,9225,9230,9230,9237,
9237,9237,9246,9246,9260,9260,9260,9270,9270,9269,9269,9269,9256,9256,9256,9256,
-9256,9263,9263,9274,9274,9274,9288,9288,9292,9292,9292,9307,9307,9310,9310,9310,
-9292,9292,9291,9291,9291,9297,9297,9298,9298,9298
+9256,9263,9263,9274,9274,9274,9288,9288,9292,9292,9292,9307,9307,9310
)
def __init__(self):
self._i = 0
+ self._step = 1
def enable(self):
pass
@@ -154,9 +154,15 @@ class HRS():
def read_hrs(self):
d = self.DATA[self._i]
- self._i += 1
+
+ self._i += self._step
if self._i >= len(self.DATA):
- self._i = 0
+ self._i -= 1
+ self._step = -1
+ elif self._i < 0:
+ self._i += 1
+ self._step = 1
+
return d
backlight = Backlight()