Skip to content

Commit

Permalink
Merge pull request #424 from OpenBCI/development
Browse files Browse the repository at this point in the history
Merging to Master - Preparing for release 4.0.3
  • Loading branch information
daniellasry authored Jan 19, 2019
2 parents a71bd55 + c49a910 commit a1f9361
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ OpenBCI_GUI/build/source/*.java
OpenBCI_GUI/SavedData
OpenBCI_GUI/SavedData/EEG_Data/SDconverted-*
OpenBCI_GUI/data/EEG_Data/*
OpenBCI_GUI/data/OpenBCIHub/*
OpenBCI_GUI/application.*.zip
OpenBCI_GUI/application.*
*.autosave
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# v4.0.3

Use OpenBCIHub v2.0.3 please.

### New Features

* On Windows, it is no longer necessary to launch the HUB separately.
* The HUB is packaged within the GUI on Windows, just like on Mac and Linux.

### Bug Fixes

* Ganglion did not work for Mojave #402
* Ganglion could not do playback file #399

## Beta 1

### Bug Fixes

* Fixed bug where cyton (and cyton daisy) did not work for auxData #414
* Fixed bug where GUI does not start hub on Windows #300

## Beta 0

* Initial Release

# v4.0.2

Use OpenBCIHub v2.0.2 please.
Expand Down
2 changes: 1 addition & 1 deletion OpenBCI_GUI/Info.plist.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleShortVersionString</key>
<string>3</string>
<key>CFBundleVersion</key>
<string>4.0.2</string>
<string>4.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
Expand Down
21 changes: 16 additions & 5 deletions OpenBCI_GUI/InterfaceHub.pde
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ final static String TCP_JSON_KEY_CHANNEL_SET_SRB2 = "srb2";
final static String TCP_JSON_KEY_CHANNEL_SET_SRB1 = "srb1";
final static String TCP_JSON_KEY_CODE = "code";
final static String TCP_JSON_KEY_COMMAND = "command";
final static String TCP_JSON_KEY_DATA = "data";
final static String TCP_JSON_KEY_FIRMWARE = "firmware";
final static String TCP_JSON_KEY_IMPEDANCE_VALUE = "impedanceValue";
final static String TCP_JSON_KEY_IMPEDANCE_SET_P_INPUT = "pInputApplied";
final static String TCP_JSON_KEY_IMPEDANCE_SET_N_INPUT = "nInputApplied";
final static String TCP_JSON_KEY_LATENCY = "latency";
final static String TCP_JSON_KEY_LOWER = "lower";
final static String TCP_JSON_KEY_MESSAGE = "message";
final static String TCP_JSON_KEY_NAME = "name";
final static String TCP_JSON_KEY_PROTOCOL = "protocol";
Expand Down Expand Up @@ -656,16 +658,25 @@ class Hub {
}
}
} else {
JSONArray auxDataValues = json.getJSONArray(TCP_JSON_KEY_AUX_DATA);
JSONObject auxData = json.getJSONObject(TCP_JSON_KEY_AUX_DATA);
JSONArray auxDataValues;
if (nchan == NCHAN_CYTON_DAISY) {
JSONObject lowerAuxData = auxData.getJSONObject(TCP_JSON_KEY_LOWER);
auxDataValues = lowerAuxData.getJSONArray(TCP_JSON_KEY_DATA);
} else {
auxDataValues = auxData.getJSONArray(TCP_JSON_KEY_DATA);
}
int j = 0;
for (int i = 0; i < auxDataValues.size(); i+=2) {
int val1 = auxDataValues.getInt(i);
int val2 = auxDataValues.getInt(i+1);

dataPacket.auxValues[i] = (val1 << 8) | val2;
validAccelValues[i] = (val1 << 8) | val2;
dataPacket.auxValues[j] = (val1 << 8) | val2;
validAccelValues[j] = (val1 << 8) | val2;

dataPacket.rawAuxValues[i][0] = byte(val2);
dataPacket.rawAuxValues[i][1] = byte(val1 << 8);
dataPacket.rawAuxValues[j][0] = byte(val2);
dataPacket.rawAuxValues[j][1] = byte(val1 << 8);
j++;
}
}
}
Expand Down
17 changes: 8 additions & 9 deletions OpenBCI_GUI/OpenBCI_GUI.pde
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ boolean isOldData = false;
//Used for playback file
int indices = 0;
//# columns used by a playback file determines number of channels
final int totalColumns4ChanThresh = 8;
final int totalColumns4ChanThresh = 10;
final int totalColumns16ChanThresh = 16;

boolean synthesizeData = false;
Expand Down Expand Up @@ -352,8 +352,8 @@ Boolean settingsLoadedCheck = false; //Used to determine if settings are done lo
final int initTimeoutThreshold = 12000; //Timeout threshold in milliseconds

//Used to check GUI version in TopNav.pde and displayed on the splash screen on startup
String localGUIVersionString = "v4.0.2";
String localGUIVersionDate = "November 2018";
String localGUIVersionString = "v4.0.3";
String localGUIVersionDate = "January 2019";
String guiLatestReleaseLocation = "https://github.com/OpenBCI/OpenBCI_GUI/releases/latest";
Boolean guiVersionCheckHasOccured = false;

Expand Down Expand Up @@ -571,10 +571,8 @@ private void prepareExitHandler () {
*/
void hubInit() {
isHubInitialized = true;
if (!isWindows()) {
hubStart();
prepareExitHandler();
}
hubStart();
prepareExitHandler();
}

/**
Expand All @@ -586,7 +584,7 @@ void hubStart() {
// https://forum.processing.org/two/discussion/13053/use-launch-for-applications-kept-in-data-folder
if (isWindows()) {
println("OpenBCI_GUI: hubStart: OS Detected: Windows");
nodeHubby = launch(dataPath("OpenBCIHub.exe"));
nodeHubby = launch(dataPath("/OpenBCIHub/OpenBCIHub.exe"));
} else if (isLinux()) {
println("OpenBCI_GUI: hubStart: OS Detected: Linux");
nodeHubby = exec(dataPath("OpenBCIHub"));
Expand Down Expand Up @@ -895,7 +893,8 @@ void initSystem() {
}
saveGUISettings(defaultSettingsFileToSave);

//Try Auto-load GUI settings between checkpoints 4 and 5 during GUI initialization. Otherwise, load default settings.
//Try Auto-load GUI settings between checkpoints 4 and 5 during system init.
//Otherwise, load default settings.
loadErrorTimerStart = millis();
try {
switch(eegDataSource) {
Expand Down
40 changes: 20 additions & 20 deletions OpenBCI_GUI/SoftwareSettings.pde
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
Created: Richard Waltman - May/June 2018
-- Start System first!
-- Capital 'S' to Save
-- Capital 'L' to Load
-- Functions SaveGUIsettings() and loadGUISettings() are called in Interactivty.pde with the rest of the keyboard shortcuts
-- Functions are also called in TopNav.pde when "Config" --> "Save Settings" || "Load Settings" is clicked
-- Lowercase 'n' to Save
-- Capital 'N' to Load
-- Functions saveGUIsettings() and loadGUISettings() are called:
- during system initialization between checkpoints 4 and 5
- in Interactivty.pde with the rest of the keyboard shortcuts
- in TopNav.pde when "Config" --> "Save Settings" || "Load Settings" is clicked
-- This allows User to store snapshots of most GUI settings in /SavedData/Settings/
-- After loading, only a few actions are required: start/stop the data stream and networking streams, open/close serial port, turn on/off Analog Read
*/
Expand Down Expand Up @@ -223,13 +225,9 @@ void saveGUISettings(String saveGUISettingsFileLocation) {
for (int i = 0; i < slnchan; i++) { //For all channels...
//Make a JSON Object for each of the Time Series Channels
JSONObject saveTimeSeriesSettings = new JSONObject();
for (int j = 0; j < 1; j++) {
switch(j) {
case 0: //Just save what channels are active
tsActiveSetting = Character.getNumericValue(channelSettingValues[i][j]); //Get integer value from char array channelSettingValues
break;
}
}
//Get integer value from char array channelSettingValues
tsActiveSetting = Character.getNumericValue(channelSettingValues[i][0]);
tsActiveSetting ^= 1;
saveTimeSeriesSettings.setInt("Channel_Number", (i+1));
saveTimeSeriesSettings.setInt("Active", tsActiveSetting);
saveTSSettingsJSONArray.setJSONObject(i, saveTimeSeriesSettings);
Expand Down Expand Up @@ -1057,24 +1055,26 @@ void loadApplyTimeSeriesSettings() {
if (eegDataSource == DATASOURCE_GANGLION) numChanloaded = 4;
for (int i = 0; i < numChanloaded; i++) {
JSONObject loadTSChannelSettings = loadTimeSeriesJSONArray.getJSONObject(i);
int channel = loadTSChannelSettings.getInt("Channel_Number") - 1; //when using with channelSettingsValues, will need to subtract 1
//int channel = loadTSChannelSettings.getInt("Channel_Number") - 1; //when using with channelSettingsValues, will need to subtract 1
int active = loadTSChannelSettings.getInt("Active");
//println("Ch " + channel + ", " + channelsActiveArray[active]);
if (active == 0) {
if (active == 1) {
if (eegDataSource == DATASOURCE_GANGLION) { //if using Ganglion, send the appropriate command to the hub to activate a channel
println("Ganglion: loadApplyChannelSettings(): activate: sending " + command_activate_channel[channel]);
hub.sendCommand(command_activate_channel[channel]);
w_timeSeries.hsc.powerUpChannel(channel);
println("Ganglion: loadApplyChannelSettings(): activate: sending " + command_activate_channel[i]);
hub.sendCommand(command_activate_channel[i]);
w_timeSeries.hsc.powerUpChannel(i);
}
w_timeSeries.channelBars[i].isOn = true;
w_timeSeries.channelBars[i].onOffButton.setColorNotPressed(channelColors[(channel)%8]);
channelSettingValues[i][0] = '0';
w_timeSeries.channelBars[i].onOffButton.setColorNotPressed(channelColors[(i)%8]);
} else {
if (eegDataSource == DATASOURCE_GANGLION) { //if using Ganglion, send the appropriate command to the hub to activate a channel
println("Ganglion: loadApplyChannelSettings(): deactivate: sending " + command_deactivate_channel[channel]);
hub.sendCommand(command_deactivate_channel[channel]);
w_timeSeries.hsc.powerDownChannel(channel);
println("Ganglion: loadApplyChannelSettings(): deactivate: sending " + command_deactivate_channel[i]);
hub.sendCommand(command_deactivate_channel[i]);
w_timeSeries.hsc.powerDownChannel(i);
}
w_timeSeries.channelBars[i].isOn = false; // deactivate it
channelSettingValues[i][0] = '1';
w_timeSeries.channelBars[i].onOffButton.setColorNotPressed(color(50));
}
}
Expand Down

0 comments on commit a1f9361

Please sign in to comment.