Skip to content

Commit f8356e6

Browse files
authored
fix crash that happens if no threshold given (#60)
1 parent 7233d5a commit f8356e6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pyControl/hardware.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ def __init__(self, pin, name, sampling_rate, threshold=None, rising_event=None,
233233
def _run_start(self):
234234
self.timer.init(freq=self.Analog_channel.sampling_rate)
235235
self.timer.callback(self._timer_ISR)
236-
self.threshold.run_start(self.read_sample())
236+
if self.threshold:
237+
self.threshold.run_start(self.read_sample())
237238

238239
def _run_stop(self):
239240
self.timer.deinit()
@@ -477,4 +478,4 @@ def _timer_callback(self):
477478
timer.set(self.pulse_dur, fw.hardw_typ, self.ID)
478479
fw.data_output_queue.put((fw.current_time, fw.event_typ, self.event_ID))
479480
self.state = not self.state
480-
self.sync_pin.value(self.state)
481+
self.sync_pin.value(self.state)

0 commit comments

Comments
 (0)