From 9b5af48c9a32a3fd2e57d9722b34afe61dd0338e Mon Sep 17 00:00:00 2001 From: AJ Keller Date: Fri, 9 Jun 2017 13:51:58 -0400 Subject: [PATCH 1/2] Close #142 - pass through key strokes to ganglion --- OpenBCI_GUI/GanglionSync.pde | 15 ++++++++++++--- OpenBCI_GUI/Interactivity.pde | 14 ++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/OpenBCI_GUI/GanglionSync.pde b/OpenBCI_GUI/GanglionSync.pde index c760134a6..1300ee1c3 100644 --- a/OpenBCI_GUI/GanglionSync.pde +++ b/OpenBCI_GUI/GanglionSync.pde @@ -419,7 +419,7 @@ class OpenBCI_Ganglion { } } } - + private void processStatus(String msg) { String[] list = split(msg, ','); int code = Integer.parseInt(list[1]); @@ -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"); } } @@ -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. @@ -718,4 +727,4 @@ class OpenBCI_Ganglion { controlPanel.open(); output("Ganglion now in bootloader mode! Enjoy!"); } -}; \ No newline at end of file +}; diff --git a/OpenBCI_GUI/Interactivity.pde b/OpenBCI_GUI/Interactivity.pde index c9c72c8b7..54144119b 100644 --- a/OpenBCI_GUI/Interactivity.pde +++ b/OpenBCI_GUI/Interactivity.pde @@ -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; } } From 08f447ce184c416210550170545fc948f4cb03e1 Mon Sep 17 00:00:00 2001 From: AJ Keller Date: Fri, 9 Jun 2017 13:53:06 -0400 Subject: [PATCH 2/2] Update readme and change log --- CHANGELOG.md | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 714c5b29f..f3235f621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 83862a05b..56d926eaa 100644 --- a/README.md +++ b/README.md @@ -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