Skip to content

Commit bbf2e8f

Browse files
committed
ganglion: fix API to integrate it to user.py, docs
1 parent 24c10da commit bbf2e8f

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For additional details on connecting your board visit: http://docs.openbci.com/t
2121

2222
### Ganglion Board
2323

24-
The Ganglion board relies on Bluetooth Low Energy connectivity (BLE). You should also retrieve the bluepy submodule for a more up-to-date version. To do so, clone this repo with the `--recursive` flag then type `make` inside `bluepy/bluepy`. Note that you may need to run the script with root privileges to for some functionality, e.g. auto-detect MAC address.
24+
The Ganglion board relies on Bluetooth Low Energy connectivity (BLE). You should also retrieve the bluepy submodule for a more up-to-date version than the version `1.0.5` available at that time through `pip`. To do so, clone this repo with the `--recursive` flag then type `make` inside `bluepy/bluepy`. Note that you may need to run the script with root privileges to for some functionality, e.g. auto-detect MAC address.
2525

2626
## Audience:
2727

open_bci_ganglion.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class OpenBCIBoard(object):
5959

6060
def __init__(self, port=None, baud=0, filter_data=False,
6161
scaled_output=True, daisy=False, log=True, timeout=-1, max_packets_to_skip=20):
62+
# unused, for compatibility with Cyton v3 API
63+
self.daisy = False
64+
6265
self.log = log # print_incoming_text needs log
6366
self.streaming = False
6467
self.timeout = timeout
@@ -127,9 +130,9 @@ def init_steaming(self):
127130
self.time_last_packet = timeit.default_timer()
128131

129132
def find_port(self):
130-
"""DetectsGanglion board MAC address -- if more than 1 around, will select first. Needs root privilege."""
133+
"""Detects Ganglion board MAC address -- if more than 1 around, will select first. Needs root privilege."""
131134

132-
print("Try to detect Ganglion MAC address. NB: Turn on bluetooth and run as root for this to work!")
135+
print("Try to detect Ganglion MAC address. NB: Turn on bluetooth and run as root for this to work! Might not work with every BLE dongles.")
133136
scan_time = 5
134137
print("Scanning for 5 seconds nearby devices...")
135138

@@ -368,7 +371,6 @@ def parse(self, packet):
368371

369372
def parseRaw(self, sample_id, packet):
370373
""" Dealing with "Raw uncompressed" """
371-
print ("Raw uncompressed")
372374
chan_data = []
373375
# 4 channels of 24bits, take values one by one
374376
for i in range(0,12,3):

user.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
print ("------------user.py-------------")
2121
parser = argparse.ArgumentParser(description="OpenBCI 'user'")
22-
parser.add_argument('--board', default=3, type=int)
22+
parser.add_argument('--board', default="cyton",
23+
help="Choose between [cyton] and [ganglion] boards.")
2324
parser.add_argument('-l', '--list', action='store_true',
2425
help="List available plugins.")
2526
parser.add_argument('-i', '--info', metavar='PLUGIN',
@@ -54,11 +55,11 @@
5455
if not(args.add):
5556
print ("WARNING: no plugin selected, you will only be able to communicate with the board. You should select at least one plugin with '--add [plugin_name]'. Use '--list' to show available plugins or '--info [plugin_name]' to get more information.")
5657

57-
if args.board == 3:
58-
print ("Board type: open_bci_v3...")
58+
if args.board == "cyton":
59+
print ("Board type: OpenBCI Cyton (v3 API)")
5960
import open_bci_v3 as bci
60-
elif args.board == 4:
61-
print ("Board type: open_bci_v_ganglion...")
61+
elif args.board == "ganglion":
62+
print ("Board type: OpenBCI Ganglion")
6263
import open_bci_ganglion as bci
6364
else:
6465
raise ValueError(

0 commit comments

Comments
 (0)