Skip to content

Commit

Permalink
Fix first edge handling. Informed by pull request from devel0 (Lorenz…
Browse files Browse the repository at this point in the history
…o Delana). Version bumped to 1.1.1
  • Loading branch information
GrandFatherADI committed Feb 1, 2021
1 parent 21233dd commit e389627
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions PulseStats.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,18 @@ def __init__(self, requested_measurements):
* Iterate over data to get transitions in the form of pairs of
`Time`, Bitstate (`True` for high, `False` for low)
* The first datum is at the first transition
`Time` currently only allows taking a difference with another `Time`, to
produce a `float` number of seconds
'''
def process_data(self, data):
for t, bitstate in data:
if self.lastState is None:
self.lastState = bitstate

if bitstate == self.lastState:
continue

self.lastState = bitstate

if self.lastTime is None:
self.lastTime = t

# Cant generate stats for the first edge
continue

timeDelta = float(t - self.lastTime)
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Pulse Stats",
"apiVersion": "1.0.0",
"author": "Peter Jaquiery",
"version": "1.1.0",
"version": "1.1.1",
"description": "Calculate min, mean and max pulse width stats",
"extensions": {
"PulseStats": {
Expand Down

0 comments on commit e389627

Please sign in to comment.