From b1faec667db4520c45d98dee7ea772e31825111a Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Wed, 24 Jun 2020 21:16:46 +0100 Subject: [PATCH] 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 --- wasp/boards/simulator/watch.py | 14 ++++++++++---- 1 file 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()