Skip to content

Commit

Permalink
Merge pull request #162 from aj-ptw/master
Browse files Browse the repository at this point in the history
Add passthrough keys to ganglion
  • Loading branch information
AJ Keller authored Jun 9, 2017
2 parents 600ec18 + 08f447c commit 4059179
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### New Features
* Band power widget #153 (thanks @sunwangshu)
* Closes #138 - Able to drag and drop the electrodes on the head map (thanks @liqwid)
* Closes #142 - GUI needs to pass key strokes to Ganglion

# 2.1.2

Expand Down
15 changes: 12 additions & 3 deletions OpenBCI_GUI/GanglionSync.pde
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class OpenBCI_Ganglion {
}
}
}

private void processStatus(String msg) {
String[] list = split(msg, ',');
int code = Integer.parseInt(list[1]);
Expand All @@ -430,7 +430,7 @@ class OpenBCI_Ganglion {
if (code == RESP_ERROR_BAD_NOBLE_START) {
println("OpenBCI_Ganglion: processStatus: Problem in the Hub");
output("Problem starting Ganglion Hub. Please make sure compatible USB is configured, then restart this GUI.");
} else {
} else {
println("OpenBCI_Ganglion: processStatus: Started Successfully");
}
}
Expand Down Expand Up @@ -611,6 +611,15 @@ class OpenBCI_Ganglion {
safeTCPWrite(TCP_CMD_COMMAND + "," + command_stop + TCP_STOP);
}


/**
* @description Sends a command to ganglion board
*/
public void passthroughCommand(char c) {
println("OpenBCI_Ganglion: passthroughCommand(): sending \'" + c);
safeTCPWrite(TCP_CMD_COMMAND + "," + c + TCP_STOP);
}

/**
* @description Write to TCP server
* @params out {String} - The string message to write to the server.
Expand Down Expand Up @@ -718,4 +727,4 @@ class OpenBCI_Ganglion {
controlPanel.open();
output("Ganglion now in bootloader mode! Enjoy!");
}
};
};
14 changes: 8 additions & 6 deletions OpenBCI_GUI/Interactivity.pde
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,14 @@ void parseKey(char val) {
break;

default:
println("OpenBCI_GUI: '" + key + "' Pressed...sending to OpenBCI...");
// if (openBCI.serial_openBCI != null) openBCI.serial_openBCI.write(key);//send the value as ascii with a newline character
//if (openBCI.serial_openBCI != null) openBCI.serial_openBCI.write(key);//send the value as ascii with a newline character
openBCI.sendChar(key);

break;
if (eegDataSource == DATASOURCE_NORMAL_W_AUX) {
println("Interactivity: '" + key + "' Pressed...sending to Cyton...");
openBCI.sendChar(key);
} else if (eegDataSource == DATASOURCE_GANGLION) {
println("Interactivity: '" + key + "' Pressed...sending to Ganglion...");
ganglion.passthroughCommand(key);
}
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Project Management Plan:
[![Stories in Ready](https://badge.waffle.io/OpenBCI/OpenBCI_GUI_v2.0.svg?label=ready&title=Ready)](http://waffle.io/OpenBCI/OpenBCI_GUI_v2.0)

# OpenBCI_GUI_v2.0
# OpenBCI_GUI
Based on OpenBCI_Processing, OpenBCI_GUI_v2.0 extends the GUI to include additional features, and interfaces with the OpenBCI [Cyton](http://shop.openbci.com/collections/frontpage/products/openbci-32-bit-board-kit?variant=784651699) and [Ganglion](http://shop.openbci.com/collections/frontpage/products/pre-order-ganglion-board?variant=13461804483) hardware systems. Tutorials, and getting started guides can be found on the [OpenBCI Learning Pages](http://docs.openbci.com/Getting%20Started/00-Welcome). For a guide on how to run this code in the Processing IDE, go [to our great docs](http://docs.openbci.com/OpenBCI%20Software/01-OpenBCI_GUI).

# IMPORTANT: GANGLION USERS
Expand Down

0 comments on commit 4059179

Please sign in to comment.