GIT.Harvie.CZ
/
mirrors
/
Programs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
165bbc9
)
allow changes-only mode
author
Tomas Mudrunka
<tomas@mudrunka.cz>
Wed, 18 Mar 2020 15:23:56 +0000
(16:23 +0100)
committer
Tomas Mudrunka
<tomas@mudrunka.cz>
Wed, 18 Mar 2020 15:23:56 +0000
(16:23 +0100)
plugins/sigrok-decoders/caliper/pd.py
patch
|
blob
|
blame
|
history
diff --git
a/plugins/sigrok-decoders/caliper/pd.py
b/plugins/sigrok-decoders/caliper/pd.py
index 9a9ad73b7a6d37097226202ce1f43b3646aeb124..3db047309be104c2223fe8032974dce7495ad7c3 100644
(file)
--- a/
plugins/sigrok-decoders/caliper/pd.py
+++ b/
plugins/sigrok-decoders/caliper/pd.py
@@
-39,6
+39,7
@@
class Decoder(srd.Decoder):
options = (
{'id': 'timeout_ms', 'desc': 'Timeout packet after X ms, 0 to disable', 'default': 10},
{'id': 'unit', 'desc': 'Convert units', 'default': 'keep', 'values': ('keep', 'mm', 'inch')},
options = (
{'id': 'timeout_ms', 'desc': 'Timeout packet after X ms, 0 to disable', 'default': 10},
{'id': 'unit', 'desc': 'Convert units', 'default': 'keep', 'values': ('keep', 'mm', 'inch')},
+ {'id': 'changes', 'desc': 'Changes only', 'default': 'no', 'values': ('no', 'yes')},
)
tags = ['Analog/digital', 'IC', 'Sensor']
annotations = (
)
tags = ['Analog/digital', 'IC', 'Sensor']
annotations = (
@@
-74,6
+75,7
@@
class Decoder(srd.Decoder):
return int(bin(x)[2:].zfill(l)[::-1], 2)
def decode(self):
return int(bin(x)[2:].zfill(l)[::-1], 2)
def decode(self):
+ self.last_measurement = None
while True:
clk, data = self.wait([{0: 'r'},{'skip': round(self.samplerate/1000)}])
#print([clk,data])
while True:
clk, data = self.wait([{0: 'r'},{'skip': round(self.samplerate/1000)}])
#print([clk,data])
@@
-143,7
+145,9
@@
class Decoder(srd.Decoder):
measurement = (str(number)+units)
#print(measurement)
measurement = (str(number)+units)
#print(measurement)
- self.put(self.ss_cmd, self.es_cmd, self.out_ann, [0, [measurement, str(number)]])
+ if ((self.options['changes'] == 'no') or (self.last_measurement != measurement)):
+ self.put(self.ss_cmd, self.es_cmd, self.out_ann, [0, [measurement, str(number)]])
+ self.last_measurement = measurement
#Prepare for next packet
self.reset()
#Prepare for next packet
self.reset()
This page took
0.115055 seconds
and
4
git commands to generate.