Merge pull request #114 from aj-ptw/fix-111

Fix #111 - Windows users saw unpleasent error message from ganglion h…
Esse commit está contido em:
AJ Keller
2017-01-31 18:56:29 -05:00
commit de GitHub
5 arquivos alterados com 61 adições e 20 exclusões
+8
Ver Arquivo
@@ -1,8 +1,16 @@
# 2.1.1
### Bug Fixes
* Fix #111 - No compatible USB now shows error in output, not an annoying popup.
# 2.1.0
### Breaking Changes
* Removed space in GanglionHub to be able to kill the hub on windows.
### Bug Fixes
* Issue #111 where Windows users saw error message from Ganglion Hub on start up if no hub selected.
# 2.0.0
* Initial Release
+12 -4
Ver Arquivo
@@ -144,6 +144,10 @@ public void controlEvent(ControlEvent theEvent) {
chanButton16.color_notPressed = autoFileName.color_notPressed; //default color of button
} else if(newDataSource == DATASOURCE_GANGLION){
updateToNChan(4);
if (isWindows() && isHubInitialized == false) {
hubInit();
timeOfSetup = millis();
}
} else if(newDataSource == DATASOURCE_PLAYBACKFILE){
updateToNChan(8);
} else if(newDataSource == DATASOURCE_SYNTHETIC){
@@ -377,7 +381,7 @@ class ControlPanel {
convertSDFile();
}
if (isGanglion) {
if (isHubInitialized && isGanglionObjectInitialized) {
if (!calledForBLEList) {
calledForBLEList = true;
if (ganglion.isHubRunning()) {
@@ -950,9 +954,13 @@ class ControlPanel {
//open or close serial port if serial port button is pressed (left button in serial widget)
if (refreshBLE.isMouseHere() && refreshBLE.wasPressed) {
output("BLE Devices Refreshing");
bleList.items.clear();
ganglion.searchDeviceStart();
if (isGanglionObjectInitialized) {
output("BLE Devices Refreshing");
bleList.items.clear();
ganglion.searchDeviceStart();
} else {
output("Please wait till BLE is fully initalized");
}
}
//open or close serial port if serial port button is pressed (left button in serial widget)
+18 -6
Ver Arquivo
@@ -83,6 +83,7 @@ class OpenBCI_Ganglion {
final static int RESP_ERROR_UNKNOWN = 499;
final static int RESP_ERROR_BAD_PACKET = 500;
final static int RESP_ERROR_BAD_NOBLE_START = 501;
final static int RESP_ERROR_ALREADY_CONNECTED = 408;
final static int RESP_ERROR_COMMAND_NOT_RECOGNIZED = 406;
final static int RESP_ERROR_DEVICE_NOT_FOUND = 405;
@@ -268,11 +269,7 @@ class OpenBCI_Ganglion {
println("OpenBCI_Ganglion: Log: " + list[1]);
break;
case 'q':
if (waitingForResponse) {
waitingForResponse = false;
println("Node process up!");
}
println("OpenBCI_Ganglion: Status: 200");
processStatus(msg);
break;
default:
println("OpenBCI_Ganglion: parseMessage: default: " + msg);
@@ -422,6 +419,21 @@ class OpenBCI_Ganglion {
}
}
}
private void processStatus(String msg) {
String[] list = split(msg, ',');
int code = Integer.parseInt(list[1]);
if (waitingForResponse) {
waitingForResponse = false;
println("Node process up!");
}
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 {
println("OpenBCI_Ganglion: processStatus: Started Successfully");
}
}
private void processScan(String msg) {
String[] list = split(msg, ',');
@@ -706,4 +718,4 @@ class OpenBCI_Ganglion {
controlPanel.open();
output("Ganglion now in bootloader mode! Enjoy!");
}
};
};
+21 -8
Ver Arquivo
@@ -230,7 +230,8 @@ int indices = 0;
boolean synthesizeData = false;
int timeOfSetup = 0;
boolean isGanglion = false;
boolean isHubInitialized = false;
boolean isGanglionObjectInitialized = false;
color bgColor = color(1, 18, 41);
color openbciBlue = color(31, 69, 110);
int COLOR_SCHEME_DEFAULT = 1;
@@ -255,9 +256,12 @@ void setup() {
// server on shut down of this app, the main process.
// prepareExitHandler();
if (dev == false) {
if (!isWindows()) hubStop(); //kill any existing hubs before starting a new one..
hubStart();
prepareExitHandler();
// On windows wait to start the hub until Ganglion is clicked on in the control panel.
// See issue #111
hubStop(); //kill any existing hubs before starting a new one..
if (!isWindows()) {
hubInit();
}
}
println("Welcome to the Processing-based OpenBCI GUI!"); //Welcome line.
@@ -391,6 +395,15 @@ private void prepareExitHandler () {
));
}
/**
* Starts the hub and sets prepares the exit handler.
*/
void hubInit() {
isHubInitialized = true;
hubStart();
prepareExitHandler();
}
/**
* Starts the node hub working, tested on mac and windows.
*/
@@ -709,10 +722,10 @@ void haltSystem() {
void systemUpdate() { // for updating data values and variables
if (millis() - timeOfSetup >= 1000 && isGanglion == false) {
if (isHubInitialized && isGanglionObjectInitialized == false && millis() - timeOfSetup >= 1500) {
ganglion = new OpenBCI_Ganglion(this);
println("Instantiating Ganglion object...");
isGanglion = true;
isGanglionObjectInitialized = true;
}
//update the sync state with the OpenBCI hardware
@@ -966,7 +979,7 @@ void introAnimation() {
textLeading(24);
fill(31, 69, 110, transparency);
textAlign(CENTER, CENTER);
text("OpenBCI GUI v2.1.0\nJanuary 2017", width/2, height/2 + width/9);
text("OpenBCI GUI v2.1.1\nJanuary 2017", width/2, height/2 + width/9);
}
//exit intro animation at t2
@@ -1026,4 +1039,4 @@ PVector getWindowLocation(String renderer) {
}
return l;
}
//END OF CODE FOR FIXING WEIRD EXIT CRASH ISSUE -- 7/27/16 ===========================
//END OF CODE FOR FIXING WEIRD EXIT CRASH ISSUE -- 7/27/16 ===========================
+2 -2
Ver Arquivo
@@ -93,7 +93,7 @@ class W_ganglionImpedance extends Widget {
popStyle();
}
if(isGanglion && eegDataSource == DATASOURCE_GANGLION){
if(isHubInitialized && isGanglionObjectInitialized && eegDataSource == DATASOURCE_GANGLION){
if(ganglion.isCheckingImpedance()){
image(loadingGIF_blue, x + padding + startStopCheck.but_dx + 15, y + padding - 8, 40, 40);
}
@@ -138,7 +138,7 @@ class W_ganglionImpedance extends Widget {
//put your code here...
if(startStopCheck.isActive && startStopCheck.isMouseHere()){
if(isGanglion && eegDataSource == DATASOURCE_GANGLION){
if(isHubInitialized && isGanglionObjectInitialized && eegDataSource == DATASOURCE_GANGLION){
if(ganglion.isCheckingImpedance()){
ganglion.impedanceStop();
startStopCheck.but_txt = "Start Impedance Check";