Skip to content

Commit

Permalink
Added also proper execption in case the board is pulled.
Browse files Browse the repository at this point in the history
  • Loading branch information
berndporr committed Nov 25, 2018
1 parent 155a1bc commit 91d111c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo/realtime_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def data_gen():
#endless loop which gets data
while True:
data = np.zeros(0)
while (not c.hasSampleAvilabale() == 0):
while c.hasSampleAvilabale():
sample = c.getSampleFromBuffer()
data = np.append(data,sample[0])
yield data
Expand Down
4 changes: 3 additions & 1 deletion pyusbdux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ sample_p getSampleFromBuffer() {

int hasSampleAvilabale() {
if (dev == NULL) throw "Device not open";
return comedi_get_buffer_contents(dev,subdevice) > 0;
int ret = comedi_get_buffer_contents(dev,subdevice);
if (ret < 0) throw "Device error. Possible disconnect.";
return ret > 0;
}


Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3

"""
setup.py file for pyusbdux.py
Expand All @@ -21,7 +21,7 @@ def read(fname):


setup (name = 'pyusbdux',
version = '1.3.3',
version = '1.3.4',
author = "Bernd Porr",
author_email = "mail@berndporr.me.uk",
url = "https://github.com/berndporr/pyusbdux",
Expand Down

0 comments on commit 91d111c

Please sign in to comment.