Skip to content

Commit 9542908

Browse files
author
Sergio Chica
committed
Fixed wrong condition for POOR_SIGNAL warning
1 parent 48aedfb commit 9542908

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

neuropy3/neuropy3.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,34 +61,34 @@ def run(self):
6161
while not self.flag.is_set():
6262
self._read_packet()
6363

64-
def _read(self, bytes=1):
64+
def _read(self, n_bytes=1):
6565
"""Reads bytes from bluetooth socket
66-
:param bytes: Number of bytes to read
67-
:type bytes: int, optional. Default: 1
66+
:param n_bytes: Number of bytes to read
67+
:type n_bytes: int, optional. Default: 1
6868
:return: A bytearray read from bluetooth socket
6969
:rtype: bytearray"""
7070
self.socket.settimeout(5)
7171
try:
72-
return self.socket.recv(bytes)
72+
return self.socket.recv(n_bytes)
7373
except bluetooth.btcommon.BluetoothError:
7474
ut.log('error', "Bluetooth timed out. Check headset is on.",
7575
self.verbose)
7676
sys.exit(1)
7777

78-
def _b2i(self, value, bytes=1):
78+
def _b2i(self, value, n_bytes=1):
7979
"""Converts bytes to integer
8080
Depending of the size of the bytes, integer can be signed
8181
or unsigned. More info in thinkgear communications protocol
8282
:param value: Value to be converted
8383
:type value: bytearray
84-
:param bytes: Number of bytes to be converted
85-
:type bytes: int, optional. Allowed: 1, 2, 4. Default: 1
84+
:param n_bytes: Number of bytes to be converted
85+
:type n_bytes: int, optional. Allowed: 1, 2, 4. Default: 1
8686
:return: Value after converting bytearray
8787
:rtype: int"""
8888
vtype = '>B'
89-
if bytes == 2:
89+
if n_bytes == 2:
9090
vtype = '>h'
91-
elif bytes == 4:
91+
elif n_bytes == 4:
9292
vtype = '>I'
9393
return struct.unpack(vtype, value)[0]
9494

@@ -159,7 +159,7 @@ def _read_packet(self):
159159
"MindWave electrodes are not in "
160160
"contact with your skin.",
161161
self.verbose)
162-
elif value > ut.NO_CONTACT:
162+
elif value:
163163
ut.log('warn',
164164
"MindWave poor signal detected. "
165165
"Check electrodes or "

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
setup(
3333
name='neuropy3',
34-
version='1.0.2',
34+
version='1.0.3',
3535
description=('Python3 library to read data from '
3636
'Neurosky Mindwave Mobile 2 in linux.'),
3737
author='Sergio Chica',

0 commit comments

Comments
 (0)