Skip to content

Commit

Permalink
Merge pull request #507 from retiutut/console-window-cleanup
Browse files Browse the repository at this point in the history
Cleanup: Console messages and additional hover text
  • Loading branch information
daniellasry authored May 4, 2019
2 parents 96bfaf0 + f57ae03 commit 5fee7aa
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion OpenBCI_GUI/BoardCyton.pde
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class Cyton {
}

} else {
println("port not open");
println("Cyton: Port not open");
}
}

Expand Down
2 changes: 2 additions & 0 deletions OpenBCI_GUI/ControlPanel.pde
Original file line number Diff line number Diff line change
Expand Up @@ -2648,6 +2648,7 @@ class PlaybackFileBox {
padding = _padding;

selectPlaybackFile = new Button (x + padding, y + padding*2 + 13, w - padding*2, 24, "SELECT PLAYBACK FILE", fontInfo.buttonLabel_size);
selectPlaybackFile.setHelpText("Click to open a dialog box to select an OpenBCI playback file (.txt or .csv).");
}

public void update() {
Expand Down Expand Up @@ -2846,6 +2847,7 @@ class SDConverterBox {
padding = _padding;

selectSDFile = new Button (x + padding, y + padding*2 + 13, w - padding*2, 24, "SELECT SD FILE", fontInfo.buttonLabel_size);
selectSDFile.setHelpText("Click here to select an SD file generated by Cyton or Cyton+Daisy and convert to plain text format.");
}

public void update() {
Expand Down
31 changes: 13 additions & 18 deletions OpenBCI_GUI/OpenBCI_GUI.pde
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ int lastReadDataPacketInd = -1;
// define some timing variables for this program's operation
long timeOfLastFrame = 0;
long timeOfInit;
boolean attemptingToConnect = false;

// Calculate nPointsPerUpdate based on sampling rate and buffer update rate
// @UPDATE_MILLIS: update the buffer every 40 milliseconds
Expand Down Expand Up @@ -188,7 +189,7 @@ int serial_output_baud = 9600; //baud rate from the Arduino
//Control Panel for (re)configuring system settings
PlotFontInfo fontInfo;

//program constants
//program variables
boolean isRunning = false;
boolean redrawScreenNow = true;
int openBCI_byteCount = 0;
Expand All @@ -199,7 +200,7 @@ boolean screenHasBeenResized = false;
float timeOfLastScreenResize = 0;
float timeOfGUIreinitialize = 0;
int reinitializeGUIdelay = 125;
//Tao's variabiles
//Tao's variables
int widthOfLastScreen = 0;
int heightOfLastScreen = 0;

Expand All @@ -217,7 +218,6 @@ PFont f2;
PFont f3;
PFont f4;


PFont h1; //large Montserrat
PFont h2; //large/medium Montserrat
PFont h3; //medium Montserrat
Expand All @@ -236,9 +236,6 @@ PFont p6; //small Open Sans

ButtonHelpText buttonHelpText;

//EMG_Widget emg_widget;
// PulseSensor_Widget pulseWidget;

boolean has_processed = false;
boolean isOldData = false;
//Used for playback file
Expand Down Expand Up @@ -272,8 +269,6 @@ public final static String stopButton_pressToStart_txt = "Start Data Stream";
int numSettingsPerChannel = 6; //each channel has 6 different settings
char[][] channelSettingValues = new char [nchan][numSettingsPerChannel]; // [channel#][Button#-value] ... this will incfluence text of button
char[][] impedanceCheckValues = new char [nchan][2];
//[Number of Channels] x 6 array of buttons for channel settings
//Button[][] channelSettingButtons = new Button [nchan][numSettingsPerChannel]; // [channel#][Button#] ///

SoftwareSettings settings = new SoftwareSettings();

Expand Down Expand Up @@ -397,7 +392,7 @@ void delayedSetup() {
cog = loadImage("cog_1024x1024.png");
consoleImgBlue = loadImage("console-45x45-dots_blue.png");
consoleImgWhite = loadImage("console-45x45-dots_white.png");
loadingGIF = new Gif(this, "OpenBCI-LoadingGIF-2.gif");
loadingGIF = new Gif(this, "ajax_loader_gray_512.gif");
loadingGIF.loop();
loadingGIF_blue = new Gif(this, "OpenBCI-LoadingGIF-blue-256.gif");
loadingGIF_blue.loop();
Expand Down Expand Up @@ -872,9 +867,8 @@ void startRunning() {
if (ganglion != null) {
ganglion.startDataTransfer();
}
} else {
} else if (eegDataSource == DATASOURCE_CYTON) {
if (cyton != null) {
println("DEBUG: start data transfer");
cyton.startDataTransfer();
}
}
Expand Down Expand Up @@ -1240,22 +1234,23 @@ void systemDraw() { //for drawing to the screen
}

if ((hub.get_state() == HubState.COMINIT || hub.get_state() == HubState.SYNCWITHHARDWARE) && systemMode == SYSTEMMODE_PREINIT) {
//make out blink the text "Initalizing GUI..."
pushStyle();
imageMode(CENTER);
image(loadingGIF, width/2, height/2, 128, 128);//render loading gif...
popStyle();
if (millis()%1000 < 500) {
if (!attemptingToConnect) {
output("Attempting to establish a connection with your OpenBCI Board...");
attemptingToConnect = true;
} else {
output("");
//@TODO: Fix this so that it shows during successful system inits ex. Cyton+Daisy w/ UserSettings
pushStyle();
imageMode(CENTER);
image(loadingGIF, width/2, height/2, 128, 128);//render loading gif...
popStyle();
}

if (millis() - timeOfInit > settings.initTimeoutThreshold) {
haltSystem();
initSystemButton.but_txt = "START SYSTEM";
output("Init timeout. Verify your Serial/COM Port. Power DOWN/UP your OpenBCI & USB Dongle. Then retry Initialization.");
controlPanel.open();
attemptingToConnect = false;
}
}

Expand Down
14 changes: 7 additions & 7 deletions OpenBCI_GUI/SoftwareSettings.pde
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// -- All FFT widget settings
// -- Default Layout, Notch, Bandpass Filter, Framerate, Board Mode, and other Global Settings
// -- Networking Mode and All settings for active networking protocol
// -- Analog Read, Head Plot, EMG, and Focus
// -- Accelerometer, Analog Read, Head Plot, EMG, and Focus
// -- Widget/Container Pairs
//
// Created: Richard Waltman - May/June 2018
Expand Down Expand Up @@ -281,7 +281,7 @@ class SoftwareSettings {
String defaultGUIVersion = "";

//Take a snapshot of the default GUI settings on every system init
println("SoftwareSettings: Saving Default Settings to file!");
println("InitSettings: Saving Default Settings to file!");
this.save(defaultSettingsFileToSave); //to avoid confusion with save() image

//Try Auto-load GUI settings between checkpoints 4 and 5 during system init.
Expand All @@ -292,7 +292,7 @@ class SoftwareSettings {
errorUserSettingsNotFound = false;
} catch (Exception e) {
//e.printStackTrace();
println("SoftwareSettings:Init: " + settingsFileToLoad + " not found or other error.");
println("InitSettings: " + settingsFileToLoad + " not found or other error.");
errorUserSettingsNotFound = true;
}
}
Expand Down Expand Up @@ -565,7 +565,7 @@ class SoftwareSettings {
//println("widget"+i+" is not active");
}
}
println(numActiveWidgets + " active widgets saved!");
println("SoftwareSettings: " + numActiveWidgets + " active widgets saved!");
//Print what widgets are in the containers used by current layout for only the number of active widgets
//for (int i = 0; i < numActiveWidgets; i++) {
//int containerCounter = wm.layouts.get(currentLayout-1).containerInts[i];
Expand Down Expand Up @@ -601,7 +601,7 @@ class SoftwareSettings {
}
//Check the Data Source integer next: Cyton = 0, Ganglion = 1, Playback = 2, Synthetic = 3
loadDatasource = loadDataSettings.getInt("Data Source");
println("loadGUISettings: Data source loaded: " + loadDatasource + ". Current data source: " + eegDataSource);
verbosePrint("loadGUISettings: Data source loaded: " + loadDatasource + ". Current data source: " + eegDataSource);
//Print error if trying to load a different data source (ex. Live != Synthetic)
if (loadDatasource != eegDataSource) {
println("Data source being loaded from " + loadGUISettingsFileLocation + " doesn't match current data source.");
Expand Down Expand Up @@ -791,7 +791,7 @@ class SoftwareSettings {
JSONObject loadWidgetSettings = loadSettingsJSONData.getJSONObject("widget");
//Apply Layout directly before loading and applying widgets to containers
wm.setNewContainerLayout(loadLayoutSetting);
println("Layout " + loadLayoutSetting + " Loaded!");
verbosePrint("LoadGUISettings: Layout " + loadLayoutSetting + " Loaded!");
numLoadedWidgets = loadWidgetSettings.size();


Expand All @@ -817,7 +817,7 @@ class SoftwareSettings {

wm.widgets.get(widgetToActivate).isActive = true;//activate the new widget
wm.widgets.get(widgetToActivate).setContainer(containerToApply);//map it to the container that was loaded!
println("Applied Widget " + widgetToActivate + " to Container " + containerToApply);
println("LoadGUISettings: Applied Widget " + widgetToActivate + " to Container " + containerToApply);
}//end case for all widget/container settings

/////////////////////////////////////////////////////////////
Expand Down
12 changes: 7 additions & 5 deletions OpenBCI_GUI/TopNav.pde
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TopNav {
int webGUIVersionInt;
int localGUIVersionInt;
Boolean guiVersionIsUpToDate;

//constructor
TopNav() {
int w = 256;
Expand Down Expand Up @@ -71,7 +71,7 @@ class TopNav {

//top right buttons from right to left
debugButton = new Button(width - 33 - 3, 3, 33, 26, " ", fontInfo.buttonLabel_size);
debugButton.setHelpText("Click to open Console Log window.");
debugButton.setHelpText("Click to open the Console Log window.");

tutorialsButton = new Button(debugButton.but_x - 80 - 3, 3, 80, 26, "Help", fontInfo.buttonLabel_size);
tutorialsButton.setFont(h3, 16);
Expand Down Expand Up @@ -219,12 +219,12 @@ class TopNav {
tutorialSelector.update();
if (configButton.but_x != width - (70*2) + 3) {
configButton.but_x = width - (70*2) + 3;
println("TopNav: Updated Settings Button Position");
verbosePrint("TopNav: Updated Settings Button Position");
}
} else {
if (configButton.but_x != width - 70 - 3) {
configButton.but_x = width - 70 - 3;
println("TopNav: Updated Settings Button Position");
verbosePrint("TopNav: Updated Settings Button Position");
}
}
configSelector.update();
Expand Down Expand Up @@ -935,7 +935,7 @@ class ConfigSelector {
tempConfigButton.setFont(p5, 12);
tempConfigButton.setColorNotPressed(newGreen);
tempConfigButton.setFontColorNotActive(color(255));
tempConfigButton.setHelpText("Expert Mode enables advanced keyboard shortcuts and access to all GUI features");
tempConfigButton.setHelpText("Expert Mode enables advanced keyboard shortcuts and access to all GUI features.");
configOptions.add(tempConfigButton);

//setup button 1 -- Save Custom Settings
Expand Down Expand Up @@ -964,6 +964,7 @@ class ConfigSelector {
tempConfigButton.setFont(p5, 12);
tempConfigButton.setColorNotPressed(cautionRed);
tempConfigButton.setFontColorNotActive(color(255));
tempConfigButton.setHelpText("This will clear all user settings and playback history. You will be asked to confirm.");
configOptions.add(tempConfigButton);

//setup button 5 -- Are You Sure? No
Expand All @@ -978,6 +979,7 @@ class ConfigSelector {
buttonNumber++;
tempConfigButton = new Button(x + margin, y + margin*(buttonNumber+1) + b_h*(buttonNumber+1), b_w, b_h, "Yes");
tempConfigButton.setFont(p5, 12);
tempConfigButton.setHelpText("Clicking 'Yes' will delete all user settings and stop system if running.");
configOptions.add(tempConfigButton);
}

Expand Down
1 change: 0 additions & 1 deletion OpenBCI_GUI/W_Accelerometer.pde
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class W_Accelerometer extends Widget {
currentAccelVals = new float[NUM_ACCEL_DIMS];

//create our channel bar and populate our accelerometerBar array!
println("Init accelerometer bar");
accelerometerBar = new AccelerometerBar(_parent, accelGraphX, accelGraphY, accelGraphWidth, accelGraphHeight);
accelerometerBar.adjustTimeAxis(w_timeSeries.xLimOptions[settings.tsHorizScaleSave]); //sync horiz axis to Time Series by default

Expand Down
2 changes: 1 addition & 1 deletion OpenBCI_GUI/W_Networking.pde
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ void Protocol(int protocolIndex){
} else if (protocolIndex==0){
w_networking.protocolMode = "Serial";
}
println(w_networking.protocolMode + " selected from Protocol Menu");
println("Networking: " + w_networking.protocolMode + " selected from Protocol Menu");
w_networking.screenResized();
w_networking.showCP5();
closeAllDropdowns();
Expand Down
1 change: 1 addition & 0 deletions OpenBCI_GUI/W_Playback.pde
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class W_playback extends Widget {
navHeight - 6,
"SELECT PLAYBACK FILE",
fontInfo.buttonLabel_size);
selectPlaybackFileButton.setHelpText("Click to open a dialog box to select an OpenBCI playback file (.txt or .csv).");
//make a MenuList
int initialWidth = w - padding*2;
cp5_playback = new ControlP5(pApplet);
Expand Down
1 change: 1 addition & 0 deletions OpenBCI_GUI/W_TimeSeries.pde
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ class ChannelBar{
}

onOffButton = new Button (x + 6, y + int(h/2) - int(onOff_diameter/2), onOff_diameter, onOff_diameter, channelString, fontInfo.buttonLabel_size);
onOffButton.setHelpText("Click to toggle channel " + channelNumber + ".");
onOffButton.setFont(h2, 16);
onOffButton.setCircleButton(true);
onOffButton.setColorNotPressed(channelColors[(channelNumber-1)%8]); //Set channel button background colors
Expand Down
6 changes: 3 additions & 3 deletions OpenBCI_GUI/WidgetManager.pde
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,10 @@ class WidgetManager{
//power some up
int numToPowerUp = numActiveWidgetsNeeded - numActiveWidgets;
int counter = 0;
println("WM: Powering " + numToPowerUp + " widgets up, and remapping.");
verbosePrint("WM: Powering " + numToPowerUp + " widgets up, and remapping.");
for(int i = 0; i < widgets.size(); i++){
if(!widgets.get(i).isActive && counter < numToPowerUp){
println("WM: Activating widget [" + i + "]");
verbosePrint("WM: Activating widget [" + i + "]");
widgets.get(i).isActive = true;
counter++;
}
Expand All @@ -390,7 +390,7 @@ class WidgetManager{

} else{ //if there are the same amount
//simply remap active widgets
println("WM: Remapping widgets.");
verbosePrint("WM: Remapping widgets.");
int counter = 0;
for(int i = 0; i < widgets.size(); i++){
if(widgets.get(i).isActive){
Expand Down
Binary file added OpenBCI_GUI/data/ajax_loader_gray_512.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5fee7aa

Please sign in to comment.